move font size to project settings

This commit is contained in:
TC
2026-06-14 18:48:53 +10:00
parent 8dba10159d
commit caa27ab790
6 changed files with 58 additions and 24 deletions

View File

@@ -111,10 +111,11 @@ export interface ProjectConfig {
authorAddress?: string
authorEmail?: string
authorPhone?: string
fontSize?: number
}
const PROJECT_CONFIG_FIELDS: (keyof ProjectConfig)[] = [
'projectTitle', 'authorName', 'penName', 'authorAddress', 'authorEmail', 'authorPhone'
'projectTitle', 'authorName', 'penName', 'authorAddress', 'authorEmail', 'authorPhone', 'fontSize'
]
export { PROJECT_CONFIG_FIELDS }

View File

@@ -10,7 +10,6 @@ export interface RecentProject {
export interface GlobalConfig {
apiKey?: string
projectPath?: string
fontSize?: number
theme?: 'dark' | 'light'
recentProjects?: RecentProject[]
}

View File

@@ -96,6 +96,38 @@
border-color: var(--accent);
}
.settings-fontsize {
display: flex;
align-items: center;
gap: 6px;
}
.settings-fontsize-btn {
background: var(--btn-bg, rgba(255,255,255,0.08));
border: 1px solid var(--border);
border-radius: 4px;
color: var(--text);
cursor: pointer;
font-size: 12px;
padding: 4px 10px;
}
.settings-fontsize-btn:hover:not(:disabled) {
background: var(--btn-hover-bg, rgba(255,255,255,0.14));
}
.settings-fontsize-btn:disabled {
opacity: 0.35;
cursor: default;
}
.settings-fontsize-value {
font-size: 13px;
min-width: 36px;
text-align: center;
color: var(--text-muted, var(--text));
}
.settings-input--path {
flex: 1;
border-radius: 4px 0 0 4px;

View File

@@ -17,6 +17,7 @@ export function SettingsDialog({ onClose, onProjectChanged, isSetup }: Props): J
const [authorAddress, setAuthorAddress] = useState('')
const [authorEmail, setAuthorEmail] = useState('')
const [authorPhone, setAuthorPhone] = useState('')
const [fontSize, setFontSize] = useState<number>(15)
const [saved, setSaved] = useState(false)
const overlayRef = useRef<HTMLDivElement>(null)
@@ -31,6 +32,7 @@ export function SettingsDialog({ onClose, onProjectChanged, isSetup }: Props): J
setAuthorAddress(cfg.authorAddress ?? '')
setAuthorEmail(cfg.authorEmail ?? '')
setAuthorPhone(cfg.authorPhone ?? '')
setFontSize(cfg.fontSize ?? 15)
})
}, [])
@@ -62,6 +64,7 @@ export function SettingsDialog({ onClose, onProjectChanged, isSetup }: Props): J
authorAddress: authorAddress.trim() || undefined,
authorEmail: authorEmail.trim() || undefined,
authorPhone: authorPhone.trim() || undefined,
fontSize: fontSize,
})
if (projectPath !== originalPath) onProjectChanged?.()
setOriginalPath(projectPath)
@@ -131,6 +134,25 @@ export function SettingsDialog({ onClose, onProjectChanged, isSetup }: Props): J
<p className="settings-hint">Used as the title in PDF exports. Defaults to the project folder name if left blank.</p>
</div>
<div className="settings-field">
<label className="settings-label">Editor Font Size</label>
<div className="settings-fontsize">
<button
className="settings-fontsize-btn"
onClick={() => setFontSize((s) => Math.max(11, s - 1))}
disabled={fontSize <= 11}
type="button"
>A</button>
<span className="settings-fontsize-value">{fontSize}px</span>
<button
className="settings-fontsize-btn"
onClick={() => setFontSize((s) => Math.min(24, s + 1))}
disabled={fontSize >= 24}
type="button"
>A+</button>
</div>
</div>
<div className="settings-field">
<label className="settings-label" htmlFor="settings-author-name">Author Name</label>
<input

View File

@@ -128,8 +128,6 @@ export function AnalysisToolbar(): JSX.Element {
chatHistory,
projectWordCount,
setProjectWordCount,
fontSize,
setFontSize,
setRightPanelTab,
outlineOpen,
toggleOutline,
@@ -535,25 +533,7 @@ export function AnalysisToolbar(): JSX.Element {
>
</button>
<div className="toolbar-fontsize">
<button
className="toolbar-fontsize-btn"
onClick={() => setFontSize(fontSize - 1)}
disabled={fontSize <= 11}
title="Decrease font size"
>
A
</button>
<button
className="toolbar-fontsize-btn"
onClick={() => setFontSize(fontSize + 1)}
disabled={fontSize >= 24}
title="Increase font size"
>
A+
</button>
</div>
{selectionWordCount !== null && (
{selectionWordCount !== null && (
<span className="toolbar-selection-wordcount" title={`${selectionWordCount} words selected`}>
{formatWordCount(selectionWordCount)} sel
</span>

File diff suppressed because one or more lines are too long