feat: Implement core chat application UI, including chat, voice, members, DMs, and shared components.
Some checks failed
Build and Release / build-and-release (push) Failing after 0s

This commit is contained in:
Bryan1029384756
2026-02-14 01:57:15 -06:00
parent 6f12f98d30
commit 958cf56b23
51 changed files with 4761 additions and 1858 deletions

View File

@@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef } from 'react';
import React, { useState, useEffect } from 'react';
import { Routes, Route, Navigate, useLocation, useNavigate } from 'react-router-dom';
import Login from './pages/Login';
import Register from './pages/Register';
@@ -62,21 +62,18 @@ function AuthGuard({ children }) {
return () => { cancelled = true; };
}, []);
// Redirect once after auth state is determined (not on every route change)
const hasRedirected = useRef(false);
useEffect(() => {
if (authState === 'loading' || hasRedirected.current) return;
hasRedirected.current = true;
if (authState === 'loading') return;
const isAuthPage = location.pathname === '/' || location.pathname === '/register';
const hasSession = sessionStorage.getItem('privateKey') && sessionStorage.getItem('signingKey');
if (authState === 'authenticated' && isAuthPage) {
if (hasSession && isAuthPage) {
navigate('/chat', { replace: true });
} else if (authState === 'unauthenticated' && !isAuthPage) {
} else if (!hasSession && !isAuthPage) {
navigate('/', { replace: true });
}
}, [authState]);
}, [authState, location.pathname]);
if (authState === 'loading') {
return (