Skip to content

Commit

Permalink
feat: Initial event display support for infoscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
IiroP committed Jan 16, 2025
1 parent fb96e90 commit b0a10d7
Show file tree
Hide file tree
Showing 22 changed files with 82 additions and 75 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
// eslint-disable-next-line camelcase -- Roboto_Mono name is set by next/font
import { Inter, Roboto_Mono } from "next/font/google";
import { cn } from "../../lib/utils.ts";
import "../globals.css";
import { InfoScreenHeader } from "../../components/infoscreen/infoscreen-header";
import { cn } from "../../../../lib/utils.ts";
import "../../../globals.css";
import { InfoScreenHeader } from "../../../../components/infoscreen/infoscreen-header/index.tsx";

const inter = Inter({
subsets: ["latin"],
Expand Down
16 changes: 16 additions & 0 deletions apps/web/src/app/[locale]/(infoscreen)/infonaytto/naytto/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { HSLcombinedSchedule } from "../../../../../components/infoscreen/hsl-schedules-combined";
import { KanttiinitCombined } from "../../../../../components/infoscreen/kanttiinit-combined";
import InfoScreenSwitcher from "../../../../../components/infoscreen/infoscreen-switcher/index";
import { EventsDisplay } from "../../../../../components/events-display";

export const dynamic = "force-dynamic";

export default function InfoScreenContents() {
return (
<InfoScreenSwitcher>
<HSLcombinedSchedule />
<KanttiinitCombined />
<EventsDisplay />
</InfoScreenSwitcher>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import type { Metadata } from "next";
import { notFound, redirect } from "next/navigation";
import type { Page as CMSPage } from "@tietokilta/cms-types/payload";
import { Card } from "@tietokilta/ui";
import { AdminBar } from "../../../components/admin-bar";
import { LexicalSerializer } from "../../../components/lexical/lexical-serializer";
import { TableOfContents } from "../../../components/table-of-contents";
import { fetchPage } from "../../../lib/api/pages";
import { getCurrentLocale, type Locale } from "../../../locales/server";
import EventsPage from "../../../custom-pages/events-page";
import AllEventsPage from "../../../custom-pages/all-events-page";
import WeeklyNewsletterPage from "../../../custom-pages/weekly-newsletter-page";
import { generateTocFromRichText } from "../../../lib/utils";
import WeeklyNewslettersListPage from "../../../custom-pages/weekly-newsletters-list-page";
import { openGraphImage } from "../../shared-metadata";
import { AdminBar } from "../../../../components/admin-bar";
import { LexicalSerializer } from "../../../../components/lexical/lexical-serializer";
import { TableOfContents } from "../../../../components/table-of-contents";
import { fetchPage } from "../../../../lib/api/pages";
import { getCurrentLocale, type Locale } from "../../../../locales/server";
import EventsPage from "../../../../custom-pages/events-page";
import AllEventsPage from "../../../../custom-pages/all-events-page";
import WeeklyNewsletterPage from "../../../../custom-pages/weekly-newsletter-page";
import { generateTocFromRichText } from "../../../../lib/utils";
import WeeklyNewslettersListPage from "../../../../custom-pages/weekly-newsletters-list-page";
import { openGraphImage } from "../../../shared-metadata";

interface NextPage<Params extends Record<string, unknown>> {
params: Promise<Params>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
I18nProviderClient,
useCurrentLocale,
useScopedI18n,
} from "../../locales/client";
} from "../../../locales/client";

function Error({
error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
type EventQuestion,
type QuotaSignup,
type QuestionAnswer,
} from "../../../../lib/api/external/ilmomasiina";
import { signUp } from "../../../../lib/api/external/ilmomasiina/actions";
} from "../../../../../lib/api/external/ilmomasiina";
import { signUp } from "../../../../../lib/api/external/ilmomasiina/actions";
import {
cn,
formatDateTimeSeconds,
Expand All @@ -24,12 +24,12 @@ import {
formatDatetimeYearOptions,
getLocalizedEventTitle,
getQuotasWithOpenAndQueue,
} from "../../../../lib/utils";
import { BackButton } from "../../../../components/back-button";
import { getCurrentLocale, getScopedI18n } from "../../../../locales/server";
import { DateTime } from "../../../../components/datetime";
import { openGraphImage } from "../../../shared-metadata";
import { remarkI18n } from "../../../../lib/plugins/remark-i18n";
} from "../../../../../lib/utils";
import { BackButton } from "../../../../../components/back-button";
import { getCurrentLocale, getScopedI18n } from "../../../../../locales/server";
import { DateTime } from "../../../../../components/datetime";
import { openGraphImage } from "../../../../shared-metadata";
import { remarkI18n } from "../../../../../lib/plugins/remark-i18n";
import { SignUpButton } from "./signup-button";

async function SignUpText({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Form from "next/form";
import { Button, type ButtonProps } from "@tietokilta/ui";
import { useFormStatus } from "react-dom";
import type { signUp } from "../../../../lib/api/external/ilmomasiina/actions";
import type { signUp } from "../../../../../lib/api/external/ilmomasiina/actions";

function StatusButton({ disabled, ...props }: ButtonProps) {
const { pending } = useFormStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
I18nProviderClient,
useCurrentLocale,
useScopedI18n,
} from "../../locales/client";
} from "../../../locales/client";

function GlobalError({
error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import type { Metadata, Viewport } from "next";
// eslint-disable-next-line camelcase -- next/font/google
import { Inter, Roboto_Mono } from "next/font/google";
import NextTopLoader from "nextjs-toploader";
import { Footer } from "../../components/footer";
import { MainNav } from "../../components/main-nav";
import { MobileNav } from "../../components/mobile-nav";
import { SkipLink } from "../../components/skip-link";
import { cn } from "../../lib/utils";
import { Footer } from "../../../components/footer";
import { MainNav } from "../../../components/main-nav";
import { MobileNav } from "../../../components/mobile-nav";
import { SkipLink } from "../../../components/skip-link";
import { cn } from "../../../lib/utils";
import "@tietokilta/ui/global.css";
import "../globals.css";
import { type Locale } from "../../locales/server";
import { DigiCommitteeRecruitmentAlert } from "../../components/digi-committee-recruitment-alert";
import "../../globals.css";
import { type Locale } from "../../../locales/server";
import { DigiCommitteeRecruitmentAlert } from "../../../components/digi-committee-recruitment-alert";

const inter = Inter({ subsets: ["latin"], variable: "--font-inter" });
const robotoMono = Roboto_Mono({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use client";
import { Button, Card } from "@tietokilta/ui";
import Link from "next/link";
import { DinoGame } from "../../components/dino-game";
import { DinoGame } from "../../../components/dino-game";
import {
I18nProviderClient,
useCurrentLocale,
useScopedI18n,
} from "../../locales/client";
} from "../../../locales/client";

function Page() {
const t = useScopedI18n("not-found");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { EditorState } from "@tietokilta/cms-types/lexical";
import type { News, Page as CMSPage } from "@tietokilta/cms-types/payload";
import { type Metadata } from "next";
import { EventsDisplay } from "../../components/events-display";
import { Hero, type ImageWithPhotographer } from "../../components/hero";
import { LexicalSerializer } from "../../components/lexical/lexical-serializer";
import { fetchLandingPage } from "../../lib/api/landing-page";
import { AnnouncementCard } from "../../components/announcement-card";
import { getCurrentLocale } from "../../locales/server";
import { openGraphImage } from "../shared-metadata";
import { EventsDisplay } from "../../../components/events-display";
import { Hero, type ImageWithPhotographer } from "../../../components/hero";
import { LexicalSerializer } from "../../../components/lexical/lexical-serializer";
import { fetchLandingPage } from "../../../lib/api/landing-page";
import { AnnouncementCard } from "../../../components/announcement-card";
import { getCurrentLocale } from "../../../locales/server";
import { openGraphImage } from "../../shared-metadata";

function Content({ content }: { content?: EditorState }) {
if (!content) return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
/* eslint-disable no-nested-ternary -- I like */
import { notFound } from "next/navigation";
import { getSignup } from "../../../../../lib/api/external/ilmomasiina";
import { openGraphImage } from "../../../../shared-metadata";
import { getSignup } from "../../../../../../lib/api/external/ilmomasiina";
import { openGraphImage } from "../../../../../shared-metadata";
import {
deleteSignUpAction,
saveSignUpAction,
} from "../../../../../lib/api/external/ilmomasiina/actions";
import { getCurrentLocale, getScopedI18n } from "../../../../../locales/server";
import { getLocalizedEventTitle } from "../../../../../lib/utils";
} from "../../../../../../lib/api/external/ilmomasiina/actions";
import {
getCurrentLocale,
getScopedI18n,
} from "../../../../../../locales/server";
import { getLocalizedEventTitle } from "../../../../../../lib/utils";
import { SignupForm } from "./signup-form";

interface PageProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ import {
ilmomasiinaFieldErrors,
type IlmomasiinaEvent,
type IlmomasiinaSignupInfo,
} from "../../../../../lib/api/external/ilmomasiina";
} from "../../../../../../lib/api/external/ilmomasiina";
import type {
deleteSignUpAction,
saveSignUpAction,
} from "../../../../../lib/api/external/ilmomasiina/actions";
} from "../../../../../../lib/api/external/ilmomasiina/actions";
import {
I18nProviderClient,
useCurrentLocale,
useScopedI18n,
} from "../../../../../locales/client";
import { cn, getLocalizedEventTitle } from "../../../../../lib/utils";
} from "../../../../../../locales/client";
import { cn, getLocalizedEventTitle } from "../../../../../../lib/utils";

type FieldErrorI18n = ReturnType<typeof useScopedI18n>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use client";
import { Button, Card } from "@tietokilta/ui";
import Link from "next/link";
import { DinoGame } from "../../../components/dino-game";
import { DinoGame } from "../../../../components/dino-game";
import {
I18nProviderClient,
useCurrentLocale,
useScopedI18n,
} from "../../../locales/client";
} from "../../../../locales/client";

function Page() {
const t = useScopedI18n("not-found");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use client";
import { Button, Card } from "@tietokilta/ui";
import Link from "next/link";
import { DinoGame } from "../../../components/dino-game";
import { DinoGame } from "../../../../components/dino-game";
import {
I18nProviderClient,
useCurrentLocale,
useScopedI18n,
} from "../../../locales/client";
} from "../../../../locales/client";

function Page() {
const t = useScopedI18n("not-found");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import WeeklyNewsletterPage from "../../../../custom-pages/weekly-newsletter-page";
import WeeklyNewsletterPage from "../../../../../custom-pages/weekly-newsletter-page";

interface PageProps {
params: Promise<{
Expand Down
12 changes: 0 additions & 12 deletions apps/web/src/app/infonaytto/naytto/page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ const client = new ApolloClient({
process.env.DIGITRANSIT_SUBSCRIPTION_KEY ?? "",
},
// TODO: figure out how next cache works, the revalidate doesn't seem to be working
// fetchOptions: {
// cache: "force-cache",
// next: {
// // revalidate: 0,
// },
// },
fetchOptions: {
//cache: "force-cache",
next: {
revalidate: 30,
},
},
}),
defaultOptions: {
query: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ export function middleware(request: NextRequest) {

export const config = {
matcher: [
"/((?!_next|next_api|static|favicon.ico|icon.svg|icon_dark.png|icon_light.png|og-image.png|robots.txt|infonaytto).*)",
"/((?!_next|next_api|static|favicon.ico|icon.svg|icon_dark.png|icon_light.png|og-image.png|robots.txt).*)",
],
};

0 comments on commit b0a10d7

Please sign in to comment.