Simplifica tipografia para fonte America

This commit is contained in:
Felipe Coutinho
2026-03-13 18:21:01 +00:00
parent 20c14aa96f
commit fa9bf17663
21 changed files with 34 additions and 469 deletions

View File

@@ -19,7 +19,6 @@ function MoneyValues({ amount, className, showPositiveSign = false }: Props) {
return (
<span
style={{ fontFamily: "var(--font-money)" }}
className={cn(
"inline-flex items-baseline transition-all duration-200 tracking-tighter",
privacyMode &&

View File

@@ -1,66 +0,0 @@
"use client";
import { createContext, useContext, useEffect, useMemo, useState } from "react";
import { getFontVariable } from "@/public/fonts/font_index";
type FontContextValue = {
systemFont: string;
moneyFont: string;
setSystemFont: (key: string) => void;
setMoneyFont: (key: string) => void;
};
const FontContext = createContext<FontContextValue | null>(null);
export function FontProvider({
systemFont: initialSystemFont,
moneyFont: initialMoneyFont,
children,
}: {
systemFont: string;
moneyFont: string;
children: React.ReactNode;
}) {
const [systemFont, setSystemFontState] = useState(initialSystemFont);
const [moneyFont, setMoneyFontState] = useState(initialMoneyFont);
useEffect(() => {
document.documentElement.style.setProperty(
"--font-app",
getFontVariable(systemFont),
);
document.documentElement.style.setProperty(
"--font-money",
getFontVariable(moneyFont),
);
}, [systemFont, moneyFont]);
const value = useMemo(
() => ({
systemFont,
moneyFont,
setSystemFont: setSystemFontState,
setMoneyFont: setMoneyFontState,
}),
[systemFont, moneyFont],
);
return (
<>
<style
dangerouslySetInnerHTML={{
__html: `:root { --font-app: ${getFontVariable(initialSystemFont)}; --font-money: ${getFontVariable(initialMoneyFont)}; }`,
}}
/>
<FontContext value={value}>{children}</FontContext>
</>
);
}
export function useFont() {
const ctx = useContext(FontContext);
if (!ctx) {
throw new Error("useFont must be used within FontProvider");
}
return ctx;
}

View File

@@ -1,3 +1,2 @@
export { FontProvider } from "./font-provider";
export { PrivacyProvider } from "./privacy-provider";
export { ThemeProvider } from "./theme-provider";

View File

@@ -1,38 +0,0 @@
import { eq } from "drizzle-orm";
import { cache } from "react";
import {
DEFAULT_FONT_KEY,
type FontKey,
normalizeFontKey,
} from "@/public/fonts/font_index";
import { db, schema } from "@/shared/lib/db";
export type FontPreferences = {
systemFont: FontKey;
moneyFont: FontKey;
};
const DEFAULT_FONT_PREFS: FontPreferences = {
systemFont: DEFAULT_FONT_KEY,
moneyFont: DEFAULT_FONT_KEY,
};
export const fetchUserFontPreferences = cache(
async (userId: string): Promise<FontPreferences> => {
const result = await db
.select({
systemFont: schema.preferenciasUsuario.systemFont,
moneyFont: schema.preferenciasUsuario.moneyFont,
})
.from(schema.preferenciasUsuario)
.where(eq(schema.preferenciasUsuario.userId, userId))
.limit(1);
if (!result[0]) return DEFAULT_FONT_PREFS;
return {
systemFont: normalizeFontKey(result[0].systemFont),
moneyFont: normalizeFontKey(result[0].moneyFont),
};
},
);