Desktop-only: surfaces the on-disk config file so users can find, copy, or * open the plain-text TOML they sync across machines (issue #203).
()
| 3883 | /** Desktop-only: surfaces the on-disk config file so users can find, copy, or |
| 3884 | * open the plain-text TOML they sync across machines (issue #203). */ |
| 3885 | function ConfigFileSection(): JSX.Element { |
| 3886 | const [configPath, setConfigPath] = useState<string | null>(null) |
| 3887 | useEffect(() => { |
| 3888 | let active = true |
| 3889 | void window.zen.getConfigPath().then((p) => { |
| 3890 | if (active) setConfigPath(p) |
| 3891 | }) |
| 3892 | return () => { |
| 3893 | active = false |
| 3894 | } |
| 3895 | }, []) |
| 3896 | |
| 3897 | const platform = window.zen.platformSync() |
| 3898 | const revealLabel = |
| 3899 | platform === 'darwin' ? 'Finder' : platform === 'win32' ? 'File Explorer' : 'file manager' |
| 3900 | |
| 3901 | return ( |
| 3902 | <Section |
| 3903 | title="Configuration file" |
| 3904 | description="Your preferences — theme, editor, vim, keymaps, and more — are mirrored to a plain-text TOML file. Sync it across machines with git, stow, or chezmoi; edit it by hand and changes apply live." |
| 3905 | settingId="config-file" |
| 3906 | > |
| 3907 | <div className="flex flex-col gap-3 px-5 py-4"> |
| 3908 | <div className="flex flex-wrap items-center gap-2"> |
| 3909 | <Button onClick={() => void window.zen.revealConfigFile()}> |
| 3910 | Reveal in {revealLabel} |
| 3911 | </Button> |
| 3912 | {configPath && ( |
| 3913 | <Button variant="ghost" onClick={() => window.zen.clipboardWriteText(configPath)}> |
| 3914 | Copy path |
| 3915 | </Button> |
| 3916 | )} |
| 3917 | </div> |
| 3918 | {configPath && ( |
| 3919 | <code |
| 3920 | className="block truncate rounded-lg border border-paper-300/70 bg-paper-100/70 px-3 py-2 font-mono text-xs text-ink-600" |
| 3921 | title={configPath} |
| 3922 | > |
| 3923 | {configPath} |
| 3924 | </code> |
| 3925 | )} |
| 3926 | </div> |
| 3927 | </Section> |
| 3928 | ) |
| 3929 | } |
| 3930 | |
| 3931 | const DATE_NOTE_PATTERN_TOKENS = [ |
| 3932 | { token: 'yyyy', output: '2026', meaning: 'year; ISO week-year for weekly notes' }, |
nothing calls this directly
no test coverage detected