maybe this works?
All checks were successful
Deploy to Server / deploy (push) Successful in 30s

This commit is contained in:
2026-04-10 21:58:15 -05:00
parent fcab41e72e
commit f94867ca75
2 changed files with 10 additions and 5 deletions

View File

@@ -45,6 +45,7 @@ export default function App() {
isResetPasswordRoute() ? 'reset-password' : 'loading'
);
const [activeTab, setActiveTab] = useState<Tab>('dashboard');
const [sidebarName, setSidebarName] = useState<string | null | undefined>(undefined);
useEffect(() => {
if (view === 'reset-password') return;
@@ -157,7 +158,7 @@ export default function App() {
>
<UserCircle className="w-4 h-4 shrink-0" />
<span className="truncate text-left">
{session.user.name || session.user.email}
{(sidebarName !== undefined ? sidebarName : session.user.name) || session.user.email}
</span>
</button>
<button
@@ -173,7 +174,7 @@ export default function App() {
{activeTab === 'dashboard' && <Dashboard setActiveTab={setActiveTab} />}
{activeTab === 'inventory' && <Inventory />}
{activeTab === 'protocol' && <ProtocolChecker />}
{activeTab === 'profile' && <ProfileSettings />}
{activeTab === 'profile' && <ProfileSettings onNameChange={setSidebarName} />}
</main>
</div>
);

View File

@@ -4,10 +4,14 @@ import { Button } from './ui/button';
import { Card, CardContent, CardHeader, CardTitle } from './ui/card';
import { Input } from './ui/input';
import { Label } from './ui/label';
import { authClient, useSession, signOut, updateUser } from '../lib/auth-client';
import { useSession, signOut, updateUser } from '../lib/auth-client';
import { validatePhoneOrEmail } from '../lib/validators';
export function ProfileSettings() {
interface Props {
onNameChange?: (name: string | null) => void;
}
export function ProfileSettings({ onNameChange }: Props = {}) {
const { data: session } = useSession();
const [userName, setUserName] = useState('');
const [savingName, setSavingName] = useState(false);
@@ -59,7 +63,7 @@ export function ProfileSettings() {
const data = await res.json().catch(() => ({}));
setNameError(data.error || 'Failed to save name.');
} else {
await authClient.getSession({ fetchOptions: { cache: 'no-store' } });
onNameChange?.(trimmed || null);
setNameSaved(true);
setTimeout(() => setNameSaved(false), 3000);
}