Spaces:
Sleeping
Sleeping
Download src/data/mockData.ts from Musabek/NOVAESPORT: direct link, hf CLI and curl.
- Browser
- Download file 18.5 kB
-
https://huggingface.co/spaces/Musabek/NOVAESPORT/resolve/main/src/data/mockData.ts
- Command line
-
hf download hf://spaces/Musabek/NOVAESPORT/src/data/mockData.ts
-
curl -L -o mockData.ts https://huggingface.co/spaces/Musabek/NOVAESPORT/resolve/main/src/data/mockData.ts
18.5 kB
| import { Game, Tournament, LiveMatch, StandingsRecord, TournamentBracketNode, ChatMessage, NewsArticle, Team, Achievement, User } from '../types'; | |
| export const INITIAL_GAMES: Game[] = [ | |
| { | |
| id: 'mlbb', | |
| title: 'Mobile Legends: Bang Bang', | |
| genre: 'MOBA', | |
| coverImage: 'https://images.unsplash.com/photo-1542751371-adc38448a05e?q=80&w=600&auto=format&fit=crop', | |
| bannerImage: 'https://images.unsplash.com/photo-1542751371-adc38448a05e?q=80&w=1200&auto=format&fit=crop', | |
| activeTournamentsCount: 3, | |
| totalPlayersCount: '150M+', | |
| platforms: ['Mobile'], | |
| rankings: [ | |
| { rank: 1, teamName: 'Blacklist International', winRate: '82%', points: 2850 }, | |
| { rank: 2, teamName: 'ONIC Esports', winRate: '80%', points: 2790 }, | |
| { rank: 3, teamName: 'AP.Bren', winRate: '78%', points: 2680 }, | |
| { rank: 4, teamName: 'EVOS Legends', winRate: '72%', points: 2420 }, | |
| ] | |
| }, | |
| { | |
| id: 'pubgm', | |
| title: 'PUBG Mobile', | |
| genre: 'Battle Royale', | |
| coverImage: 'https://images.unsplash.com/photo-1538481199705-c710c4e965fc?q=80&w=600&auto=format&fit=crop', | |
| bannerImage: 'https://images.unsplash.com/photo-1538481199705-c710c4e965fc?q=80&w=1200&auto=format&fit=crop', | |
| activeTournamentsCount: 2, | |
| totalPlayersCount: '100M+', | |
| platforms: ['Mobile'], | |
| rankings: [ | |
| { rank: 1, teamName: 'Vampire Esports', winRate: '74%', points: 1980 }, | |
| { rank: 2, teamName: 'Bigetron Red Aliens', winRate: '71%', points: 1850 }, | |
| { rank: 3, teamName: 'Nigma Galaxy', winRate: '68%', points: 1770 }, | |
| { rank: 4, teamName: 'Nova Esports', winRate: '65%', points: 1690 }, | |
| ] | |
| }, | |
| { | |
| id: 'freefire', | |
| title: 'Free Fire', | |
| genre: 'Battle Royale', | |
| coverImage: 'https://images.unsplash.com/photo-1511512578047-dfb367046420?q=80&w=600&auto=format&fit=crop', | |
| bannerImage: 'https://images.unsplash.com/photo-1511512578047-dfb367046420?q=80&w=1200&auto=format&fit=crop', | |
| activeTournamentsCount: 2, | |
| totalPlayersCount: '80M+', | |
| platforms: ['Mobile'], | |
| rankings: [ | |
| { rank: 1, teamName: 'Magic Squad', winRate: '72%', points: 1910 }, | |
| { rank: 2, teamName: 'LOUD', winRate: '70%', points: 1840 }, | |
| { rank: 3, teamName: 'EVOS Divine', winRate: '69%', points: 1800 }, | |
| ] | |
| }, | |
| { | |
| id: 'valorant', | |
| title: 'Valorant', | |
| genre: 'Tactical Shooter', | |
| coverImage: 'https://images.unsplash.com/photo-1542751371-adc38448a05e?q=80&w=600&auto=format&fit=crop', | |
| bannerImage: 'https://images.unsplash.com/photo-1542751371-adc38448a05e?q=80&w=1200&auto=format&fit=crop', | |
| activeTournamentsCount: 4, | |
| totalPlayersCount: '25M+', | |
| platforms: ['PC'], | |
| rankings: [ | |
| { rank: 1, teamName: 'Fnatic', winRate: '85%', points: 3100 }, | |
| { rank: 2, teamName: 'Paper Rex', winRate: '81%', points: 2950 }, | |
| { rank: 3, teamName: 'Evil Geniuses', winRate: '79%', points: 2880 }, | |
| { rank: 4, teamName: 'Sentinels', winRate: '75%', points: 2650 }, | |
| ] | |
| }, | |
| { | |
| id: 'cs2', | |
| title: 'Counter-Strike 2', | |
| genre: 'Tactical Shooter', | |
| coverImage: 'https://images.unsplash.com/photo-1560253023-3ec5d502959f?q=80&w=600&auto=format&fit=crop', | |
| bannerImage: 'https://images.unsplash.com/photo-1560253023-3ec5d502959f?q=80&w=1200&auto=format&fit=crop', | |
| activeTournamentsCount: 3, | |
| totalPlayersCount: '30M+', | |
| platforms: ['PC'], | |
| rankings: [ | |
| { rank: 1, teamName: 'Natus Vincere', winRate: '83%', points: 3050 }, | |
| { rank: 2, teamName: 'FaZe Clan', winRate: '82%', points: 3010 }, | |
| { rank: 3, teamName: 'Team Vitality', winRate: '80%', points: 2950 }, | |
| { rank: 4, teamName: 'G2 Esports', winRate: '76%', points: 2710 }, | |
| ] | |
| }, | |
| { | |
| id: 'dota2', | |
| title: 'Dota 2', | |
| genre: 'MOBA', | |
| coverImage: 'https://images.unsplash.com/photo-1511512578047-dfb367046420?q=80&w=600&auto=format&fit=crop', | |
| bannerImage: 'https://images.unsplash.com/photo-1511512578047-dfb367046420?q=80&w=1200&auto=format&fit=crop', | |
| activeTournamentsCount: 1, | |
| totalPlayersCount: '15M+', | |
| platforms: ['PC'], | |
| rankings: [ | |
| { rank: 1, teamName: 'Team Spirit', winRate: '86%', points: 3200 }, | |
| { rank: 2, teamName: 'Gaimin Gladiators', winRate: '81%', points: 2980 }, | |
| { rank: 3, teamName: 'LGD Gaming', winRate: '77%', points: 2820 }, | |
| ] | |
| }, | |
| { | |
| id: 'lol', | |
| title: 'League of Legends', | |
| genre: 'MOBA', | |
| coverImage: 'https://images.unsplash.com/photo-1553481187-be93c21490a9?q=80&w=600&auto=format&fit=crop', | |
| bannerImage: 'https://images.unsplash.com/photo-1553481187-be93c21490a9?q=80&w=1200&auto=format&fit=crop', | |
| activeTournamentsCount: 3, | |
| totalPlayersCount: '120M+', | |
| platforms: ['PC'], | |
| rankings: [ | |
| { rank: 1, teamName: 'T1', winRate: '88%', points: 3400 }, | |
| { rank: 2, teamName: 'Gen.G Esports', winRate: '84%', points: 3120 }, | |
| { rank: 3, teamName: 'JD Gaming', winRate: '81%', points: 2990 }, | |
| { rank: 4, teamName: 'Weibo Gaming', winRate: '75%', points: 2600 }, | |
| ] | |
| } | |
| ]; | |
| export const INITIAL_TOURNAMENTS: Tournament[] = [ | |
| { | |
| id: 'tourney-1', | |
| title: 'Cyber Championship Series Season 4', | |
| gameId: 'mlbb', | |
| gameTitle: 'Mobile Legends: Bang Bang', | |
| coverImage: 'https://images.unsplash.com/photo-1542751371-adc38448a05e?q=80&w=600&auto=format&fit=crop', | |
| category: 'team', | |
| prizePool: '$25,000', | |
| slotsTotal: 32, | |
| slotsFilled: 29, | |
| startDate: '2026-06-20', | |
| startTime: '18:00', | |
| status: 'upcoming', | |
| entryFee: 'Free', | |
| rules: [ | |
| 'Matches must be played 5v5 on the default draft board map.', | |
| 'Teams must consist of exactly 5 starting players and optional 1 substitute.', | |
| 'Double elimination bracket style will apply.', | |
| 'Standard professional tournament tournament interface and fair-play apply.', | |
| 'Cheating, stream-sniping or exploit usages will lead to instant disqualification.' | |
| ], | |
| requirements: [ | |
| 'Must lead a registered CyberSquad team.', | |
| 'Minimum average account level 30.', | |
| 'Account standing must be in active good behavior (no bans in 60 days).' | |
| ] | |
| }, | |
| { | |
| id: 'tourney-2', | |
| title: 'Neon Rush Solo Arena', | |
| gameId: 'valorant', | |
| gameTitle: 'Valorant', | |
| coverImage: 'https://images.unsplash.com/photo-1538481199705-c710c4e965fc?q=80&w=600&auto=format&fit=crop', | |
| category: 'solo', | |
| prizePool: '$5,000', | |
| slotsTotal: 128, | |
| slotsFilled: 114, | |
| startDate: '2026-06-22', | |
| startTime: '17:00', | |
| status: 'upcoming', | |
| entryFee: '$10', | |
| rules: [ | |
| '1v1 Aim Match format on customized aim-duels cards.', | |
| 'Single elimination speed bracket.', | |
| 'Standard anti-cheat measures will be active and logged.', | |
| 'First player to reach 15 rounds is declared the winner.' | |
| ], | |
| requirements: [ | |
| 'Minimum rank Platinum 1 or above in active competitive act.', | |
| 'Valid Game ID connected to your profile.', | |
| 'Payment of $10 entry fee via esports credits.' | |
| ] | |
| }, | |
| { | |
| id: 'tourney-3', | |
| title: 'Desert Strike Pro League', | |
| gameId: 'pubgm', | |
| gameTitle: 'PUBG Mobile', | |
| coverImage: 'https://images.unsplash.com/photo-1511512578047-dfb367046420?q=80&w=600&auto=format&fit=crop', | |
| category: 'team', | |
| prizePool: '$15,000', | |
| slotsTotal: 24, | |
| slotsFilled: 24, | |
| startDate: '2026-06-18', | |
| startTime: '19:30', | |
| status: 'ongoing', | |
| entryFee: 'Free', | |
| rules: [ | |
| 'Squad (4v4) battle royale format.', | |
| 'Points awarded according to placements and kill counts.', | |
| '6 matches played over 2 active custom schedules.' | |
| ], | |
| requirements: [ | |
| 'Complete Squad registered.', | |
| 'Connected Discord account for coordinator relays.' | |
| ] | |
| }, | |
| { | |
| id: 'tourney-4', | |
| title: 'CS2 Cyber Glory Cup', | |
| gameId: 'cs2', | |
| gameTitle: 'Counter-Strike 2', | |
| coverImage: 'https://images.unsplash.com/photo-1560253023-3ec5d502959f?q=80&w=600&auto=format&fit=crop', | |
| category: 'team', | |
| prizePool: '$30,000', | |
| slotsTotal: 16, | |
| slotsFilled: 16, | |
| startDate: '2026-06-10', | |
| startTime: '16:00', | |
| status: 'completed', | |
| entryFee: '$50', | |
| rules: [ | |
| '5v5 MR12 standard rules.', | |
| 'Active-duty map pools via tactical ban picks.', | |
| 'Admin monitoring on official platforms.' | |
| ], | |
| requirements: [ | |
| 'Team members must be rostered before registration closes.' | |
| ] | |
| }, | |
| { | |
| id: 'tourney-5', | |
| title: 'Legends Showdown Duel', | |
| gameId: 'lol', | |
| gameTitle: 'League of Legends', | |
| coverImage: 'https://images.unsplash.com/photo-1553481187-be93c21490a9?q=80&w=600&auto=format&fit=crop', | |
| category: 'solo', | |
| prizePool: '$3,500', | |
| slotsTotal: 64, | |
| slotsFilled: 55, | |
| startDate: '2026-06-25', | |
| startTime: '15:00', | |
| status: 'upcoming', | |
| entryFee: 'Free', | |
| rules: [ | |
| '1v1 Blind Pick in Middle Lane of Summonerβs Rift.', | |
| 'Win condition: First Blood, 100 Minions, or First Tower standard rules.' | |
| ], | |
| requirements: [ | |
| 'Level 30+ Summoner Account.', | |
| 'Clean play reputation.' | |
| ] | |
| }, | |
| { | |
| id: 'tourney-6', | |
| title: 'Dota 2 Immortal Legacy Tournament', | |
| gameId: 'dota2', | |
| gameTitle: 'Dota 2', | |
| coverImage: 'https://images.unsplash.com/photo-1511512578047-dfb367046420?q=80&w=600&auto=format&fit=crop', | |
| category: 'team', | |
| prizePool: '$40,000', | |
| slotsTotal: 32, | |
| slotsFilled: 32, | |
| startDate: '2026-06-12', | |
| startTime: '14:00', | |
| status: 'ongoing', | |
| entryFee: 'Free', | |
| rules: [ | |
| 'Captainβs Mode draft.', | |
| 'All tournament decisions are final.', | |
| 'Admins supervise live matches via stream lobbies.' | |
| ], | |
| requirements: [ | |
| 'Team members registered with complete Steam links.' | |
| ] | |
| } | |
| ]; | |
| export const INITIAL_LIVE_MATCHES: LiveMatch[] = [ | |
| { | |
| id: 'match-1', | |
| tournamentId: 'tourney-3', | |
| tournamentTitle: 'Desert Strike Pro League', | |
| gameId: 'pubgm', | |
| teamA: { name: 'Vampire Esports', logo: 'π§', score: 0 }, | |
| teamB: { name: 'Nova Esports', logo: 'π', score: 0 }, | |
| status: 'live', | |
| time: 'Round 3 - Miramar', | |
| streamUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ' | |
| }, | |
| { | |
| id: 'match-2', | |
| tournamentId: 'tourney-6', | |
| tournamentTitle: 'Dota 2 Immortal Legacy', | |
| gameId: 'dota2', | |
| teamA: { name: 'Team Spirit', logo: 'π', score: 0 }, | |
| teamB: { name: 'Gaimin Gladiators', logo: 'βοΈ', score: 0 }, | |
| status: 'live', | |
| time: 'Game 2 - Bo3', | |
| streamUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ' | |
| }, | |
| { | |
| id: 'match-3', | |
| tournamentId: 'tourney-1', | |
| tournamentTitle: 'Cyber Championship Series', | |
| gameId: 'mlbb', | |
| teamA: { name: 'Blacklist Int.', logo: 'π' }, | |
| teamB: { name: 'AP.Bren', logo: 'β‘' }, | |
| status: 'upcoming', | |
| time: '2026-06-20 @ 18:00' | |
| } | |
| ]; | |
| export const INITIAL_TEAMS: Team[] = [ | |
| { | |
| id: 'team-blacklist', | |
| name: 'Blacklist International', | |
| logo: 'π', | |
| tag: 'BLCK', | |
| rank: 1, | |
| winRate: 82, | |
| matchesPlayed: 140, | |
| matchesWon: 115, | |
| points: 2850, | |
| gameType: 'mlbb', | |
| members: [ | |
| { id: 'm1', username: 'OHMYV33NUS', role: 'Captain', avatar: 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?q=80&w=200&auto=format&fit=crop', country: 'PH' }, | |
| { id: 'm2', username: 'Wise', role: 'Flex', avatar: 'https://images.unsplash.com/photo-1494790108377-be9c29b29330?q=80&w=200&auto=format&fit=crop', country: 'PH' }, | |
| { id: 'm3', username: 'OHEB', role: 'Sniper', avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?q=80&w=200&auto=format&fit=crop', country: 'PH' }, | |
| { id: 'm4', username: 'Edward', role: 'Flex', avatar: 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?q=80&w=200&auto=format&fit=crop', country: 'PH' }, | |
| ] | |
| }, | |
| { | |
| id: 'team-onic', | |
| name: 'ONIC Esports', | |
| logo: 'β‘', | |
| tag: 'ONIC', | |
| rank: 2, | |
| winRate: 80, | |
| matchesPlayed: 152, | |
| matchesWon: 122, | |
| points: 2790, | |
| gameType: 'mlbb', | |
| members: [ | |
| { id: 'm5', username: 'Kairi', role: 'Flex', avatar: 'https://images.unsplash.com/photo-1628157582853-a796fa650a6a?q=80&w=200&auto=format&fit=crop', country: 'ID' }, | |
| { id: 'm6', username: 'Kiboy', role: 'Support', avatar: 'https://images.unsplash.com/photo-1570295999919-56ceb5ecca61?q=80&w=200&auto=format&fit=crop', country: 'ID' }, | |
| { id: 'm7', username: 'CW', role: 'Sniper', avatar: 'https://images.unsplash.com/photo-1522075469751-3a6694fb2f61?q=80&w=200&auto=format&fit=crop', country: 'ID' }, | |
| { id: 'm8', username: 'Sanz', role: 'Leader', avatar: 'https://images.unsplash.com/photo-1544005313-94ddf0286df2?q=80&w=200&auto=format&fit=crop', country: 'ID' }, | |
| ] | |
| }, | |
| { | |
| id: 'team-fnatic', | |
| name: 'Fnatic', | |
| logo: 'π¦', | |
| tag: 'FNC', | |
| rank: 1, | |
| winRate: 85, | |
| matchesPlayed: 198, | |
| matchesWon: 168, | |
| points: 3100, | |
| gameType: 'valorant', | |
| members: [ | |
| { id: 'm9', username: 'Boaster', role: 'Captain', avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?q=80&w=200&auto=format&fit=crop', country: 'UK' }, | |
| { id: 'm10', username: 'Derke', role: 'Sniper', avatar: 'https://images.unsplash.com/photo-1566492031773-4f4e44671857?q=80&w=200&auto=format&fit=crop', country: 'FI' }, | |
| { id: 'm11', username: 'Leo', role: 'Support', avatar: 'https://images.unsplash.com/photo-1539571696357-5a69c17a67c6?q=80&w=200&auto=format&fit=crop', country: 'SE' }, | |
| { id: 'm12', username: 'Chronicle', role: 'Flex', avatar: 'https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?q=80&w=200&auto=format&fit=crop', country: 'RU' }, | |
| ] | |
| }, | |
| { | |
| id: 'team-t1', | |
| name: 'T1', | |
| logo: 'π΄', | |
| tag: 'T1', | |
| rank: 1, | |
| winRate: 88, | |
| matchesPlayed: 450, | |
| matchesWon: 396, | |
| points: 3400, | |
| gameType: 'lol', | |
| members: [ | |
| { id: 'm13', username: 'Faker', role: 'Captain', avatar: 'https://images.unsplash.com/photo-1517841905240-472988babdf9?q=80&w=200&auto=format&fit=crop', country: 'KR' }, | |
| { id: 'm14', username: 'Zeus', role: 'Flex', avatar: 'https://images.unsplash.com/photo-1489980508314-941910ded1f4?q=80&w=200&auto=format&fit=crop', country: 'KR' }, | |
| { id: 'm15', username: 'Oner', role: 'Flex', avatar: 'https://images.unsplash.com/photo-1492562080023-ab3db95bfbce?q=80&w=200&auto=format&fit=crop', country: 'KR' }, | |
| { id: 'm16', username: 'Gumayusi', role: 'Sniper', avatar: 'https://images.unsplash.com/photo-1501196354995-cbb51c65aaea?q=80&w=200&auto=format&fit=crop', country: 'KR' }, | |
| ] | |
| } | |
| ]; | |
| export const INITIAL_BRACKETS: TournamentBracketNode[] = [ | |
| // Round of 4 | |
| { | |
| id: 'b-1', | |
| round: 1, | |
| roundName: 'Semifinals', | |
| teamA: { id: 'team-blacklist', name: 'Blacklist Int.', logo: 'π', score: 0 }, | |
| teamB: { id: 'team-onic', name: 'ONIC Esports', logo: 'β‘', score: 0 }, | |
| status: 'upcoming', | |
| nextMatchId: 'b-3' | |
| }, | |
| { | |
| id: 'b-2', | |
| round: 1, | |
| roundName: 'Semifinals', | |
| teamA: { id: 'team-fnatic', name: 'Fnatic', logo: 'π¦', score: 0 }, | |
| teamB: { id: 'team-t1', name: 'T1', logo: 'π΄', score: 0 }, | |
| status: 'upcoming', | |
| nextMatchId: 'b-3' | |
| }, | |
| // Grand Finals | |
| { | |
| id: 'b-3', | |
| round: 2, | |
| roundName: 'Grand Finals', | |
| teamA: { id: 'team-blacklist', name: 'Blacklist Int.', logo: 'π', score: 0 }, | |
| teamB: { id: 'team-t1', name: 'T1', logo: 'π΄', score: 0 }, | |
| status: 'upcoming' | |
| } | |
| ]; | |
| export const INITIAL_CHAT_MESSAGES: ChatMessage[] = [ | |
| { id: 'c1', userId: 'usr1', username: 'AlphaViper', userAvatar: 'π©βπ€', message: 'T1 looking incredibly strong this season! Faker is truly immortal.', timestamp: '07:01', role: 'user', channel: 'global' }, | |
| { id: 'c2', userId: 'usr2', username: 'CyberGamerX', userAvatar: 'π€', message: 'Anyone wants to form a squad for MLBB championship next week? Need a good tank.', timestamp: '07:02', role: 'user', channel: 'global' }, | |
| { id: 'c3', userId: 'adm1', username: 'ArenaAdmin', userAvatar: 'π', message: 'Welcome to Nova Esports! Ensure to register before grids lock at 18:00.', timestamp: '07:03', role: 'admin', channel: 'global' }, | |
| { id: 'c4', userId: 'usr3', username: 'ValorantNoob', userAvatar: 'π₯·', message: 'That aim map is crazy, 1v1 rush solo is hyped.', timestamp: '07:04', role: 'user', channel: 'global' }, | |
| { id: 'c5', userId: 'usr4', username: 'SlayerS7', userAvatar: 'π§', message: 'Next tournaments have solid prize pools, sign me up.', timestamp: '07:05', role: 'user', channel: 'global' } | |
| ]; | |
| export const NEWS_ARTICLES: NewsArticle[] = []; | |
| export const ALL_ACHIEVEMENTS: Achievement[] = [ | |
| { id: 'ach-1', title: 'First Blood', description: 'Complete registration in any tournament.', icon: 'π―', unlockedAt: '2026-06-16' }, | |
| { id: 'ach-2', title: 'Cyber Captain', description: 'Create your first Custom cyber team squad.', icon: 'π' }, | |
| { id: 'ach-3', title: 'Golden Gamer', description: 'Win high tier tournament or place top 3.', icon: 'π' }, | |
| { id: 'ach-4', title: 'Broadcaster', description: 'Watch a live match feed for over 10 minutes.', icon: 'πΊ' }, | |
| { id: 'ach-5', title: 'Community Pillar', description: 'Send over 10 messages in live match battle chat.', icon: 'π¬' } | |
| ]; | |
| export const DEFAULT_USER: User = { | |
| id: 'usr-99', | |
| username: 'CyberGhost', | |
| email: 'musabekqurbonov7@gmail.com', // Pre-populated from user metadata | |
| avatar: 'π€', | |
| role: 'admin', // Make them admin so they can explore both User and Admin capacities easily! | |
| gameID: '68291040', | |
| gameName: 'GhostGaming#888', | |
| teamId: '', | |
| points: 450, | |
| joinedAt: '2026-06-16', | |
| achievements: [ALL_ACHIEVEMENTS[0]], | |
| registeredTournaments: ['tourney-3'], | |
| notifications: [ | |
| { | |
| id: 'notif-1', | |
| title: 'Welcome to Nova Esports!', | |
| message: 'Explore tourneys, register your squads or browse professional league ranks.', | |
| time: '10m ago', | |
| read: false, | |
| type: 'info' | |
| }, | |
| { | |
| id: 'notif-2', | |
| title: 'Registration Confirmed', | |
| message: 'You have been registered for Desert Strike Pro League as Participant.', | |
| time: '1h ago', | |
| read: true, | |
| type: 'success' | |
| } | |
| ] | |
| }; | |
| // State storage helper | |
| export function getSavedState<T>(key: string, initialValue: T): T { | |
| try { | |
| const item = localStorage.getItem(key); | |
| return item ? JSON.parse(item) : initialValue; | |
| } catch (err) { | |
| return initialValue; | |
| } | |
| } | |
| export function saveState(key: string, value: any): void { | |
| try { | |
| localStorage.setItem(key, JSON.stringify(value)); | |
| } catch (err) { | |
| console.error('Error saving state to localStorage', err); | |
| } | |
| } | |