mirror of
https://github.com/dergigi/boris.git
synced 2026-01-18 22:34:34 +01:00
113 lines
4.0 KiB
TypeScript
113 lines
4.0 KiB
TypeScript
import React from 'react'
|
|
import { faList, faThLarge, faImage } from '@fortawesome/free-solid-svg-icons'
|
|
import { UserSettings } from '../../services/settingsService'
|
|
import IconButton from '../IconButton'
|
|
|
|
interface LayoutBehaviorSettingsProps {
|
|
settings: UserSettings
|
|
onUpdate: (updates: Partial<UserSettings>) => void
|
|
}
|
|
|
|
const LayoutBehaviorSettings: React.FC<LayoutBehaviorSettingsProps> = ({ settings, onUpdate }) => {
|
|
return (
|
|
<div className="settings-section">
|
|
<h3 className="section-title">Layout & Behavior</h3>
|
|
|
|
<div className="setting-group setting-inline">
|
|
<label>Default Bookmark View</label>
|
|
<div className="setting-buttons">
|
|
<IconButton
|
|
icon={faList}
|
|
onClick={() => onUpdate({ defaultViewMode: 'compact' })}
|
|
title="Compact list view"
|
|
ariaLabel="Compact list view"
|
|
variant={(settings.defaultViewMode || 'compact') === 'compact' ? 'primary' : 'ghost'}
|
|
/>
|
|
<IconButton
|
|
icon={faThLarge}
|
|
onClick={() => onUpdate({ defaultViewMode: 'cards' })}
|
|
title="Cards view"
|
|
ariaLabel="Cards view"
|
|
variant={settings.defaultViewMode === 'cards' ? 'primary' : 'ghost'}
|
|
/>
|
|
<IconButton
|
|
icon={faImage}
|
|
onClick={() => onUpdate({ defaultViewMode: 'large' })}
|
|
title="Large preview view"
|
|
ariaLabel="Large preview view"
|
|
variant={settings.defaultViewMode === 'large' ? 'primary' : 'ghost'}
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="setting-group">
|
|
<label htmlFor="collapseOnArticleOpen" className="checkbox-label">
|
|
<input
|
|
id="collapseOnArticleOpen"
|
|
type="checkbox"
|
|
checked={settings.collapseOnArticleOpen !== false}
|
|
onChange={(e) => onUpdate({ collapseOnArticleOpen: e.target.checked })}
|
|
className="setting-checkbox"
|
|
/>
|
|
<span>Collapse bookmark bar when opening an article</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div className="setting-group">
|
|
<label htmlFor="sidebarCollapsed" className="checkbox-label">
|
|
<input
|
|
id="sidebarCollapsed"
|
|
type="checkbox"
|
|
checked={settings.sidebarCollapsed !== false}
|
|
onChange={(e) => onUpdate({ sidebarCollapsed: e.target.checked })}
|
|
className="setting-checkbox"
|
|
/>
|
|
<span>Start with bookmarks sidebar collapsed</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div className="setting-group">
|
|
<label htmlFor="highlightsCollapsed" className="checkbox-label">
|
|
<input
|
|
id="highlightsCollapsed"
|
|
type="checkbox"
|
|
checked={settings.highlightsCollapsed !== false}
|
|
onChange={(e) => onUpdate({ highlightsCollapsed: e.target.checked })}
|
|
className="setting-checkbox"
|
|
/>
|
|
<span>Start with highlights panel collapsed</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div className="setting-group">
|
|
<label htmlFor="rebroadcastToAllRelays" className="checkbox-label">
|
|
<input
|
|
id="rebroadcastToAllRelays"
|
|
type="checkbox"
|
|
checked={settings.rebroadcastToAllRelays ?? false}
|
|
onChange={(e) => onUpdate({ rebroadcastToAllRelays: e.target.checked })}
|
|
className="setting-checkbox"
|
|
/>
|
|
<span>Rebroadcast events while browsing</span>
|
|
</label>
|
|
</div>
|
|
|
|
<div className="setting-group">
|
|
<label htmlFor="autoCollapseSidebarOnMobile" className="checkbox-label">
|
|
<input
|
|
id="autoCollapseSidebarOnMobile"
|
|
type="checkbox"
|
|
checked={settings.autoCollapseSidebarOnMobile !== false}
|
|
onChange={(e) => onUpdate({ autoCollapseSidebarOnMobile: e.target.checked })}
|
|
className="setting-checkbox"
|
|
/>
|
|
<span>Auto-collapse sidebar on small screens</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default LayoutBehaviorSettings
|
|
|