Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat(web): simplify home layout, add Usages settings tab, daily quote proxy

Gener5973ce319b3f
diff --git a/src/web/src/app/(app)/w/[slug]/home/_components/calendar-overview.tsx b/src/web/src/app/(app)/w/[slug]/home/_components/calendar-overview.tsx
index a29568a59..7c631b227 100644
--- a/src/web/src/app/(app)/w/[slug]/home/_components/calendar-overview.tsx
+++ b/src/web/src/app/(app)/w/[slug]/home/_components/calendar-overview.tsx
@@ -59,17 +59,17 @@ export function CalendarOverview({ overview, agents }: CalendarOverviewProps) {
</CardHeader>
<CardContent className="space-y-3">
<div className="grid grid-cols-3 gap-3">
- <div>
+ <div className="rounded-lg border border-border/50 px-3 py-2 text-center">
<p className="text-xl font-semibold">{todayEvents.length}</p>
- <p className="text-xs text-muted-foreground">Today</p>
+ <p className="text-[10px] text-muted-foreground">Today</p>
</div>
- <div>
+ <div className="rounded-lg border border-border/50 px-3 py-2 text-center">
<p className="text-xl font-semibold">{recurring.length}</p>
- <p className="text-xs text-muted-foreground">Recurring</p>
+ <p className="text-[10px] text-muted-foreground">Recurring</p>
</div>
- <div>
+ <div className="rounded-lg border border-border/50 px-3 py-2 text-center">
<p className="text-xl font-semibold">{oneOff.length}</p>
- <p className="text-xs text-muted-foreground">One-off</p>
+ <p className="text-[10px] text-muted-foreground">One-off</p>
</div>
</div>
@@ -98,7 +98,10 @@ export function CalendarOverview({ overview, agents }: CalendarOverviewProps) {
)}
{calendar_events.length === 0 && (
- <p className="text-sm text-muted-foreground">No events this week.</p>
+ <div className="flex flex-col items-center py-4 text-muted-foreground">
+ <CalendarDays className="size-8 opacity-20 mb-2" />
+ <p className="text-sm">No events this week</p>
+ </div>
)}
</CardContent>
</Card>
diff --git a/src/web/src/app/(app)/w/[slug]/home/_components/daily-quote.tsx b/src/web/src/app/(app)/w/[slug]/home/_components/daily-quote.tsx
index a09412b4b..e34b7c6c2 100644
--- a/src/web/src/app/(app)/w/[slug]/home/_components/daily-quote.tsx
+++ b/src/web/src/app/(app)/w/[slug]/home/_components/daily-quote.tsx
@@ -19,11 +19,11 @@ export function DailyQuote() {
useEffect(() => {
let cancelled = false;
- fetch("https://zenquotes.io/api/today")
- .then((r) => r.json() as Promise<DailyQuote[]>)
+ fetch("/api/daily-quote")
+ .then((r) => r.json() as Promise<DailyQuote>)
.then((data) => {
- if (!cancelled && data?.[0]?.q) {
- setQuote(data[0]);
+ if (!cancelled && data?.q) {
+ setQuote(data);
}
})
.catch(() => {
@@ -40,7 +40,7 @@ export function DailyQuote() {
return (
<div className="text-center py-2">
<p className="text-xs text-muted-foreground/50 italic">— {quote.q} —</p>
- {quote.a && <p className="text-[10px] text-muted-foreground/40 mt-0.5">{quote.a}</p>}
+ {quote.a && <p className="text-[10px] text-muted-foreground/40 -mt-0.5">{quote.a}</p>}
</div>
);
}
diff --git a/src/web/src/app/(app)/w/[slug]/home/_components/recent-activity.tsx b/src/web/src/app/(app)/w/[slug]/home/_components/recent-activity.tsx
index f7a1e150b..9c817b110 100644
--- a/src/web/src/app/(app)/w/[slug]/home/_components/recent-activity.tsx
+++ b/src/web/src/app/(app)/w/[slug]/home/_components/recent-activity.tsx
@@ -41,7 +41,10 @@ export function RecentActivity({ overview, agents }: RecentActivityProps) {
<CardTitle>Recent Activity</CardTitle>
</CardHeader>
<CardContent>
- <p className="text-sm text-muted-foreground">No recent activity.</p>
+ <div className="flex flex-col items-center py-4 text-muted-foreground">
+ <MessageSquare className="size-8 opacity-20 mb-2" />
+ <p className="text-sm">No recent activity</p>
+ </div>
</CardContent>
</Card>
);
diff --git a/src/web/src/app/(app)/w/[slug]/home/page.tsx b/src/web/src/app/(app)/w/[slug]/home/page.tsx
index 77817957f..5419a9262 100644
--- a/src/web/src/app/(app)/w/[slug]/home/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/home/page.tsx
@@ -103,16 +103,18 @@ export default function HomePage() {
return (
<div className="flex-1 overflow-y-auto">
- <div className="p-4 lg:p-6 space-y-4">
- <AgentOverview
- agents={agents}
- runtimes={runtimes}
- activeTaskCounts={activeTaskCounts}
- overview={overview}
- />
- <div className="grid gap-4 lg:grid-cols-2">
- <RecentActivity overview={overview} agents={agents} />
- <CalendarOverview overview={overview} agents={agents} />
+ <div className="flex min-h-full flex-col justify-between p-4 lg:p-6">
+ <div className="flex-1 flex flex-col gap-4">
+ <AgentOverview
+ agents={agents}
+ runtimes={runtimes}
+ activeTaskCounts={activeTaskCounts}
+ overview={overview}
+ />
+ <div className="grid gap-4 lg:grid-cols-2 lg:flex-1 lg:[&>*]:h-full">
+ <RecentActivity overview={overview} agents={agents} />
+ <CalendarOverview overview={overview} agents={agents} />
+ </div>
</div>
<DailyQuote />
</div>
diff --git a/src/web/src/app/api/daily-quote/route.ts b/src/web/src/app/api/daily-quote/route.ts
new file mode 100644
index 000000000..8771d6fa8
--- /dev/null
+++ b/src/web/src/app/api/daily-quote/route.ts
@@ -0,0 +1,24 @@
+import { NextResponse } from "next/server";
+
+let cached: { date: string; q: string; a: string } | null = null;
+
+export async function GET() {
+ const today = new Date().toISOString().split("T")[0];
+
+ if (cached && cached.date === today) {
+ return NextResponse.json({ q: cached.q, a: cached.a });
+ }
+
+ try {
+ const res = await fetch("https://zenquotes.io/api/today", {
+ next: { revalidate: 3600 },
+ });
+ const data = await res.json() as { q: string; a: string }[];
+ if (data?.[0]?.q) {
+ cached = { date: today, q: data[0].q, a: data[0].a };
+ return NextResponse.json({ q: cached.q, a: cached.a });
+ }
+ } catch {}
+
+ return NextResponse.json({ q: "", a: "" });
+}