mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-06-06 02:31:13 +02:00
Remove compact mode settings and simplify settings architecture (#232)
* refactor: remove unused compactModeKinds from app state The compactModeKinds feature was partially implemented but never used: - Settings dialog allowed configuration but the value was never consumed - REQ viewer uses --view flag for compact mode, not this state value Removed: - compactModeKinds from GrimoireState type and initial state - setCompactModeKinds logic function and state hook callback - Compact Events section from SettingsDialog (now shows placeholder) - compactModeKinds from AppearanceSettings in settings service - Migration now strips compactModeKinds if present instead of adding it https://claude.ai/code/session_01DiWUxiS5BAzU9mrKvCUuMW * chore: delete unused SettingsDialog component The SettingsDialog was imported but never used - the Settings menu item opens a window via addWindow("settings", ...) instead. https://claude.ai/code/session_01DiWUxiS5BAzU9mrKvCUuMW * refactor: simplify settings service to only used settings Removed unused settings that were defined but never consumed: - RelaySettings (fallbackRelays, discoveryRelays, outbox*, etc.) - PrivacySettings (shareReadReceipts, blurWalletBalances, etc.) - DatabaseSettings (maxEventsCached, autoCleanupDays, etc.) - NotificationSettings (enabled, notifyOnMention, etc.) - DeveloperSettings (debugMode, showEventIds, logLevel, etc.) - Most of AppearanceSettings (theme, fontSizeMultiplier, etc.) - Most of PostSettings (defaultRelayMode, customPostRelays) Only kept settings that are actually used: - post.includeClientTag - appearance.showClientTags Also simplified useSettings hook to match. https://claude.ai/code/session_01DiWUxiS5BAzU9mrKvCUuMW --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,113 +0,0 @@
|
||||
import { useGrimoire } from "@/core/state";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { X } from "lucide-react";
|
||||
import { KindSelector } from "./KindSelector";
|
||||
import { getKindName } from "@/constants/kinds";
|
||||
|
||||
interface SettingsDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
}
|
||||
|
||||
export default function SettingsDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
}: SettingsDialogProps) {
|
||||
const { state, setCompactModeKinds } = useGrimoire();
|
||||
const compactKinds = state.compactModeKinds || [];
|
||||
|
||||
const removeKind = (kindToRemove: number) => {
|
||||
setCompactModeKinds(compactKinds.filter((k) => k !== kindToRemove));
|
||||
};
|
||||
|
||||
const addKind = (kind: number) => {
|
||||
if (!compactKinds.includes(kind)) {
|
||||
setCompactModeKinds([...compactKinds, kind].sort((a, b) => a - b));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="sm:max-w-[600px] h-[80vh] flex flex-col p-0 gap-0">
|
||||
<DialogHeader className="px-6 py-4 border-b">
|
||||
<DialogTitle>Settings</DialogTitle>
|
||||
<DialogDescription>
|
||||
Manage your workspace preferences.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex-1 overflow-hidden">
|
||||
<Tabs defaultValue="appearance" className="flex flex-col h-full">
|
||||
<div className="px-6 py-2 border-b">
|
||||
<TabsList className="w-full justify-start">
|
||||
<TabsTrigger value="appearance" className="flex-1">
|
||||
Appearance
|
||||
</TabsTrigger>
|
||||
{/* Future tabs can be added here */}
|
||||
</TabsList>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 overflow-y-auto p-6">
|
||||
<TabsContent value="appearance" className="space-y-6 m-0">
|
||||
{/* Section: Compact Events */}
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<h3 className="text-lg font-medium">Compact Events</h3>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Select event kinds to display in a compact format within
|
||||
timelines and feeds.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="max-w-sm">
|
||||
<KindSelector onSelect={addKind} exclude={compactKinds} />
|
||||
</div>
|
||||
|
||||
<div className="border rounded-lg p-4 bg-muted/30">
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{compactKinds.length === 0 && (
|
||||
<span className="text-sm text-muted-foreground italic">
|
||||
No compact kinds configured.
|
||||
</span>
|
||||
)}
|
||||
{compactKinds.map((kind) => (
|
||||
<Badge
|
||||
key={kind}
|
||||
variant="secondary"
|
||||
className="pl-2 pr-1 py-1 flex items-center gap-1 hover:bg-background border transition-colors"
|
||||
>
|
||||
<span className="text-muted-foreground font-mono text-xs">
|
||||
{kind}
|
||||
</span>
|
||||
<span>{getKindName(kind)}</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-4 w-4 ml-1 -mr-0.5 hover:bg-destructive/10 hover:text-destructive rounded-full"
|
||||
onClick={() => removeKind(kind)}
|
||||
>
|
||||
<X className="h-3 w-3" />
|
||||
<span className="sr-only">Remove Kind {kind}</span>
|
||||
</Button>
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</TabsContent>
|
||||
</div>
|
||||
</Tabs>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -38,7 +38,6 @@ import {
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
|
||||
import Nip05 from "./nip05";
|
||||
import { RelayLink } from "./RelayLink";
|
||||
import SettingsDialog from "@/components/SettingsDialog";
|
||||
import LoginDialog from "./LoginDialog";
|
||||
import ConnectWalletDialog from "@/components/ConnectWalletDialog";
|
||||
import { useState } from "react";
|
||||
@@ -87,7 +86,6 @@ export default function UserMenu() {
|
||||
const relays = state.activeAccount?.relays;
|
||||
const blossomServers = state.activeAccount?.blossomServers;
|
||||
const nwcConnection = state.nwcConnection;
|
||||
const [showSettings, setShowSettings] = useState(false);
|
||||
const [showLogin, setShowLogin] = useState(false);
|
||||
const [showConnectWallet, setShowConnectWallet] = useState(false);
|
||||
const [showWalletInfo, setShowWalletInfo] = useState(false);
|
||||
@@ -182,7 +180,6 @@ export default function UserMenu() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<SettingsDialog open={showSettings} onOpenChange={setShowSettings} />
|
||||
<LoginDialog open={showLogin} onOpenChange={setShowLogin} />
|
||||
<ConnectWalletDialog
|
||||
open={showConnectWallet}
|
||||
|
||||
Reference in New Issue
Block a user