PC Connect ships a lightweight settings system composed of three files:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/yoelrrg-code/pcconnect/llms.txt
Use this file to discover all available pages before exploring further.
settings-context.tsx, settings-provider.tsx, and settings-drawer.tsx. Together they expose a React context that persists theme preferences to localStorage and delivers a slide-in drawer for account actions. The settings system wraps the entire application — both authenticated and unauthenticated states — so theme preferences are always available.
SettingsContextType Interface
The context surface is defined by theSettingsContextType interface in settings-context.tsx:
| Field | Type | Description |
|---|---|---|
themeMode | 'light' | 'dark' | The current theme mode, persisted in localStorage under key "themeMode". Defaults to 'light'. |
themeColorPreset | ColorPresetId | The active color preset ID, persisted under "themeColorPreset". Defaults to 'default'. |
onToggleMode | () => void | Toggles themeMode between 'light' and 'dark'. |
onChangeColorPreset | (preset: ColorPresetId) => void | Sets a new active color preset by ID. |
ColorPresetId and Default Preset
ColorPresetId is defined in src/theme/palette.ts as a union type with a single member:
'default' preset is named “Magenta (Corporate)” and provides the following primary palette tokens:
| Token | Value |
|---|---|
primary.main | #B81A80 |
primary.light | #D01A8E |
primary.dark | #80004E |
primary.darker | #4D002E |
primary.lighter | #FEE7F2 |
primary.hover | #FDEEF7 |
primary.contrastText | #FFFFFF |
The useSettings Hook
The useSettings() hook provides access to the settings context anywhere inside SettingsProvider. Calling it outside the provider boundary throws a descriptive error.
Usage Example
SettingsProvider
SettingsProvider is a wrapper component that initializes state from localStorage and provides all context values to its children tree.
SettingsProvider is mounted at the root of App.tsx, above both ThemeProvider and the authenticated/unauthenticated content switch.
SettingsDrawer
SettingsDrawer is a right-anchored MUI Drawer (width: 360px) opened by clicking the account icon button in the dashboard header. It accepts three props:
| Prop | Type | Description |
|---|---|---|
open | boolean | Controls drawer visibility. |
onClose | () => void | Closes the drawer. |
onLogout | () => void | Triggers the logout action, setting isAuthenticated to false in App.tsx. |
- Header row — A title (“Ajustes”) and an
Xclose icon button. - Divider — A full-width MUI
Divider. - Content area — A flexible scrollable region (currently empty, reserved for future settings controls).
- Logout button — A full-width
variant="signIn"button with aLogOuticon that callsonLogoutwhen pressed.
UsersIcon, a custom SVG) triggers onOpenSettings, which sets settingsOpen to true and slides in the drawer from the right.
Theme mode preference and color preset selection are both persisted to
localStorage automatically via useEffect inside SettingsProvider. This means the user’s chosen theme survives page refreshes without any additional configuration.