Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

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

Gener73c30e24470a
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
new file mode 100644
index 000000000..a09412b4b
--- /dev/null
+++ b/src/web/src/app/(app)/w/[slug]/home/_components/daily-quote.tsx
@@ -0,0 +1,46 @@
+"use client";
+
+import { useEffect, useState } from "react";
+
+const FALLBACK_QUOTES = [
+ { q: "Have a wonderful day!", a: "" },
+ { q: "Every day is a fresh start.", a: "" },
+ { q: "Small steps lead to great journeys.", a: "" },
+ { q: "Stay curious, keep building.", a: "" },
+];
+
+interface DailyQuote {
+ q: string;
+ a: string;
+}
+
+export function DailyQuote() {
+ const [quote, setQuote] = useState<DailyQuote | null>(null);
+
+ useEffect(() => {
+ let cancelled = false;
+ fetch("https://zenquotes.io/api/today")
+ .then((r) => r.json() as Promise<DailyQuote[]>)
+ .then((data) => {
+ if (!cancelled && data?.[0]?.q) {
+ setQuote(data[0]);
+ }
+ })
+ .catch(() => {
+ if (!cancelled) {
+ const idx = new Date().getDate() % FALLBACK_QUOTES.length;
+ setQuote(FALLBACK_QUOTES[idx]);
+ }
+ });
+ return () => { cancelled = true; };
+ }, []);
+
+ if (!quote) return null;
+
+ 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>}
+ </div>
+ );
+}
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 f9b174122..77817957f 100644
--- a/src/web/src/app/(app)/w/[slug]/home/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/home/page.tsx
@@ -8,14 +8,10 @@ import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
import { Loader2 } from "lucide-react";
import { getWorkspaceOverview, type WorkspaceOverview } from "@/lib/api";
-import { QuickStatsRow } from "./_components/quick-stats";
import { AgentOverview } from "./_components/agent-overview";
-import { TaskHealth } from "./_components/task-health";
-import { EmailSummary } from "./_components/email-summary";
import { RecentActivity } from "./_components/recent-activity";
import { CalendarOverview } from "./_components/calendar-overview";
-import { RuntimeHealth } from "./_components/runtime-health";
-import { TeamAccess } from "./_components/team-access";
+import { DailyQuote } from "./_components/daily-quote";
export default function HomePage() {
const router = useRouter();
@@ -95,17 +91,11 @@ export default function HomePage() {
return (
<div className="flex-1 overflow-y-auto">
<div className="p-4 lg:p-6 space-y-4">
- <div className="grid gap-3 grid-cols-2 sm:grid-cols-3 lg:grid-cols-6">
- {Array.from({ length: 6 }).map((_, i) => (
- <Skeleton key={i} className="h-20 rounded-xl" />
- ))}
- </div>
<Skeleton className="h-48 rounded-xl" />
<div className="grid gap-4 lg:grid-cols-2">
<Skeleton className="h-44 rounded-xl" />
<Skeleton className="h-44 rounded-xl" />
</div>
- <Skeleton className="h-48 rounded-xl" />
</div>
</div>
);
@@ -114,12 +104,6 @@ export default function HomePage() {
return (
<div className="flex-1 overflow-y-auto">
<div className="p-4 lg:p-6 space-y-4">
- <QuickStatsRow
- agents={agents}
- runtimes={runtimes}
- activeTaskCounts={activeTaskCounts}
- overview={overview}
- />
<AgentOverview
agents={agents}
runtimes={runtimes}
@@ -127,15 +111,10 @@ export default function HomePage() {
overview={overview}
/>
<div className="grid gap-4 lg:grid-cols-2">
- <TaskHealth overview={overview} />
- <EmailSummary overview={overview} agents={agents} />
- </div>
- <RecentActivity overview={overview} agents={agents} />
- <div className="grid gap-4 lg:grid-cols-2">
+ <RecentActivity overview={overview} agents={agents} />
<CalendarOverview overview={overview} agents={agents} />
- <RuntimeHealth runtimes={runtimes} agents={agents} />
</div>
- <TeamAccess overview={overview} />
+ <DailyQuote />
</div>
</div>
);
diff --git a/src/web/src/app/(app)/w/[slug]/settings/page.tsx b/src/web/src/app/(app)/w/[slug]/settings/page.tsx
index df828f684..3022f6379 100644
--- a/src/web/src/app/(app)/w/[slug]/settings/page.tsx
+++ b/src/web/src/app/(app)/w/[slug]/settings/page.tsx
@@ -8,12 +8,14 @@ import { GeneralTab } from "./general-tab";
import { InstructionTab } from "./instruction-tab";
import { MembersTab } from "./members-tab";
import { NotificationTab } from "./notification-tab";
+import { UsagesTab } from "./usages-tab";
const TABS = [
{ id: "general", label: "General" },
{ id: "instruction", label: "Instruction" },
{ id: "notifications", label: "Notifications" },
{ id: "members", label: "Members" },
+ { id: "usages", label: "Usages" },
] as const;
type TabId = (typeof TABS)[number]["id"];
@@ -67,6 +69,8 @@ export default function SettingsPage() {
)}>
{activeTab === "instruction" ? (
<InstructionTab />
+ ) : activeTab === "usages" ? (
+ <UsagesTab />
) : (
<div className="mx-auto max-w-md">
{activeTab === "general" && <GeneralTab />}
diff --git a/src/web/src/app/(app)/w/[slug]/settings/usages-tab.tsx b/src/web/src/app/(app)/w/[slug]/settings/usages-tab.tsx
new file mode 100644
index 000000000..e206004f1
--- /dev/null
+++ b/src/web/src/app/(app)/w/[slug]/settings/usages-tab.tsx
@@ -0,0 +1,64 @@
+"use client";
+
+import { useEffect, useState } from "react";
+import { useAgentContext } from "@/contexts/agent-context";
+import { useWorkspace } from "@/contexts/workspace-context";
+import { Skeleton } from "@/components/ui/skeleton";
+import { getWorkspaceOverview, type WorkspaceOverview } from "@/lib/api";
+import { QuickStatsRow } from "../home/_components/quick-stats";
+import { TaskHealth } from "../home/_components/task-health";
+import { EmailSummary } from "../home/_components/email-summary";
+import { RuntimeHealth } from "../home/_components/runtime-health";
+import { TeamAccess } from "../home/_components/team-access";
+
+export function UsagesTab() {
+ const { agents, runtimes, loading, activeTaskCounts } = useAgentContext();
+ const { workspaceId } = useWorkspace();
+ const [overview, setOverview] = useState<WorkspaceOverview | null>(null);
+ const [overviewLoading, setOverviewLoading] = useState(false);
+
+ useEffect(() => {
+ if (loading) return;
+ let cancelled = false;
+ setOverviewLoading(true);
+ getWorkspaceOverview(workspaceId)
+ .then((data) => {
+ if (!cancelled) setOverview(data);
+ })
+ .catch(() => {})
+ .finally(() => {
+ if (!cancelled) setOverviewLoading(false);
+ });
+ return () => { cancelled = true; };
+ }, [loading, workspaceId]);
+
+ if (overviewLoading || !overview) {
+ return (
+ <div className="space-y-4">
+ <Skeleton className="h-44 rounded-xl" />
+ <Skeleton className="h-44 rounded-xl" />
+ <Skeleton className="h-44 rounded-xl" />
+ <Skeleton className="h-44 rounded-xl" />
+ </div>
+ );
+ }
+
+ return (
+ <div className="space-y-4">
+ <QuickStatsRow
+ agents={agents}
+ runtimes={runtimes}
+ activeTaskCounts={activeTaskCounts}
+ overview={overview}
+ />
+ <div className="grid gap-4 lg:grid-cols-2">
+ <TaskHealth overview={overview} />
+ <EmailSummary overview={overview} agents={agents} />
+ </div>
+ <div className="grid gap-4 lg:grid-cols-2">
+ <RuntimeHealth runtimes={runtimes} agents={agents} />
+ <TeamAccess overview={overview} />
+ </div>
+ </div>
+ );
+}