mirror of
https://github.com/soconnor0919/beenvoice.git
synced 2025-12-13 01:24:44 -05:00
fix: Ensure color theme syncs correctly by updating useEffect dependencies, refactor email base URL assignment, and add baseline-browser-mapping dependency.
This commit is contained in:
1
bun.lock
1
bun.lock
@@ -69,6 +69,7 @@
|
|||||||
"@types/raf": "^3.4.3",
|
"@types/raf": "^3.4.3",
|
||||||
"@types/react": "^19.2.7",
|
"@types/react": "^19.2.7",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
|
"baseline-browser-mapping": "^2.8.32",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^17.2.3",
|
||||||
"drizzle-kit": "^0.30.6",
|
"drizzle-kit": "^0.30.6",
|
||||||
"eslint": "^9.39.1",
|
"eslint": "^9.39.1",
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
"@types/raf": "^3.4.3",
|
"@types/raf": "^3.4.3",
|
||||||
"@types/react": "^19.2.7",
|
"@types/react": "^19.2.7",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
|
"baseline-browser-mapping": "^2.8.32",
|
||||||
"dotenv": "^17.2.3",
|
"dotenv": "^17.2.3",
|
||||||
"drizzle-kit": "^0.30.6",
|
"drizzle-kit": "^0.30.6",
|
||||||
"eslint": "^9.39.1",
|
"eslint": "^9.39.1",
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
export default {
|
const config = {
|
||||||
plugins: {
|
plugins: {
|
||||||
"@tailwindcss/postcss": {},
|
"@tailwindcss/postcss": {},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
|
/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
|
||||||
export default {
|
const config = {
|
||||||
plugins: ["prettier-plugin-tailwindcss"],
|
plugins: ["prettier-plugin-tailwindcss"],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
|
|||||||
@@ -49,12 +49,7 @@ export function ColorThemeProvider({
|
|||||||
|
|
||||||
const updateThemeMutation = api.settings.updateTheme.useMutation();
|
const updateThemeMutation = api.settings.updateTheme.useMutation();
|
||||||
|
|
||||||
// Sync from DB when available
|
|
||||||
React.useEffect(() => {
|
|
||||||
if (dbTheme) {
|
|
||||||
setColorTheme(dbTheme.colorTheme, dbTheme.customColor);
|
|
||||||
}
|
|
||||||
}, [dbTheme]);
|
|
||||||
|
|
||||||
const setColorTheme = React.useCallback(
|
const setColorTheme = React.useCallback(
|
||||||
(theme: ColorTheme, customColor?: string) => {
|
(theme: ColorTheme, customColor?: string) => {
|
||||||
@@ -131,6 +126,13 @@ export function ColorThemeProvider({
|
|||||||
[modeTheme, defaultColorTheme],
|
[modeTheme, defaultColorTheme],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Sync from DB when available
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (dbTheme) {
|
||||||
|
setColorTheme(dbTheme.colorTheme, dbTheme.customColor);
|
||||||
|
}
|
||||||
|
}, [dbTheme, setColorTheme]);
|
||||||
|
|
||||||
// Effect to trigger DB update when state changes (debounced or direct)
|
// Effect to trigger DB update when state changes (debounced or direct)
|
||||||
// We do this separately to avoid putting mutation in the setColorTheme callback dependencies if possible
|
// We do this separately to avoid putting mutation in the setColorTheme callback dependencies if possible
|
||||||
// But actually, calling it in setColorTheme is better for direct user action.
|
// But actually, calling it in setColorTheme is better for direct user action.
|
||||||
|
|||||||
@@ -108,9 +108,7 @@ export const emailRouter = createTRPCRouter({
|
|||||||
customMessage: input.customMessage,
|
customMessage: input.customMessage,
|
||||||
userName,
|
userName,
|
||||||
userEmail,
|
userEmail,
|
||||||
baseUrl: process.env.NEXT_PUBLIC_APP_URL
|
baseUrl: process.env.NEXT_PUBLIC_APP_URL ?? "http://localhost:3000",
|
||||||
? process.env.NEXT_PUBLIC_APP_URL
|
|
||||||
: "http://localhost:3000",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Determine Resend instance and email configuration to use
|
// Determine Resend instance and email configuration to use
|
||||||
|
|||||||
Reference in New Issue
Block a user