Update Main to monorepo structure (#5)
* feat: Convert to a webhooks api model! feat: Update readme with new api docs and images and logo feat: reoptimize jpgs and add comments to all images for credit feat: Add database backend implementations Todo is to update the readme feat: use memory storage for endpoints feat: add logging to rest api and remove ctrl override feat: remove keyboard monitor delete the discord api from direct reference * feat: webhook sending with retries and backoff Also some great readme changes * feat: add a web based dev mode! * feat: better error handling for webhook endopoints * feat: remove verbose logs * feat: add docs for local dev * feat: remove complex webhook stuff config file with endpoints listed instead * feat: update logo * feat: set endpoint and remove rest api * fix: check for negative config numbers * feat: remove timestamps from webhook Use Date header instead * feat: refactor to using one endpoint with env vars * feat: change logging to be one rolling log With a max line size of 10k lines * feat: move config to toml, keep api in env var * feat: use .env files for managing env vars * fix: remove log files from dev * fix: unblock web monitor thread * feat: merge into a monorepo with noisebridge-status
This commit is contained in:
parent
716153b1b6
commit
dff2e96947
54 changed files with 6967 additions and 973 deletions
71
noisebell-status/src/components/Status.tsx
Normal file
71
noisebell-status/src/components/Status.tsx
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
import {
|
||||
Card,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card"
|
||||
|
||||
async function getStatus(): Promise<'open' | 'closed'> {
|
||||
try {
|
||||
const response = await fetch(`${process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000'}/api/status`, {
|
||||
cache: 'no-store'
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
return 'closed';
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
return data?.status === 'open' ? 'open' : 'closed';
|
||||
} catch {
|
||||
return 'closed';
|
||||
}
|
||||
}
|
||||
|
||||
export async function Status() {
|
||||
const status = await getStatus();
|
||||
|
||||
const statusConfig = {
|
||||
open: {
|
||||
title: 'Open',
|
||||
description: "It's time to start hacking.",
|
||||
image: 'https://raw.githubusercontent.com/jetpham/noisebell/refs/heads/webhooks/media/open.png',
|
||||
color: 'text-green-600',
|
||||
bgColor: 'bg-green-50',
|
||||
borderColor: 'border-green-200'
|
||||
},
|
||||
closed: {
|
||||
title: 'Closed',
|
||||
description: "We'll see you again soon.",
|
||||
image: 'https://raw.githubusercontent.com/jetpham/noisebell/refs/heads/webhooks/media/closed.png',
|
||||
color: 'text-red-600',
|
||||
bgColor: 'bg-red-50',
|
||||
borderColor: 'border-red-200'
|
||||
}
|
||||
}
|
||||
|
||||
const config = statusConfig[status]
|
||||
|
||||
return (
|
||||
<Card className={`${config.bgColor} ${config.borderColor} border-2 inline-block w-fit min-w-[300px]`}>
|
||||
<CardHeader className="flex flex-row items-center justify-between">
|
||||
<div className="flex-1">
|
||||
<CardTitle className={`text-2xl font-bold ${config.color}`}>
|
||||
{config.title}
|
||||
</CardTitle>
|
||||
<CardDescription className="text-base">
|
||||
{config.description}
|
||||
</CardDescription>
|
||||
</div>
|
||||
<div className="flex-shrink-0 ml-4 flex items-center">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
src={config.image}
|
||||
alt={`A knife switch in the ${config.title} position`}
|
||||
className="h-full max-h-[60px] w-auto object-contain"
|
||||
/>
|
||||
</div>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue