fix: OS Detection of theme removed.
All checks were successful
Deploy to Staging / Build Images (push) Successful in 4m34s
Deploy to Staging / Deploy to Staging (push) Successful in 37s
Deploy to Staging / Verify Staging (push) Successful in 6s
Deploy to Staging / Notify Staging Ready (push) Successful in 5s
Deploy to Staging / Notify Staging Failure (push) Has been skipped
All checks were successful
Deploy to Staging / Build Images (push) Successful in 4m34s
Deploy to Staging / Deploy to Staging (push) Successful in 37s
Deploy to Staging / Verify Staging (push) Successful in 6s
Deploy to Staging / Notify Staging Ready (push) Successful in 5s
Deploy to Staging / Notify Staging Failure (push) Has been skipped
This commit is contained in:
@@ -424,7 +424,7 @@ export const VehicleForm: React.FC<VehicleFormProps> = ({
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 dark:text-avus mb-1">
|
||||
VIN or License Plate <span className="text-red-500">*</span>
|
||||
VIN Number <span className="text-red-500">*</span>
|
||||
</label>
|
||||
<p className="text-xs text-gray-600 dark:text-titanio mb-2">
|
||||
Enter vehicle VIN (optional)
|
||||
|
||||
@@ -322,7 +322,7 @@ export const VehicleDetailPage: React.FC = () => {
|
||||
|
||||
<form className="space-y-4">
|
||||
<DetailField
|
||||
label="VIN or License Plate"
|
||||
label="VIN Number"
|
||||
value={vehicle.vin || vehicle.licensePlate}
|
||||
isRequired
|
||||
/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @ai-summary Theme context for managing light/dark mode across the app
|
||||
* Supports: system preference detection, localStorage persistence, backend sync
|
||||
* Supports: localStorage persistence, backend sync, defaults to light theme
|
||||
* Applies Tailwind dark class to document root
|
||||
*/
|
||||
|
||||
@@ -27,28 +27,6 @@ interface ThemeProviderProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
// Detect system dark mode preference
|
||||
const getSystemPreference = (): boolean => {
|
||||
if (typeof window !== 'undefined' && window.matchMedia) {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// Check if user has explicitly set a preference in localStorage
|
||||
const hasStoredPreference = (): boolean => {
|
||||
try {
|
||||
const stored = localStorage.getItem(SETTINGS_STORAGE_KEY);
|
||||
if (stored) {
|
||||
const settings = JSON.parse(stored);
|
||||
return settings.darkMode !== undefined && settings.darkMode !== null;
|
||||
}
|
||||
} catch {
|
||||
// Ignore parse errors
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// Read dark mode preference from localStorage
|
||||
const getStoredDarkMode = (): boolean | undefined => {
|
||||
try {
|
||||
@@ -65,13 +43,13 @@ const getStoredDarkMode = (): boolean | undefined => {
|
||||
return undefined;
|
||||
};
|
||||
|
||||
// Get initial dark mode: localStorage > system preference
|
||||
// Get initial dark mode: localStorage > default to light
|
||||
const getInitialDarkMode = (): boolean => {
|
||||
const stored = getStoredDarkMode();
|
||||
if (stored !== undefined) {
|
||||
return stored;
|
||||
}
|
||||
return getSystemPreference();
|
||||
return false; // Default to light theme
|
||||
};
|
||||
|
||||
// Update dark mode in localStorage while preserving other settings
|
||||
@@ -97,23 +75,6 @@ export const ThemeProvider = ({ children }: ThemeProviderProps) => {
|
||||
setIsInitialized(true);
|
||||
}, []);
|
||||
|
||||
// Listen for system preference changes (only when no explicit preference set)
|
||||
useEffect(() => {
|
||||
if (typeof window === 'undefined' || !window.matchMedia) return;
|
||||
|
||||
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
|
||||
const handleChange = (e: MediaQueryListEvent) => {
|
||||
// Only react to system changes if user hasn't set explicit preference
|
||||
if (!hasStoredPreference()) {
|
||||
setIsDarkMode(e.matches);
|
||||
}
|
||||
};
|
||||
|
||||
mediaQuery.addEventListener('change', handleChange);
|
||||
return () => mediaQuery.removeEventListener('change', handleChange);
|
||||
}, []);
|
||||
|
||||
// Apply dark class to document root for Tailwind
|
||||
useEffect(() => {
|
||||
const root = document.documentElement;
|
||||
|
||||
Reference in New Issue
Block a user