import React, { useState, useEffect } from 'react' import { useNavigate } from 'react-router-dom' import { useUiStore } from '../../store/ui.store' import TitleBar from '../../components/TitleBar' import Button from '../../components/Button' import Input from '../../components/Input' import Spinner from '../../components/Spinner' import type { AppSettings } from '@shared/types/ipc.types' export const SettingsView: React.FC = () => { const navigate = useNavigate() const { showToast } = useUiStore() const [settings, setSettings] = useState(null) const [loading, setLoading] = useState(false) const [saving, setSaving] = useState(false) useEffect(() => { setLoading(true) window.flowgit.settings .get() .then((data) => { setSettings(data) }) .catch((e: unknown) => { showToast({ type: 'error', title: 'Failed to load settings', message: e instanceof Error ? e.message : String(e), }) }) .finally(() => { setLoading(false) }) }, [showToast]) const handleUpdate = async (key: K, value: AppSettings[K]) => { if (!settings) return setSettings({ ...settings, [key]: value }) try { await window.flowgit.settings.set(key, value) showToast({ type: 'success', title: 'Setting saved' }) } catch (e: unknown) { showToast({ type: 'error', title: 'Error updating setting', message: e instanceof Error ? e.message : String(e), }) } } return (
{/* Header bar */}
/ SETTINGS
{loading && }
{/* Settings Form Body */}
{settings ? (
{/* Git binary configuration */}
Git Binary Path
Leave blank to automatically detect git from your system PATH.
handleUpdate('gitPath', e.target.value.trim() || null)} />
{/* General Preferences */}
Behavior & Safety
{/* Pull Strategy */}
Default Pull Strategy
How FlowGit integrates remote branch updates when pulling.
{(['merge', 'rebase', 'ff-only'] as const).map((strat) => ( ))}
{/* Theme & Aesthetics */}
Appearance
FlowGit uses Axiom Dark Design Language exclusively. Monospaced typography with BerkeleyMono.
● Void Dark (#000000)
) : null}
) } const sectionBoxStyle: React.CSSProperties = { background: '#111111', border: '1px solid #202020', borderRadius: '2px', padding: '20px', } const sectionTitleStyle: React.CSSProperties = { color: '#eeeeee', fontSize: '14px', fontWeight: 700, letterSpacing: '0.02em', } const sectionDescStyle: React.CSSProperties = { color: '#7e7e7e', fontSize: '12px', marginTop: '4px', marginBottom: '12px', lineHeight: 1.5, } const checkboxLabelStyle: React.CSSProperties = { display: 'flex', alignItems: 'center', gap: '10px', fontSize: '13px', color: '#b4b4b4', cursor: 'pointer', } export default SettingsView