feat: amplia opcoes de fontes e normaliza preferencias

This commit is contained in:
Felipe Coutinho
2026-03-06 13:59:12 +00:00
parent 09923ece0a
commit 0e4dbe6a3f
19 changed files with 74 additions and 130 deletions

View File

@@ -1,15 +1,20 @@
import { eq } from "drizzle-orm";
import { cache } from "react";
import { db, schema } from "@/lib/db";
import {
DEFAULT_FONT_KEY,
type FontKey,
normalizeFontKey,
} from "@/public/fonts/font_index";
export type FontPreferences = {
systemFont: string;
moneyFont: string;
systemFont: FontKey;
moneyFont: FontKey;
};
const DEFAULT_FONT_PREFS: FontPreferences = {
systemFont: "ai-sans",
moneyFont: "ai-sans",
systemFont: DEFAULT_FONT_KEY,
moneyFont: DEFAULT_FONT_KEY,
};
export const fetchUserFontPreferences = cache(
@@ -26,8 +31,8 @@ export const fetchUserFontPreferences = cache(
if (!result[0]) return DEFAULT_FONT_PREFS;
return {
systemFont: result[0].systemFont,
moneyFont: result[0].moneyFont,
systemFont: normalizeFontKey(result[0].systemFont),
moneyFont: normalizeFontKey(result[0].moneyFont),
};
},
);