feat: add server settings for default board, default color scheme and default locale (#1373)
* feat: add server settings for default board, default color scheme and default locale * chore: address pull request feedback * test: adjust unit tests to match requirements * fix: deepsource issue * chore: add deepsource as dependency to translation library * refactor: restructure language-combobox, adjust default locale for next-intl * chore: change cookie keys prefix from homarr- to homarr.
This commit is contained in:
18
apps/nextjs/src/theme/color-scheme.ts
Normal file
18
apps/nextjs/src/theme/color-scheme.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { cache } from "react";
|
||||
import { cookies } from "next/headers";
|
||||
|
||||
import { db } from "@homarr/db";
|
||||
import { getServerSettingByKeyAsync } from "@homarr/db/queries";
|
||||
import type { ColorScheme } from "@homarr/definitions";
|
||||
import { colorSchemeCookieKey } from "@homarr/definitions";
|
||||
|
||||
export const getCurrentColorSchemeAsync = cache(async () => {
|
||||
const cookieValue = cookies().get(colorSchemeCookieKey)?.value;
|
||||
|
||||
if (cookieValue) {
|
||||
return cookieValue as ColorScheme;
|
||||
}
|
||||
|
||||
const appearanceSettings = await getServerSettingByKeyAsync(db, "appearance");
|
||||
return appearanceSettings.defaultColorScheme;
|
||||
});
|
||||
Reference in New Issue
Block a user