Files
Perplexica/src/lib/config/clientRegistry.ts
2025-12-08 13:08:52 +05:30

30 lines
824 B
TypeScript

'use client';
const getClientConfig = (key: string, defaultVal?: any) => {
return localStorage.getItem(key) ?? defaultVal ?? undefined;
};
export const getTheme = () => getClientConfig('theme', 'dark');
export const getAutoMediaSearch = () =>
getClientConfig('autoMediaSearch', 'true') === 'true';
export const getSystemInstructions = () =>
getClientConfig('systemInstructions', '');
export const getShowWeatherWidget = () =>
getClientConfig('showWeatherWidget', 'true') === 'true';
export const getShowNewsWidget = () =>
getClientConfig('showNewsWidget', 'true') === 'true';
export const getMeasurementUnit = () => {
const value =
getClientConfig('measureUnit') ??
getClientConfig('measurementUnit', 'metric');
if (typeof value !== 'string') return 'metric';
return value.toLowerCase();
};