wallet integration

main
Christopher Maujean 2 months ago
parent f8296831fc
commit 68a028cd22
  1. 4
      CLAUDE.md
  2. 59
      src/App.tsx

@ -27,8 +27,8 @@ This is a React/TypeScript NAO (Network of Authentic Others) community managemen
- Always completely implement any functionality as requested. - Always completely implement any functionality as requested.
- Do not hallucinate, or pretend - Do not hallucinate, or pretend
- Always use the most up to date official documentation for libraries or techniques - Always use the most up to date official documentation for libraries or techniques
- prefer zustand stores above useState - prefer zustand stores above useState when we have more than 3 useState
- use LDO and nextgraphauth.session for persistent data (contacts for example) consider this to be our "database" - use LDO and nextgraphauth.session for persistent data (contacts for example), consider this to be our "database"
# Code Style # Code Style
- Use react hooks: useMemo, useCallback, and other standard hooks - Use react hooks: useMemo, useCallback, and other standard hooks

@ -21,20 +21,69 @@ import MessagesPage from '@/pages/MessagesPage';
import AccountPage from '@/pages/AccountPage'; import AccountPage from '@/pages/AccountPage';
import NotificationsPage from '@/pages/NotificationsPage'; import NotificationsPage from '@/pages/NotificationsPage';
import { createAppTheme } from '@/theme/theme'; import { createAppTheme } from '@/theme/theme';
import { Container } from '@mui/material'; import { Container, Box, Typography, Button } from '@mui/material';
const theme = createAppTheme('light'); const theme = createAppTheme('light');
const AppContent = () => { const AppContent = () => {
const nextGraphAuth = useNextGraphAuth() as NextGraphAuth; const nextGraphAuth = useNextGraphAuth();
const { session, login, logout } = nextGraphAuth || {};
const hasLogin = Boolean(nextGraphAuth?.login); console.log('NextGraph Auth:', nextGraphAuth);
const hasLogout = Boolean(nextGraphAuth?.logout); console.log('Session:', session);
console.log('Keys:', nextGraphAuth ? Object.keys(nextGraphAuth) : 'no auth');
const hasLogin = Boolean(login);
const hasLogout = Boolean(logout);
const isAuthenticated = Boolean(session?.ng);
const isNextGraphReady = hasLogin && hasLogout; const isNextGraphReady = hasLogin && hasLogout;
console.log('hasLogin:', hasLogin, 'hasLogout:', hasLogout);
console.log('isAuthenticated:', isAuthenticated, 'isNextGraphReady:', isNextGraphReady);
if (!isNextGraphReady) { if (!isNextGraphReady) {
return <div>Loading NextGraph...</div>; return (
<Box
sx={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '100vh'
}}
>
<Typography variant="h6">Loading NextGraph...</Typography>
</Box>
);
}
if (!isAuthenticated) {
return (
<Box
sx={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
height: '100vh',
gap: 2
}}
>
<Typography variant="h4" component="h2" gutterBottom>
Welcome to NAO
</Typography>
<Typography variant="body1" color="text.secondary" sx={{ mb: 2 }}>
Please log in with your NextGraph wallet to continue.
</Typography>
<Button
variant="contained"
size="large"
onClick={() => login?.()}
>
Login with NextGraph
</Button>
</Box>
);
} }
return ( return (

Loading…
Cancel
Save