-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: partenaires cards in card wrapper * feat: add event pages * fix: update github co * fix: wording * feat: add vignettes * fix: styled component error * fix: retour review
- Loading branch information
Showing
25 changed files
with
819 additions
and
37 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Section from '@/components/Section' | ||
import { getBalEvents } from '@/lib/api-bal-admin' | ||
import banEvents from '@/data/ban-events.json' | ||
import CardWrapper from '@/components/CardWrapper' | ||
import EventCard from '@/components/Events/EventCard' | ||
import { EventType } from '@/types/events.types' | ||
import { getUpcomingAndPassedEvents, mapEvents } from '@/utils/events' | ||
|
||
export default async function EvenementsPage() { | ||
const balEvents = await getBalEvents() | ||
|
||
const { allEvents, tagToColor } = mapEvents([...balEvents, ...(banEvents as EventType[])]) | ||
const { upcomingEvents, pastEvents } = getUpcomingAndPassedEvents(allEvents) | ||
|
||
return ( | ||
<> | ||
<Section title="Prochains évènements"> | ||
<CardWrapper> | ||
{upcomingEvents.map((event, index) => ( | ||
<EventCard | ||
key={index} | ||
event={event} | ||
tagToColor={tagToColor} | ||
/> | ||
))} | ||
</CardWrapper> | ||
</Section> | ||
<Section title="Évènements passés"> | ||
<CardWrapper> | ||
{pastEvents.map((event, index) => ( | ||
<EventCard | ||
key={index} | ||
event={event} | ||
tagToColor={tagToColor} | ||
isPassed | ||
/> | ||
))} | ||
</CardWrapper> | ||
</Section> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import CardWrapper from '@/components/CardWrapper' | ||
import EventCard from '@/components/Events/EventCard' | ||
import Section from '@/components/Section' | ||
import VideoMiniature from '@/components/VideoMiniature' | ||
import { getBalEvents } from '@/lib/api-bal-admin' | ||
import { getUpcomingAndPassedEvents, mapEvents } from '@/utils/events' | ||
|
||
const videoFormations = [ | ||
{ | ||
title: 'Épisode 1 : Introduction', | ||
image: '/img/formations-en-ligne/e1.png', | ||
link: { | ||
href: 'https://peertube.adresse.data.gouv.fr/w/toyKNe4rKyVD7mUovsWLKd', | ||
target: '_blank', | ||
}, | ||
}, | ||
{ | ||
title: 'Épisode 2 : Création', | ||
image: '/img/formations-en-ligne/e2.png', | ||
link: { | ||
href: 'https://peertube.adresse.data.gouv.fr/w/aNEtMh7fJCzsAPoGkwvFSg', | ||
target: '_blank', | ||
}, | ||
}, | ||
{ | ||
title: 'Épisode 3 : Voies', | ||
image: '/img/formations-en-ligne/e3.png', | ||
link: { | ||
href: 'https://peertube.adresse.data.gouv.fr/w/rgksUPigy8KWnmx8WFELDN', | ||
target: '_blank', | ||
}, | ||
}, | ||
{ | ||
title: 'Épisode 4 : Numéros', | ||
image: '/img/formations-en-ligne/e4.png', | ||
link: { | ||
href: 'https://peertube.adresse.data.gouv.fr/w/un73nNp4kQofNkhT38D6YQ', | ||
target: '_blank', | ||
}, | ||
}, | ||
{ | ||
title: 'Épisode 5 : Lieux-dits', | ||
image: '/img/formations-en-ligne/e5.png', | ||
link: { | ||
href: 'https://peertube.adresse.data.gouv.fr/w/ttnYNTcXtcubCHQX8kHdGt', | ||
target: '_blank', | ||
}, | ||
}, | ||
{ | ||
title: 'Épisode 6 : Publication', | ||
image: '/img/formations-en-ligne/e6.png', | ||
link: { | ||
href: 'https://peertube.adresse.data.gouv.fr/w/4uU6AHpTe7coPyhskBSANB', | ||
target: '_blank', | ||
}, | ||
}, | ||
{ | ||
title: 'Épisode 7 : Récupération', | ||
image: '/img/formations-en-ligne/e7.png', | ||
link: { | ||
href: 'https://peertube.adresse.data.gouv.fr/w/fdD1tzvPfktHkkVK8p7h5D', | ||
target: '_blank', | ||
}, | ||
}, | ||
] | ||
|
||
export default async function FormationEnLignePage() { | ||
const balEvents = await getBalEvents() | ||
|
||
const { allEvents, tagToColor } = mapEvents(balEvents, 'formation') | ||
const { upcomingEvents } = getUpcomingAndPassedEvents(allEvents) | ||
|
||
return ( | ||
<> | ||
<Section title="Prochaines formations"> | ||
{upcomingEvents.length > 0 | ||
? ( | ||
<CardWrapper> | ||
{upcomingEvents.map((event, index) => ( | ||
<EventCard | ||
key={index} | ||
event={event} | ||
tagToColor={tagToColor} | ||
/> | ||
))} | ||
</CardWrapper> | ||
) | ||
: <p>Aucune formation prévue pour le moment</p>} | ||
</Section> | ||
<Section title="Vidéos des formations"> | ||
<CardWrapper isSmallCard> | ||
{videoFormations.map((video, index) => ( | ||
<VideoMiniature key={index} {...video} /> | ||
))} | ||
</CardWrapper> | ||
</Section> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use client' | ||
|
||
import styled from 'styled-components' | ||
|
||
export const StyledEventCard = styled.div<{ $isPassed?: boolean }>` | ||
padding: 32px; | ||
border: 1px solid ${({ theme }) => theme.colors.grey.border}; | ||
${({ $isPassed }) => $isPassed && 'opacity: 0.5;'} | ||
.event-details { | ||
color: ${({ theme }) => theme.colors.primary.main}; | ||
font-size: 0.9rem; | ||
font-weight: bold; | ||
margin: 10px 0; | ||
span[class^="fr-icon"] { | ||
margin-right: 5px; | ||
color: ${({ theme }) => theme.colors.grey.main}; | ||
} | ||
} | ||
h3 { | ||
font-size: 1.5rem; | ||
} | ||
.fr-btn { | ||
&::after { | ||
display: none; | ||
} | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { EventType } from '@/types/events.types' | ||
import { StyledEventCard } from './EventCard.styles' | ||
import Badge from '@codegouvfr/react-dsfr/Badge' | ||
import { getFullDate } from '@/utils/date' | ||
|
||
interface EventCardProps { | ||
event: EventType | ||
tagToColor: Record<string, { color: string, background: string }> | ||
isPassed?: boolean | ||
} | ||
|
||
export default function EventCard({ event, isPassed, tagToColor }: EventCardProps) { | ||
const getAdressToString = (adress: EventType['address']) => { | ||
if (!adress) return '' | ||
return `${adress.nom}, ${adress.numero} ${adress.voie}, ${adress.codePostal} ${adress.commune}` | ||
} | ||
|
||
return ( | ||
<StyledEventCard $isPassed={isPassed}> | ||
<div className="badge-wrapper"> | ||
<>{event.tags.map(tag => <Badge style={{ backgroundColor: tagToColor[tag].background, color: tagToColor[tag].color, marginRight: 4 }} key={tag} small>{tag}</Badge>)}</> | ||
</div> | ||
<div className="event-details"> | ||
<span className="fr-icon-calendar-2-fill" aria-hidden="true" /> | ||
<span>{getFullDate(new Date(event.date))}</span> | ||
{' | '} | ||
<span>{event.startHour} - {event.endHour}</span> | ||
{event.isOnlineOnly ? <span> | En ligne</span> : event.address ? <span> | {getAdressToString(event.address)}</span> : null} | ||
</div> | ||
<h3>{event.title}</h3> | ||
<p> | ||
{event.description} | ||
</p> | ||
{!event.isSubscriptionClosed && !isPassed && ( | ||
<a className="fr-btn" href={event.href} target="_blank" rel="noreferrer"> | ||
S'inscrire | ||
</a> | ||
)} | ||
</StyledEventCard> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use client' | ||
|
||
import styled from 'styled-components' | ||
|
||
export const StyledWrapper = styled.a` | ||
margin: 10px; | ||
h3 { | ||
font-size: 0.9rem; | ||
font-weight: bold; | ||
margin: 0; | ||
} | ||
&::after { | ||
display: none; | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import ResponsiveImage from '../ResponsiveImage' | ||
import { StyledWrapper } from './VideoMiniature.styles' | ||
|
||
interface VideoMiniatureProps { | ||
title: string | ||
image: string | ||
link: { | ||
href: string | ||
target: string | ||
} | ||
} | ||
|
||
export default function VideoMiniature({ title, image, link }: VideoMiniatureProps) { | ||
return ( | ||
<StyledWrapper href={link.href} target={link.target}> | ||
<ResponsiveImage src={image} alt={title} /> | ||
<h3>{title}</h3> | ||
</StyledWrapper> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './VideoMiniature' |
Oops, something went wrong.