feat: Refactor vehicle management and update storage unit load handling; remove unused vehicle component and enhance vehicle status types

This commit is contained in:
2025-04-22 17:24:30 +05:30
parent 83ee14e9c7
commit d161b70537
10 changed files with 380 additions and 282 deletions

View File

@@ -25,19 +25,8 @@ const avatarColors: string[] = [
export function getAvatarColor(index: number, name?: string): string {
// Check if the color is already stored in localStorage
const localStorageKey = "userAvatarColors";
// Helper function to check if local storage is available
function isLocalStorageAvailable(): boolean {
try {
const testKey = "__test__";
localStorage.setItem(testKey, "test");
localStorage.removeItem(testKey);
return true;
} catch (e) {
return false;
}
}
// Check if local storage is available
if (isLocalStorageAvailable() && name) {
if (name) {
let userColors = JSON.parse(localStorage.getItem(localStorageKey) || "{}");
// Check if the user already has an assigned color