Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/areas/settings/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ import { AboutSection } from './components/AboutSection'
import { LogsSection } from './components/LogsSection'
import { IntegrationsSection } from './components/IntegrationsSection'
import { AgentSection } from './components/AgentSection'
import { ApplicationSection } from './components/ApplicationSection'

type Section = 'storage' | 'integrations' | 'agent' | 'logs' | 'about'
type Section = 'application' | 'storage' | 'integrations' | 'agent' | 'logs' | 'about'

const SECTIONS: { id: Section; label: string; icon: JSX.Element }[] = [
{
id: 'application',
label: 'Application',
icon: (
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
<circle cx="12" cy="12" r="3" />
<path d="M19.07 4.93a10 10 0 0 1 0 14.14M4.93 4.93a10 10 0 0 0 0 14.14" />
<path d="M15.54 8.46a5 5 0 0 1 0 7.07M8.46 8.46a5 5 0 0 0 0 7.07" />
</svg>
)
},
{
id: 'storage',
label: 'Storage',
Expand Down Expand Up @@ -68,7 +80,7 @@ const SECTIONS: { id: Section; label: string; icon: JSX.Element }[] = [
// ─── Page shell ───────────────────────────────────────────────────────────────

export default function SettingsPage(): JSX.Element {
const [section, setSection] = useState<Section>('storage')
const [section, setSection] = useState<Section>('application')

return (
<div className="flex h-full">
Expand Down Expand Up @@ -96,6 +108,7 @@ export default function SettingsPage(): JSX.Element {
{/* Content */}
<div className="flex-1 overflow-y-auto bg-surface-400">
<div className="p-8">
{section === 'application' && <ApplicationSection />}
{section === 'storage' && <StorageSection />}
{section === 'integrations' && <IntegrationsSection />}
{section === 'agent' && <AgentSection />}
Expand Down
19 changes: 19 additions & 0 deletions src/areas/settings/components/ApplicationSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useAppStore } from '@shared/stores/appStore'
import { Section, Card, Row, Toggle } from '@shared/ui'

export function ApplicationSection(): JSX.Element {
const { showRamIndicator, setShowRamIndicator } = useAppStore()

return (
<Section title="Application" subtitle="General application settings.">
<Card title="Interface">
<Row
label="RAM indicator"
description="Show live memory usage in the top bar."
>
<Toggle value={showRamIndicator} onChange={setShowRamIndicator} />
</Row>
</Card>
</Section>
)
}
4 changes: 2 additions & 2 deletions src/shared/components/layout/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useAppStore } from '@shared/stores/appStore'
import MemoryIndicator from './MemoryIndicator'

export default function TopBar(): JSX.Element {
const { patchUpdateReady, platform } = useAppStore()
const { patchUpdateReady, platform, showRamIndicator } = useAppStore()
const isMac = platform === 'darwin'

const handleMinimize = () => window.electron.window.minimize()
Expand Down Expand Up @@ -34,7 +34,7 @@ export default function TopBar(): JSX.Element {
<div className="flex-1" />

{/* Memory indicator */}
<MemoryIndicator />
{showRamIndicator && <MemoryIndicator />}

{/* Patch update badge */}
{patchUpdateReady && (
Expand Down
8 changes: 8 additions & 0 deletions src/shared/stores/appStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ interface AppState {
redoMesh: () => void
clearMeshHistory: () => void

// UI preferences
showRamIndicator: boolean
setShowRamIndicator: (v: boolean) => void

// Actions
initApp: () => Promise<void>
setCurrentJob: (job: GenerationJob | null) => void
Expand Down Expand Up @@ -198,6 +202,9 @@ export const useAppStore = create<AppState>()(

clearMeshHistory: () => set({ meshHistory: [], historyIndex: -1 }),

showRamIndicator: true,
setShowRamIndicator: (v) => set({ showRamIndicator: v }),

currentJob: null,
selectedImagePath: null,
setSelectedImagePath: (path) => set({ selectedImagePath: path }),
Expand Down Expand Up @@ -246,6 +253,7 @@ export const useAppStore = create<AppState>()(
name: 'modly-store',
partialize: (state) => ({
generationOptions: state.generationOptions,
showRamIndicator: state.showRamIndicator,
}),
}
)
Expand Down