Skip to content

Commit

Permalink
fix: add events to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Oct 8, 2024
1 parent 96013a6 commit bd82ef0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
29 changes: 25 additions & 4 deletions frontend/src/component/personalDashboard/LatestProjectEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Markdown } from '../common/Markdown/Markdown';
import type { PersonalDashboardProjectDetailsSchema } from '../../openapi';
import { UserAvatar } from '../common/UserAvatar/UserAvatar';
import { Typography, styled } from '@mui/material';
import { formatDateYMDHM } from 'utils/formatDate';
import { useLocationSettings } from 'hooks/useLocationSettings';

const Events = styled('ul')(({ theme }) => ({
padding: 0,
Expand All @@ -16,6 +18,10 @@ const Event = styled('li')(({ theme }) => ({
gap: theme.spacing(2),
alignItems: 'center',
marginBottom: theme.spacing(4),

'*': {
fontWeight: 'normal',
},
}));

const TitleContainer = styled('div')(({ theme }) => ({
Expand All @@ -32,9 +38,16 @@ const ActionBox = styled('article')(({ theme }) => ({
flexDirection: 'column',
}));

const Timestamp = styled('time')(({ theme }) => ({
color: theme.palette.text.secondary,
fontSize: theme.typography.fontSize,
marginBottom: theme.spacing(1),
}));

export const LatestProjectEvents: FC<{
latestEvents: PersonalDashboardProjectDetailsSchema['latestEvents'];
}> = ({ latestEvents }) => {
const { locationSettings } = useLocationSettings();
return (
<ActionBox>
<TitleContainer>
Expand All @@ -55,10 +68,18 @@ export const LatestProjectEvents: FC<{
src={event.createdByImageUrl}
sx={{ mt: 1 }}
/>
<Markdown>
{event.summary ||
'No preview available for this event'}
</Markdown>
<div>
<Timestamp dateTime={event.createdAt}>
{formatDateYMDHM(
event.createdAt,
locationSettings.locale,
)}
</Timestamp>
<Markdown>
{event.summary ||
'No preview available for this event'}
</Markdown>
</div>
</Event>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export type PersonalDashboardProjectDetailsSchemaLatestEventsItem = {
* @nullable
*/
summary: string | null;
createdAt: string;
};

0 comments on commit bd82ef0

Please sign in to comment.