5328b4f73a
- Add clickable gallery links in all email templates - Include application logo in email header and footer (custom or PicPeak default) - Redesign emails with professional styling matching gallery login page - Gray background with white content box - PicPeak green header with centered logo - Clean typography and proper spacing - Responsive design for mobile devices - Styled call-to-action buttons - Footer with branding and copyright - Update email processor to fetch branding settings dynamically - Use proper API URLs for logo images in emails 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import React, { useEffect, useRef } from 'react';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
import { useTheme } from '../contexts/ThemeContext';
|
|
import { api } from '../config/api';
|
|
|
|
interface GlobalThemeProviderProps {
|
|
children: React.ReactNode;
|
|
}
|
|
|
|
export const GlobalThemeProvider: React.FC<GlobalThemeProviderProps> = ({ children }) => {
|
|
const { setTheme } = useTheme();
|
|
const themeAppliedRef = useRef(false);
|
|
|
|
// Fetch public settings including theme config
|
|
const { data: settingsData } = useQuery({
|
|
queryKey: ['global-theme-settings'],
|
|
queryFn: async () => {
|
|
const response = await api.get('/api/public/settings');
|
|
return response.data;
|
|
},
|
|
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
|
|
});
|
|
|
|
// Apply global theme when settings are loaded (but not on gallery pages)
|
|
useEffect(() => {
|
|
// Skip if we're on a gallery page - gallery pages handle their own themes
|
|
const isGalleryPage = window.location.pathname.includes('/gallery/');
|
|
|
|
if (!themeAppliedRef.current && settingsData?.theme_config && !isGalleryPage) {
|
|
themeAppliedRef.current = true;
|
|
setTheme(settingsData.theme_config);
|
|
}
|
|
}, [settingsData, setTheme]);
|
|
|
|
return <>{children}</>;
|
|
}; |