Skip to content

Commit

Permalink
feat(#vil-471): sidebar droite
Browse files Browse the repository at this point in the history
  • Loading branch information
elhoucine committed Jun 20, 2024
1 parent 9cc9b45 commit cce36ae
Show file tree
Hide file tree
Showing 3 changed files with 229 additions and 220 deletions.
39 changes: 21 additions & 18 deletions src/components/Base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ export const Base = ({ children, rightNav, hideLeftNav = false, showSubHeader =
{children}
</Box>
{rightNav && (
<Grid item xs={12} sm={4} lg={3} xl={2}>
<aside
style={{
marginLeft: '20px',
marginBottom: '20px',
}}
>
{rightNav}
</aside>
<Grid
item
xs={12}
md={4}
lg={3}
xl={2}
sx={{
marginTop: '20px',
}}
>
{rightNav}
</Grid>
)}
</Grid>
Expand Down Expand Up @@ -94,15 +96,16 @@ export const Base = ({ children, rightNav, hideLeftNav = false, showSubHeader =
</Grid>

{rightNav && (
<Grid item md={4} lg={3} xl={2}>
<aside
style={{
marginLeft: '20px',
marginBottom: '20px',
}}
>
{rightNav}
</aside>
<Grid
item
md={4}
lg={3}
xl={2}
sx={{
paddingLeft: '20px',
}}
>
{rightNav}
</Grid>
)}
</Grid>
Expand Down
69 changes: 69 additions & 0 deletions src/components/accueil/LastActivities.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React from 'react';

import { Button } from '@mui/material';

import { CommentIcon } from '../activities/ActivityCard/CommentIcon';
import { icons, DESC } from 'src/components/activities/utils';
import { useActivities } from 'src/services/useActivities';
import { primaryColor } from 'src/styles/variables.const';
import { toDate } from 'src/utils';
import { ActivityType } from 'types/activity.type';
import type { User } from 'types/user.type';

interface Props {
title: string;
activityUser: User;
}

export const LastActivities: React.FC<Props> = ({ title, activityUser }) => {
const { activities } = useActivities({
limit: 200,
page: 0,
type: [],
userId: activityUser?.id ?? 0,
});

return (
<div
className="bg-secondary vertical-bottom-margin"
style={{ padding: '1rem', borderRadius: '10px', display: 'flex', justifyContent: 'center', flexDirection: 'column' }}
>
<h3>
<b>{title}</b>
</h3>
{activities.slice(0, 3).map((activity, index) => {
const ActivityIcon = icons[activity.type] || null;
return (
<div key={index}>
{activity.type !== ActivityType.GAME && (
<>
<div style={{ fontSize: 'smaller', paddingBottom: '1rem' }}>
<strong>{DESC[activity.type]},&nbsp;</strong>
le {toDate(activity.createDate as string)}
{ActivityIcon && (
<ActivityIcon
style={{
float: 'right',
fill: primaryColor,
margin: '1.5rem 0.65rem 0 0',
width: '2rem',
height: 'auto',
alignSelf: 'center',
}}
/>
)}
</div>
<div style={{ paddingBottom: '1rem' }}>
<CommentIcon count={activity.commentCount} activityId={activity.id} />
<Button component="a" color="primary" variant="outlined" href={`/activite/${activity.id}`}>
{"Voir l'activité"}
</Button>
</div>
</>
)}
</div>
);
})}
</div>
);
};
Loading

0 comments on commit cce36ae

Please sign in to comment.