Skip to content

Commit 1f3a2e9

Browse files
Add back-to-schedule links to event detail page
Adds a "Back to Schedule" link at the top and bottom of the event detail page, making it easier for users to navigate back to the schedule view. Closes #4595 Co-authored-by: Marco Acierno <marcoacierno@users.noreply.github.com>
1 parent ecaeda3 commit 1f3a2e9

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

  • frontend/src/components/schedule-event-detail

frontend/src/components/schedule-event-detail/index.tsx

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
Button,
3+
Container,
34
Grid,
45
GridColumn,
56
Heading,
@@ -9,7 +10,7 @@ import {
910
StyledText,
1011
Text,
1112
} from "@python-italia/pycon-styleguide";
12-
import { LiveIcon } from "@python-italia/pycon-styleguide/icons";
13+
import { ArrowIcon, LiveIcon } from "@python-italia/pycon-styleguide/icons";
1314
import { SnakeWithPopcorn } from "@python-italia/pycon-styleguide/illustrations";
1415
import { isAfter, isBefore, parseISO } from "date-fns";
1516
import { fromZonedTime } from "date-fns-tz";
@@ -20,6 +21,7 @@ import { compile } from "~/helpers/markdown";
2021
import { useCurrentLanguage } from "~/locale/context";
2122

2223
import { Fragment } from "react";
24+
import { createHref } from "~/components/link";
2325
import { TableItemHeader } from "~/components/table-item-header";
2426
import type { ProposalMaterial, TalkQuery } from "~/types";
2527
import { ParticipantInfoSection } from "../participant-info-section";
@@ -63,6 +65,28 @@ const isEventLive = (startTime: string, endTime: string) => {
6365
return isAfter(now, utcStart) && isBefore(now, utcEnd);
6466
};
6567

68+
const BackToScheduleLink = () => {
69+
const language = useCurrentLanguage();
70+
71+
return (
72+
<Link
73+
href={createHref({
74+
path: "/schedule",
75+
locale: language,
76+
})}
77+
>
78+
<div className="flex items-center gap-2">
79+
<div className="rotate-90">
80+
<ArrowIcon />
81+
</div>
82+
<Text decoration="underline" size={2} weight="strong">
83+
<FormattedMessage id="schedule.backToSchedule" />
84+
</Text>
85+
</div>
86+
</Link>
87+
);
88+
};
89+
6690
export const ScheduleEventDetail = ({
6791
id,
6892
slug,
@@ -102,6 +126,10 @@ export const ScheduleEventDetail = ({
102126

103127
return (
104128
<>
129+
<Container>
130+
<Spacer size="large" />
131+
<BackToScheduleLink />
132+
</Container>
105133
<Section illustration="snakeHead">
106134
<EventTag type={type} />
107135
<Spacer size="2md" />
@@ -224,6 +252,10 @@ export const ScheduleEventDetail = ({
224252
))}
225253
</Section>
226254
)}
255+
<Container>
256+
<BackToScheduleLink />
257+
<Spacer size="large" />
258+
</Container>
227259
</>
228260
);
229261
};

0 commit comments

Comments
 (0)