diff --git a/src/components/GrimoireWelcome.tsx b/src/components/GrimoireWelcome.tsx
index 2d7a948..d7e9091 100644
--- a/src/components/GrimoireWelcome.tsx
+++ b/src/components/GrimoireWelcome.tsx
@@ -1,11 +1,7 @@
import { Terminal } from "lucide-react";
import { Button } from "./ui/button";
import { Kbd, KbdGroup } from "./ui/kbd";
-import { Progress } from "./ui/progress";
import { GrimoireLogo } from "./ui/grimoire-logo";
-import { MONTHLY_GOAL_SATS } from "@/services/supporters";
-import { useLiveQuery } from "dexie-react-hooks";
-import db from "@/services/db";
interface GrimoireWelcomeProps {
onLaunchCommand: () => void;
@@ -13,11 +9,7 @@ interface GrimoireWelcomeProps {
}
const EXAMPLE_COMMANDS = [
- {
- command: "zap grimoire.rocks",
- description: "Support Grimoire development",
- showProgress: true,
- },
+ { command: "help", description: "Browse the command reference" },
{
command: "chat groups.0xchat.com'NkeVhXuWHGKKJCpn",
description: "Join the Grimoire welcome chat",
@@ -33,33 +25,6 @@ export function GrimoireWelcome({
onLaunchCommand,
onExecuteCommand,
}: GrimoireWelcomeProps) {
- // Calculate monthly donations reactively from DB (last 30 days)
- const monthlyDonations =
- useLiveQuery(async () => {
- const thirtyDaysAgo = Math.floor(Date.now() / 1000) - 30 * 24 * 60 * 60;
- let total = 0;
- await db.grimoireZaps
- .where("timestamp")
- .aboveOrEqual(thirtyDaysAgo)
- .each((zap) => {
- total += zap.amountSats;
- });
- return total;
- }, []) ?? 0;
-
- // Calculate progress
- const goalProgress = (monthlyDonations / MONTHLY_GOAL_SATS) * 100;
-
- // Format sats
- function formatSats(sats: number): string {
- if (sats >= 1_000_000) {
- return `${(sats / 1_000_000).toFixed(1)}M`;
- } else if (sats >= 1_000) {
- return `${Math.floor(sats / 1_000)}k`;
- }
- return sats.toString();
- }
-
return (
@@ -122,7 +87,7 @@ export function GrimoireWelcome({
Try these commands:
- {EXAMPLE_COMMANDS.map(({ command, description, showProgress }) => (
+ {EXAMPLE_COMMANDS.map(({ command, description }) => (
))}
diff --git a/src/components/ManPage.tsx b/src/components/ManPage.tsx
index 211f1e6..a127eeb 100644
--- a/src/components/ManPage.tsx
+++ b/src/components/ManPage.tsx
@@ -1,8 +1,9 @@
-import { manPages } from "@/types/man";
+import { manPages, type ManPageEntry } from "@/types/man";
import { useAddWindow } from "@/core/state";
import { CenteredContent } from "./ui/CenteredContent";
import { cn } from "@/lib/utils";
import { Button } from "./ui/button";
+import { Fragment, useMemo } from "react";
interface ManPageProps {
cmd: string;
@@ -54,7 +55,88 @@ export function ExecutableCommand({
);
}
+function CommandIndex() {
+ const grouped = useMemo(() => {
+ const groups: Record
= {};
+ for (const [name, entry] of Object.entries(manPages)) {
+ const cat = entry.category;
+ if (!groups[cat]) groups[cat] = [];
+ groups[cat].push({ name, entry });
+ }
+ for (const cat of Object.keys(groups)) {
+ groups[cat].sort((a, b) => a.name.localeCompare(b.name));
+ }
+ return groups;
+ }, []);
+
+ // Order categories consistently
+ const categoryOrder = ["Documentation", "Nostr", "System"] as const;
+
+ return (
+
+ {/* Header */}
+
+ GRIMOIRE(1)
+ Grimoire Manual
+ GRIMOIRE(1)
+
+
+ {/* NAME */}
+
+ NAME
+ grimoire - a nostr client for magicians
+
+
+ {/* DESCRIPTION */}
+
+ DESCRIPTION
+
+ Grimoire is a Nostr protocol explorer and developer tool. Press Cmd+K
+ to launch commands. Type "man <command>" for details.
+
+
+
+ {/* COMMANDS */}
+
+ COMMANDS
+
+ {categoryOrder.map((category) => {
+ const commands = grouped[category];
+ if (!commands) return null;
+ return (
+
+
+ {category}
+
+
+ {commands.map(({ name, entry }) => (
+
+
+ {name}
+
+
+ {entry.description.split(".")[0]}
+
+
+ ))}
+
+
+ );
+ })}
+
+
+
+ );
+}
+
export default function ManPage({ cmd }: ManPageProps) {
+ if (cmd === "help") {
+ return ;
+ }
+
const page = manPages[cmd];
if (!page) {
@@ -167,11 +249,6 @@ export default function ManPage({ cmd }: ManPageProps) {
)}
-
- {/* Footer */}
-
- Grimoire 1.0.0 {new Date().getFullYear()}
-
);
}
diff --git a/src/types/man.ts b/src/types/man.ts
index 9796843..fa41073 100644
--- a/src/types/man.ts
+++ b/src/types/man.ts
@@ -105,7 +105,7 @@ export const manPages: Record = {
examples: ["kinds View all supported event kinds"],
seeAlso: ["kind", "nip", "man"],
appId: "kinds",
- category: "System",
+ category: "Documentation",
defaultProps: {},
},
nips: {
@@ -785,7 +785,7 @@ export const manPages: Record = {
examples: ["spells Browse your saved spells"],
seeAlso: ["req"],
appId: "spells",
- category: "Nostr",
+ category: "System",
defaultProps: {},
},
blossom: {