diff --git a/TODO.md b/TODO.md index c7aaca0..5dcd568 100644 --- a/TODO.md +++ b/TODO.md @@ -23,3 +23,11 @@ Current RTL implementation is partial and has limitations: 4. Accept partial RTL support and document limitations **Test case**: Arabic text with hashtags on same line should display properly with right-alignment. + +## TODO: compact Live indicator for REQ viewer +## TODO: nested lists in Markdown should be padded +## TODO: "live" sometimes not working? +look into reconnecting on errors +## TODO: improve text rendering + +avoid inserting `br`, look into noStrudel's eol metadata diff --git a/src/components/DebugViewer.tsx b/src/components/DebugViewer.tsx new file mode 100644 index 0000000..f93e6f8 --- /dev/null +++ b/src/components/DebugViewer.tsx @@ -0,0 +1,40 @@ +import { useGrimoire } from "@/core/state"; +import { Copy, Check } from "lucide-react"; +import { useCopy } from "@/hooks/useCopy"; + +export function DebugViewer() { + const { state } = useGrimoire(); + const { copy, copied } = useCopy(); + + const stateJson = JSON.stringify(state, null, 2); + + return ( +
+
+

Application State

+ +
+
+
+          {stateJson}
+        
+
+
+ ); +} diff --git a/src/components/WindowRenderer.tsx b/src/components/WindowRenderer.tsx index e2b9278..d1494c4 100644 --- a/src/components/WindowRenderer.tsx +++ b/src/components/WindowRenderer.tsx @@ -13,6 +13,7 @@ import { RelayViewer } from "./RelayViewer"; import KindRenderer from "./KindRenderer"; import Feed from "./nostr/Feed"; import { WinViewer } from "./WinViewer"; +import { DebugViewer } from "./DebugViewer"; interface WindowRendererProps { window: WindowInstance; @@ -129,6 +130,9 @@ export function WindowRenderer({ window, onClose }: WindowRendererProps) { case "relay": content = ; break; + case "debug": + content = ; + break; default: content = (
diff --git a/src/components/nostr/UserName.tsx b/src/components/nostr/UserName.tsx index 8458fb1..e8476ad 100644 --- a/src/components/nostr/UserName.tsx +++ b/src/components/nostr/UserName.tsx @@ -13,12 +13,16 @@ interface UserNameProps { * Component that displays a user's name from their Nostr profile * Shows placeholder derived from pubkey while loading or if no profile exists * Clicking opens the user's profile + * Uses orange-400 color for the logged-in user */ export function UserName({ pubkey, isMention, className }: UserNameProps) { - const { addWindow } = useGrimoire(); + const { addWindow, state } = useGrimoire(); const profile = useProfile(pubkey); const displayName = getDisplayName(pubkey, profile); + // Check if this is the logged-in user + const isActiveAccount = state.activeAccount?.pubkey === pubkey; + const handleClick = (e: React.MouseEvent) => { e.stopPropagation(); addWindow("profile", { pubkey }, `Profile ${pubkey.slice(0, 8)}...`); @@ -27,7 +31,11 @@ export function UserName({ pubkey, isMention, className }: UserNameProps) { return ( {isMention ? "@" : null} diff --git a/src/components/nostr/kinds/BaseEventRenderer.tsx b/src/components/nostr/kinds/BaseEventRenderer.tsx index e6221ea..a889fe7 100644 --- a/src/components/nostr/kinds/BaseEventRenderer.tsx +++ b/src/components/nostr/kinds/BaseEventRenderer.tsx @@ -30,10 +30,7 @@ export interface BaseEventProps { export function EventAuthor({ pubkey }: { pubkey: string }) { return (
- +
); } diff --git a/src/types/app.ts b/src/types/app.ts index c572d0f..69ad082 100644 --- a/src/types/app.ts +++ b/src/types/app.ts @@ -11,7 +11,8 @@ export type AppId = | "profile" | "encode" | "decode" - | "relay"; + | "relay" + | "debug"; export interface WindowInstance { id: string; diff --git a/src/types/man.ts b/src/types/man.ts index ab3f1ac..eae477f 100644 --- a/src/types/man.ts +++ b/src/types/man.ts @@ -87,6 +87,18 @@ export const manPages: Record = { category: "System", defaultProps: { cmd: "help" }, }, + // debug: { + // name: "debug", + // section: "1", + // synopsis: "debug", + // description: + // "Display the current application state for debugging purposes. Shows windows, workspaces, active account, and other internal state in a formatted view.", + // examples: ["debug View current application state"], + // seeAlso: ["help"], + // appId: "debug", + // category: "System", + // defaultProps: {}, + // }, man: { name: "man", section: "1",