Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VS-57-new-home-page-and-other-fixes #67

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions frontend/src/utils/authProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,16 @@ interface AuthProviderProps {
}

export const AuthProvider = ({ children }: AuthProviderProps): React.JSX.Element => {
const [accessToken, setAccessTokenState] = useState<string | null>(() => {
// Initialize from localStorage if available
return localStorage.getItem('fb_access_token');
});
const [userFacebookId, setUserFacebookIdState] = useState<string | null>(() => {
return localStorage.getItem('fb_user_id');
});

const [accessToken, setAccessTokenState] = useState<string | null>(null);
const [userFacebookId, setUserFacebookIdState] = useState<string | null>(null);
const isAuthenticated = !!accessToken;

const setAccessToken = (token: string | null) => {
setAccessTokenState(token);
};

useEffect(() => {
if (accessToken) {
localStorage.setItem('fb_access_token', accessToken);
} else {
localStorage.removeItem('fb_access_token');
}
}, [accessToken]);

const setUserFacebookId = (facebookId: string | null) => {
setUserFacebookIdState(facebookId);
if (facebookId) {
localStorage.setItem('fb_user_id', facebookId);
} else {
localStorage.removeItem('fb_user_id');
}
};

return (
Expand Down
1 change: 1 addition & 0 deletions frontend/src/viewEvent/ViewEventService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class ViewEventService {

public async getViewEventModel(id: string, accessToken: string): Promise<ViewEventModel> {
try {
console.log(accessToken);
const url = `${this.apiUrl}${id}`;
const response = await fetch(url, {
method: 'GET',
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/viewEvent/ViewEventView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ const ViewEventView = () => {
refreshEvent();
}, [id, refreshEvent]);

if (accessToken === null || userFacebookId === null) {
return <div>Loading...</div>;
}

return (
<>
<Grid container marginX={"auto"} marginY={4} maxWidth="1000px" sx={{ borderRadius: '32px', overflow: 'hidden', backgroundColor: '#EEEEFF' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const EventParticipantsPanel = (
</Typography>
</Grid>
{ model.participants.map((participant, index) => (
<Grid size={12} key={/*participant.userFacebookId ||*/ /* Uncomment la linia asta cand edi si adi n o sa mai aiba acelasi facebookId*/ index}>
<Grid size={12} key={index}>
<Typography variant="body1" align="left">
{participant.username}
</Typography>
Expand Down
91 changes: 84 additions & 7 deletions frontend/src/views/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,93 @@
import React from 'react';
import { Container, Typography } from '@mui/material';
import { Container, Typography, Card, CardContent, Box, Button, Grid, Link } from '@mui/material';
import EventIcon from '@mui/icons-material/Event';
import GroupIcon from '@mui/icons-material/Group';
import SecurityIcon from '@mui/icons-material/Security';

const Home = () => {
return (
<>
<Container>
<Typography variant="h3" gutterBottom>
Home Page
</Typography>
<Typography variant="body1">
</Typography>
<Card sx={{ p: 2, mb: 4 }}>
<Box mb={4} textAlign="center">
<Typography variant="h3" gutterBottom sx={{ fontWeight: 'bold' }}>
Welcome to VibeSync!
</Typography>

</Box>
</Card>

<Grid container spacing={4} justifyContent="center">
<Grid item xs={12} sm={6}>
<Card>
<CardContent>
<Box display="flex" alignItems="center" mb={2}>
<EventIcon fontSize="large" color="primary" sx={{ mr: 2 }} />
<Typography variant="h5">Event Management</Typography>
</Box>
<Typography variant="body2">
Create and manage events effortlessly with real-time updates and seamless participant tracking.
</Typography>
</CardContent>
</Card>
</Grid>
<Grid item xs={12} sm={6}>
<Card>
<CardContent>
<Box display="flex" alignItems="center" mb={2}>
<GroupIcon fontSize="large" color="secondary" sx={{ mr: 2 }} />
<Typography variant="h5">Community Connections</Typography>
</Box>
<Typography variant="body2">
Connect with like-minded individuals and explore personalized event recommendations.
</Typography>
</CardContent>
</Card>
</Grid>

<Grid item xs={12} sm={6}>
<Card>
<CardContent>
<Box display="flex" alignItems="center" mb={2}>
<SecurityIcon fontSize="large" color="primary" sx={{ mr: 2 }} />
<Typography variant="h5">Secure Platform</Typography>
</Box>
<Typography variant="body2">
Your data is safe with us. Enjoy a secure and trustworthy environment for all your interactions.
</Typography>
</CardContent>
</Card>
</Grid>
</Grid>

</Container>

{/* Footer Section */}
<Box
component="footer"
py={1}
textAlign="center"
bgcolor="grey.200"
sx={{
width: '100%',
position: 'fixed',
bottom: 0,
left: 0,
zIndex: 1000,
paddingTop: '32px',
paddingBottom: '64px',
}}
>
<Typography variant="h6" gutterBottom>
Contact us: <Link href="mailto:[email protected]">[email protected]</Link>
</Typography>
<Typography variant="body1">
&copy; {new Date().getFullYear()} VibeSync. All rights reserved.
</Typography>
</Box>
</>

);
};

export default Home;
export default Home;