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
This commit is contained in:
Claude
2026-01-30 11:29:05 +00:00
parent 121fbb7654
commit 604655ef5b
6 changed files with 10 additions and 117 deletions

View File

@@ -1,6 +1,3 @@
import { useGrimoire } from "@/core/state";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import {
Dialog,
DialogContent,
@@ -8,10 +5,7 @@ import {
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";
import { Settings } from "lucide-react";
interface SettingsDialogProps {
open: boolean;
@@ -22,90 +16,19 @@ 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">
<DialogContent className="sm:max-w-[400px]">
<DialogHeader>
<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 className="flex flex-col items-center justify-center py-12 text-center">
<Settings className="h-12 w-12 text-muted-foreground/50 mb-4" />
<p className="text-muted-foreground">Settings coming soon.</p>
</div>
</DialogContent>
</Dialog>

View File

@@ -551,19 +551,6 @@ export const reorderWorkspaces = (
};
};
/**
* Updates the list of event kinds that should be displayed in compact mode.
*/
export const setCompactModeKinds = (
state: GrimoireState,
kinds: number[],
): GrimoireState => {
return {
...state,
compactModeKinds: kinds,
};
};
/**
* Clears the currently active spellbook tracking.
*/

View File

@@ -26,7 +26,6 @@ const initialState: GrimoireState = {
insertionPosition: "second",
autoPreset: undefined,
},
compactModeKinds: [6, 7, 16, 9735],
workspaces: {
default: {
id: "default",
@@ -326,13 +325,6 @@ export const useGrimoire = () => {
[setState],
);
const setCompactModeKinds = useCallback(
(kinds: number[]) => {
setState((prev) => Logic.setCompactModeKinds(prev, kinds));
},
[setState],
);
const loadSpellbook = useCallback(
(spellbook: ParsedSpellbook) => {
setState((prev) => SpellbookManager.loadSpellbook(prev, spellbook));
@@ -409,7 +401,6 @@ export const useGrimoire = () => {
applyPresetLayout,
updateWorkspaceLabel,
reorderWorkspaces,
setCompactModeKinds,
loadSpellbook,
clearActiveSpellbook,
switchToTemporary,

View File

@@ -105,12 +105,13 @@ const migrations: Record<number, MigrationFn> = {
__version: 9,
};
},
// Migration from v9 to v10 - adds compactModeKinds
// Migration from v9 to v10 - version bump (compactModeKinds removed)
9: (state: any) => {
// Remove compactModeKinds if it exists (no longer used)
const { compactModeKinds: _, ...rest } = state;
return {
...state,
...rest,
__version: 10,
compactModeKinds: [6, 7, 16, 9735],
};
},
};
@@ -142,11 +143,6 @@ export function validateState(state: any): state is GrimoireState {
return false;
}
// compactModeKinds must be an array if present
if (state.compactModeKinds && !Array.isArray(state.compactModeKinds)) {
return false;
}
// Windows must be an object
if (typeof state.windows !== "object") {
return false;

View File

@@ -29,8 +29,6 @@ export interface AppearanceSettings {
theme: "light" | "dark" | "system";
/** Show client tags in event UI */
showClientTags: boolean;
/** Event kinds to render in compact mode */
compactModeKinds: number[];
/** Font size multiplier (0.8 = 80%, 1.0 = 100%, 1.2 = 120%) */
fontSizeMultiplier: number;
/** Enable UI animations */
@@ -149,7 +147,6 @@ const DEFAULT_POST_SETTINGS: PostSettings = {
const DEFAULT_APPEARANCE_SETTINGS: AppearanceSettings = {
theme: "dark",
showClientTags: true,
compactModeKinds: [6, 7, 16, 9735], // reactions, reposts, zaps
fontSizeMultiplier: 1.0,
animationsEnabled: true,
accentHue: 280, // Purple

View File

@@ -119,7 +119,6 @@ export interface GrimoireState {
relays?: RelayInfo[];
blossomServers?: string[];
};
compactModeKinds?: number[];
locale?: {
locale: string;
language: string;