mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2026-01-03 01:56:56 +00:00
30 lines
824 B
TypeScript
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();
|
|
};
|