Skip to content

feat: events page #70

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

Merged
merged 39 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
94a72ca
feat: first draft, calendar, event card, event list
JoaoCoelho2003 Jan 31, 2025
8caec4d
fix: border and text color
JoaoCoelho2003 Jan 31, 2025
c1339fa
fix: calendar arrows
JoaoCoelho2003 Jan 31, 2025
c7c4c85
fix: event indication not working on calendar component
JoaoCoelho2003 Jan 31, 2025
e009ba4
fix: event card opacity
JoaoCoelho2003 Jan 31, 2025
3ef2e05
feat: added internationalization to events page
JoaoCoelho2003 Feb 3, 2025
a5ff9c2
feat: complete internationalization
JoaoCoelho2003 Feb 3, 2025
07b8af9
feat: added events and changed the used icons
JoaoCoelho2003 Feb 3, 2025
fc3f182
refactor: link icon
JoaoCoelho2003 Feb 6, 2025
bc54e21
feat: not required place field in event card
JoaoCoelho2003 Feb 6, 2025
cfb28ca
feat: events coming from calendarium and some finishing touches
JoaoCoelho2003 Feb 18, 2025
00795ef
feat: ordering events from most recent to oldest
JoaoCoelho2003 Feb 18, 2025
edf6856
feat: added spinner while events are being loaded
JoaoCoelho2003 Feb 24, 2025
ae7ba04
feat: ability to select a date and the list only shows events that ha…
JoaoCoelho2003 Feb 24, 2025
ac66fc2
fix: width of the event links not overflowing the event card component
JoaoCoelho2003 Feb 24, 2025
4d4139c
fix: format
JoaoCoelho2003 Feb 24, 2025
69acc77
feat: added skeletons while events are being loaded
JoaoCoelho2003 Feb 24, 2025
4a0edb1
fix: title for past/upcoming events being shown even though there are…
JoaoCoelho2003 Feb 24, 2025
ba78dc3
refactor: show more now only shows 5 more events (the more you press …
JoaoCoelho2003 Feb 24, 2025
e74a15f
refactor: the small indicator of an event in a certain day is not hid…
JoaoCoelho2003 Feb 24, 2025
48c6b97
fix: selected event indicator color
JoaoCoelho2003 Feb 24, 2025
4208b9f
Merge branch 'main' into jc/eventsPage
diogogmatos Mar 8, 2025
1784387
chore: styling tweaks
diogogmatos Mar 8, 2025
7227bda
fix: warning text from dictionary and promo card appearing below the …
JoaoCoelho2003 Mar 11, 2025
ae2467a
fix: fonts and typography
JoaoCoelho2003 Mar 11, 2025
7ea2960
fix: piece of text was ruining the internationalization
JoaoCoelho2003 Mar 11, 2025
8da154a
fix: hover effect on calendar and added gap
JoaoCoelho2003 Mar 11, 2025
085cad5
fix: format
JoaoCoelho2003 Mar 11, 2025
a2a4c9d
fix: event card now supports all day events, multiple days events and…
JoaoCoelho2003 Mar 12, 2025
61ef0e8
fix: format and hover card in the calendar
JoaoCoelho2003 Mar 12, 2025
62b06bd
chore: improvements
JoaoCoelho2003 Mar 12, 2025
f7766d2
chore: improve locales
diogogmatos Mar 13, 2025
18ce37f
chore: improvements to events
diogogmatos Mar 13, 2025
700307a
chore: remove unnecessary div
diogogmatos Mar 13, 2025
0478005
Merge branch 'main' into jc/eventsPage
diogogmatos Mar 13, 2025
53d0e71
Merge branch 'main' into jc/eventsPage
diogogmatos Mar 13, 2025
b95e075
fix: links
diogogmatos Mar 13, 2025
1c974b3
chore: update SEO because of locale changes
diogogmatos Mar 13, 2025
3fa0d34
fix: open external pages in new tab
diogogmatos Mar 13, 2025
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
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
"@formatjs/intl-localematcher": "^0.5.7",
"@headlessui/react": "^2.2.0",
"@types/negotiator": "^0.6.3",
"axios": "^1.7.9",
"markdown-to-jsx": "^7.7.4",
"motion": "^11.11.15",
"negotiator": "^1.0.0",
"next": "14.2.16",
"react": "^18",
"react-dom": "^18",
"react-intersection-observer": "^9.13.1",
"react-swipeable": "^7.0.2",
"swiper": "^11.2.1"
},
"devDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions src/app/[lang]/about/become-a-collaborator/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {
getDictionary,
type Locale,
} from "@/internationalization/dictionaries";
import { fullLocale } from "@/lib/locale";
import { type Metadata } from "next";

export function generateMetadata({
params: { lang },
}: {
params: { lang: Locale };
}): Metadata {
const dict = getDictionary(lang);
const dict = getDictionary(fullLocale(lang));

return {
title: dict.seo.become_a_collaborator.title,
Expand Down Expand Up @@ -42,8 +43,8 @@ export function generateMetadata({
alternates: {
canonical: "https://cesium.di.uminho.pt/about/become-a-collaborator",
languages: {
en: "https://cesium.di.uminho.pt/en_US/about/become-a-collaborator",
pt: "https://cesium.di.uminho.pt/pt_PT/about/team",
en: "https://cesium.di.uminho.pt/en/about/become-a-collaborator",
pt: "https://cesium.di.uminho.pt/pt/about/team",
},
},
};
Expand Down
7 changes: 4 additions & 3 deletions src/app/[lang]/about/become-a-member/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {
getDictionary,
type Locale,
} from "@/internationalization/dictionaries";
import { fullLocale } from "@/lib/locale";
import { type Metadata } from "next";

export function generateMetadata({
params: { lang },
}: {
params: { lang: Locale };
}): Metadata {
const dict = getDictionary(lang);
const dict = getDictionary(fullLocale(lang));

return {
title: dict.seo.become_a_member.title,
Expand Down Expand Up @@ -42,8 +43,8 @@ export function generateMetadata({
alternates: {
canonical: "https://cesium.di.uminho.pt/about/become-a-member",
languages: {
en: "https://cesium.di.uminho.pt/en_US/about/become-a-member",
pt: "https://cesium.di.uminho.pt/pt_PT/about/become-a-member",
en: "https://cesium.di.uminho.pt/en/about/become-a-member",
pt: "https://cesium.di.uminho.pt/pt/about/become-a-member",
},
},
};
Expand Down
7 changes: 4 additions & 3 deletions src/app/[lang]/about/departments/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {
getDictionary,
type Locale,
} from "@/internationalization/dictionaries";
import { fullLocale } from "@/lib/locale";
import { type Metadata } from "next";

export function generateMetadata({
params: { lang },
}: {
params: { lang: Locale };
}): Metadata {
const dict = getDictionary(lang);
const dict = getDictionary(fullLocale(lang));

return {
title: dict.seo.departments.title,
Expand Down Expand Up @@ -42,8 +43,8 @@ export function generateMetadata({
alternates: {
canonical: "https://cesium.di.uminho.pt/about/departments",
languages: {
en: "https://cesium.di.uminho.pt/en_US/about/departments",
pt: "https://cesium.di.uminho.pt/pt_PT/about/departments",
en: "https://cesium.di.uminho.pt/en/about/departments",
pt: "https://cesium.di.uminho.pt/pt/about/departments",
},
},
};
Expand Down
7 changes: 4 additions & 3 deletions src/app/[lang]/about/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {
getDictionary,
type Locale,
} from "@/internationalization/dictionaries";
import { fullLocale } from "@/lib/locale";
import { type Metadata } from "next";

export function generateMetadata({
params: { lang },
}: {
params: { lang: Locale };
}): Metadata {
const dict = getDictionary(lang);
const dict = getDictionary(fullLocale(lang));

return {
title: dict.seo.about.title,
Expand Down Expand Up @@ -42,8 +43,8 @@ export function generateMetadata({
alternates: {
canonical: "https://cesium.di.uminho.pt/about",
languages: {
en: "https://cesium.di.uminho.pt/en_US/about",
pt: "https://cesium.di.uminho.pt/pt_PT/about",
en: "https://cesium.di.uminho.pt/en/about",
pt: "https://cesium.di.uminho.pt/pt/about",
},
},
};
Expand Down
7 changes: 4 additions & 3 deletions src/app/[lang]/about/team/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {
getDictionary,
type Locale,
} from "@/internationalization/dictionaries";
import { fullLocale } from "@/lib/locale";
import { type Metadata } from "next";

export function generateMetadata({
params: { lang },
}: {
params: { lang: Locale };
}): Metadata {
const dict = getDictionary(lang);
const dict = getDictionary(fullLocale(lang));

return {
title: dict.seo.team.title,
Expand Down Expand Up @@ -42,8 +43,8 @@ export function generateMetadata({
alternates: {
canonical: "https://cesium.di.uminho.pt/about/team",
languages: {
en: "https://cesium.di.uminho.pt/en_US/about/team",
pt: "https://cesium.di.uminho.pt/pt_PT/about/team",
en: "https://cesium.di.uminho.pt/en/about/team",
pt: "https://cesium.di.uminho.pt/pt/about/team",
},
},
};
Expand Down
7 changes: 4 additions & 3 deletions src/app/[lang]/events/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {
getDictionary,
type Locale,
} from "@/internationalization/dictionaries";
import { fullLocale } from "@/lib/locale";
import { type Metadata } from "next";

export function generateMetadata({
params: { lang },
}: {
params: { lang: Locale };
}): Metadata {
const dict = getDictionary(lang);
const dict = getDictionary(fullLocale(lang));

return {
title: dict.seo.events.title,
Expand Down Expand Up @@ -42,8 +43,8 @@ export function generateMetadata({
alternates: {
canonical: "https://cesium.di.uminho.pt/events",
languages: {
en: "https://cesium.di.uminho.pt/en_US/events",
pt: "https://cesium.di.uminho.pt/pt_PT/events",
en: "https://cesium.di.uminho.pt/en/events",
pt: "https://cesium.di.uminho.pt/pt/events",
},
},
};
Expand Down
118 changes: 115 additions & 3 deletions src/app/[lang]/events/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,115 @@
export default function Events() {
return <main>Events</main>;
}
"use client";

import { Calendar } from "@/components/calendar";
import { EventList } from "@/components/event-list";
import PromotionalCard from "@/components/promotional-card";
import { useDictionary } from "@/contexts/dictionary-provider";
import getEvents from "@/lib/api/getEvents";
import { type Event, CardType } from "@/lib/types";
import { useEffect, useState } from "react";
import { isSameDay } from "@/lib/utils";
import { horizontalPadding, verticalPadding } from "@/lib/styling";
import AppLink from "@/components/link";
import Markdown from "markdown-to-jsx";

export default function EventsPage() {
const dict = useDictionary();
const [events, setEvents] = useState<Event[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [selectedDate, setSelectedDate] = useState<Date | null>(null);

useEffect(() => {
async function fetchEvents() {
try {
setIsLoading(true);
const eventsData = await getEvents();
setEvents(eventsData);
} catch (error) {
console.error("Failed to fetch events:", error);
} finally {
setIsLoading(false);
}
}

void fetchEvents();
}, []);

const handleDateSelect = (date: Date | null) => {
setSelectedDate((prevDate) =>
prevDate && date && isSameDay(prevDate, date) ? null : date,
);
};

const handleClearDate = () => {
setSelectedDate(null);
};

return (
<main
className={`flex flex-col gap-10 lg:gap-14 ${horizontalPadding} ${verticalPadding}`}
>
<div className="flex items-center justify-between">
<h1 className="font-title text-3xl font-medium">{dict.events.title}</h1>
<div className="hidden items-center gap-4 lg:flex">
<AppLink
href="https://calendario.cesium.di.uminho.pt/"
arrow="outward"
title="Calendarium"
/>
<AppLink
href="https://instagram.com/cesiuminho"
arrow="outward"
title="Instagram"
/>
</div>
</div>

<div className="md:flex md:gap-12">
<div className="mb-8 flex w-full flex-col gap-14 md:mb-0 md:w-2/5">
<Calendar
events={events}
onDateSelect={handleDateSelect}
selectedDate={selectedDate}
className="your-calendar-class"
/>
<div className="hidden md:block">
<PromotionalCard mobileOnlyLayout type={CardType.Membership} />
</div>
</div>
<div className="flex flex-1 flex-col gap-6">
<EventList
events={events}
isLoading={isLoading}
selectedDate={selectedDate}
onClearDate={handleClearDate}
/>
<div className="text-sm">
<h2 className="mb-4 font-title text-2xl font-medium">
{dict.events.warningTitle}
</h2>
<div className="text-black/50">
<Markdown
options={{
overrides: {
a: {
props: {
className: "font-bold text-primary hover:underline",
target: "_blank",
rel: "noopener noreferrer",
},
},
},
}}
>
{dict.events.warning}
</Markdown>
</div>
</div>
<div className="md:hidden">
<PromotionalCard type={CardType.Membership} />
</div>
</div>
</div>
</main>
);
}
11 changes: 6 additions & 5 deletions src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import { DictionaryProvider } from "@/contexts/dictionary-provider";
import Navbar from "@/components/navbar";
import Footer from "@/components/footer";
import { fullLocale } from "@/lib/locale";

const inter = Inter({
subsets: ["latin"],
Expand All @@ -25,15 +26,15 @@ export function generateMetadata({
}: {
params: { lang: Locale };
}): Metadata {
const dict = getDictionary(lang);
const dict = getDictionary(fullLocale(lang));

return {
metadataBase: new URL("https://cesium.di.uminho.pt"),
openGraph: {
siteName: dict.seo.title,
type: "website",
locale: "pt_PT",
alternateLocale: "en_US",
locale: "pt",
alternateLocale: "en",
},
robots: {
index: true,
Expand Down Expand Up @@ -82,14 +83,14 @@ export default function RootLayout({
params: { lang },
}: Readonly<{ children: React.ReactNode; params: { lang: Locale } }>) {
return (
<html lang={lang}>
<html lang={fullLocale(lang)}>
<head>
<meta name="apple-mobile-web-app-title" content="CeSIUM" />
</head>
<body
className={`${inter.variable} ${orbitron.variable} overflow-x-hidden bg-white font-sans text-black antialiased`}
>
<DictionaryProvider lang={lang}>
<DictionaryProvider lang={fullLocale(lang)}>
<Navbar />
<div className="h-full">{children}</div>
<Footer />
Expand Down
3 changes: 2 additions & 1 deletion src/app/[lang]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
getDictionary,
type Locale,
} from "@/internationalization/dictionaries";
import { fullLocale } from "@/lib/locale";
import { type Metadata } from "next";
import StoreCard from "@/components/store-card";
import PromotionalCard from "@/components/promotional-card";
Expand All @@ -13,7 +14,7 @@ export function generateMetadata({
}: {
params: { lang: Locale };
}): Metadata {
const dict = getDictionary(lang);
const dict = getDictionary(fullLocale(lang));

return {
title: dict.seo.title,
Expand Down
7 changes: 4 additions & 3 deletions src/app/[lang]/partners/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {
getDictionary,
type Locale,
} from "@/internationalization/dictionaries";
import { fullLocale } from "@/lib/locale";
import { type Metadata } from "next";

export function generateMetadata({
params: { lang },
}: {
params: { lang: Locale };
}): Metadata {
const dict = getDictionary(lang);
const dict = getDictionary(fullLocale(lang));

return {
title: dict.seo.partners.title,
Expand Down Expand Up @@ -42,8 +43,8 @@ export function generateMetadata({
alternates: {
canonical: "https://cesium.di.uminho.pt/partners",
languages: {
en: "https://cesium.di.uminho.pt/en_US/partners",
pt: "https://cesium.di.uminho.pt/pt_PT/partners",
en: "https://cesium.di.uminho.pt/en/partners",
pt: "https://cesium.di.uminho.pt/pt/partners",
},
},
};
Expand Down
Loading