"use client"; import { Cpu, MemoryStick, MonitorSpeaker, Thermometer } from "@/components/icons/platform-icons"; import { InfoBanner, SectionDivider, } from "@/modules/settings/components/panel/controls"; import { SETTINGS_BADGE_SURFACE, SETTINGS_PANEL_INSET, } from "@/modules/settings/components/panel/surface"; import type { SettingsBackend } from "@/modules/settings/components/panel/types"; import { cn } from "@/lib/utils"; type GeneralSectionProps = { data: SettingsBackend["general"]; preferences: SettingsBackend["generalPreferences"] & { hostname: string; timezone: string; }; capabilities: SettingsBackend["capabilities"]["general"]; languageValue: string; languageOptions: string[]; onHostnameChange: (value: string) => void; onTimezoneChange: (value: string) => void; onLanguageChange: (value: string) => void; }; function InfoRow({ label, value, mono }: { label: string; value: string; mono?: boolean }) { return (
{label} {value}
); } function HardwareRow({ icon, label, value, iconClass, }: { icon: React.ReactNode; label: string; value: string; iconClass?: string; }) { return (
{icon}
{label}
{value}
); } function PreferenceRow({ label, description, disabled, children, }: { label: string; description?: string; disabled?: boolean; children: React.ReactNode; }) { return (
{label}
{description &&
{description}
}
{children}
); } export function GeneralSection({ data, preferences, capabilities, languageValue, languageOptions, onHostnameChange, onTimezoneChange, onLanguageChange, }: GeneralSectionProps) { return (
{data.warning ? ( ) : null} {/* ── System Info ── */}
{/* ── Hardware ── */}
} label="Processor" value={data.cpuSummary} /> } label="Memory" value={data.memorySummary} /> } label="CPU Temperature" value={data.temperatureSummary} /> } label="User" value={`${data.username} (${data.processUptime})`} />
{/* ── Preferences ── */} {preferences.error ? ( ) : null}
onHostnameChange(e.target.value)} disabled={capabilities.hostname.disabled} className="h-8 w-44 rounded-lg border border-glass-border bg-background/55 px-3 text-xs text-foreground placeholder:text-muted-foreground/60 transition-all focus:border-primary/40 focus:outline-none disabled:cursor-not-allowed" />
); }