diff --git a/package.json b/package.json index dfc40cd..fbded5a 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "check:fix": "biome check --write --unsafe" }, "dependencies": { - "@polinetwork/backend": "^0.15.18", + "@polinetwork/backend": "^0.16.4", "@radix-ui/react-accordion": "^1.2.12", "@radix-ui/react-select": "^2.2.6", "@radix-ui/react-separator": "^1.1.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 278f936..d676f50 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@polinetwork/backend': - specifier: ^0.15.18 - version: 0.15.18 + specifier: ^0.16.4 + version: 0.16.4 '@radix-ui/react-accordion': specifier: ^1.2.12 version: 1.2.12(@types/react-dom@19.2.3(@types/react@19.2.7))(@types/react@19.2.7)(react-dom@19.2.3(react@19.2.3))(react@19.2.3) @@ -447,8 +447,8 @@ packages: cpu: [x64] os: [win32] - '@polinetwork/backend@0.15.18': - resolution: {integrity: sha512-gT4TRMWIFNhwQi2mOx1OiH9HTP9BoorZHSvTti8vTCpk0qgKlL39ntAHQvFtDq1RbJ7rvS+DRd8fRBZkLVtOOw==} + '@polinetwork/backend@0.16.4': + resolution: {integrity: sha512-IspiFAA92uPfYHR2eKj3FCQxX8lVbvlL6lMmEFxEhJbIIaca3Fq1vduRlyDWSo7QC1bpXqzpjjVDUa/jrK+OtA==} '@radix-ui/number@1.1.1': resolution: {integrity: sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g==} @@ -1972,7 +1972,7 @@ snapshots: '@next/swc-win32-x64-msvc@15.5.18': optional: true - '@polinetwork/backend@0.15.18': {} + '@polinetwork/backend@0.16.4': {} '@radix-ui/number@1.1.1': {} diff --git a/src/app/matricole/guida/page.tsx b/src/app/matricole/guida/page.tsx new file mode 100644 index 0000000..65e5d29 --- /dev/null +++ b/src/app/matricole/guida/page.tsx @@ -0,0 +1,46 @@ +import type { Metadata } from "next" +import { FiDownload } from "react-icons/fi" +import { CardSplit } from "@/components/card-split" +import { Button } from "@/components/ui/button" +import { getLatestGuidaMatricola } from "@/queries/guida-matricola" + +export const metadata: Metadata = { + title: "Guida della Matricola", + description: "Controlla l'ultima versione disponibile e scarica il PDF.", +} + +export default async function GuidaMatricolaPage() { + const guida = await getLatestGuidaMatricola() + const formattedDate = guida + ? new Intl.DateTimeFormat("it-IT", { dateStyle: "long" }).format(new Date(guida.date)) + : null + + return ( +
+
+

+ Guida della Matricola +

+

+ Controlla l'ultima versione disponibile e scarica il PDF aggiornato. +

+
+ {guida ? ( + + + + + + } + /> + ) : ( +

Nessuna guida disponibile al momento.

+ )} +
+ ) +} diff --git a/src/components/card-split/index.tsx b/src/components/card-split/index.tsx index a5c3831..7607428 100644 --- a/src/components/card-split/index.tsx +++ b/src/components/card-split/index.tsx @@ -4,7 +4,7 @@ import { CardSplitPrimaryContent } from "./primary-content" import { CardSplitSecondaryContent } from "./secondary-content" import type { CardSplitProps } from "./types" -export function CardSplit({ textPrimary, textSecondary, textSecondarySmall, className }: CardSplitProps) { +export function CardSplit({ textPrimary, textSecondary, textSecondarySmall, action, className }: CardSplitProps) { const hasPrimaryContent = Boolean(textPrimary) const hasSecondaryContent = Boolean(textSecondary || textSecondarySmall) @@ -15,16 +15,20 @@ export function CardSplit({ textPrimary, textSecondary, textSecondarySmall, clas className )} > -
- {textPrimary ? : null} +
+
+ {textPrimary ? : null} - {hasSecondaryContent && ( - - )} + {hasSecondaryContent && ( + + )} +
+ + {action &&
{action}
}
) diff --git a/src/components/card-split/types.ts b/src/components/card-split/types.ts index 1ad4557..d518a8a 100644 --- a/src/components/card-split/types.ts +++ b/src/components/card-split/types.ts @@ -1,6 +1,9 @@ +import type { ReactNode } from "react" + export type CardSplitProps = { textPrimary?: string textSecondary?: string textSecondarySmall?: string + action?: ReactNode className?: string } diff --git a/src/components/header/header.tsx b/src/components/header/header.tsx index f7b942d..d8bed73 100644 --- a/src/components/header/header.tsx +++ b/src/components/header/header.tsx @@ -1,11 +1,20 @@ "use client" +import { usePathname } from "next/navigation" import { DesktopLayout } from "./desktop-layout" import { MobileLayout } from "./mobile-layout" export type { HeaderMenuItem, HeaderSubmenuItem } from "./types" +const HIDDEN_ROUTES = ["/matricole/guida"] + export function Header() { + const pathname = usePathname() + + if (HIDDEN_ROUTES.includes(pathname)) { + return null + } + return ( <>
diff --git a/src/components/matricole/constants.ts b/src/components/matricole/constants.ts index c26dfa4..bd9b966 100644 --- a/src/components/matricole/constants.ts +++ b/src/components/matricole/constants.ts @@ -37,7 +37,7 @@ export const guides = [ title: "Guida della matricola", description: "Dalla prima iscrizione alla vita in campus: il manuale completo per ogni nuovo studente.", icon: FiBook, - href: "/guides", + href: "/matricole/guida", }, { title: "Mappa Microonde", diff --git a/src/queries/guida-matricola.ts b/src/queries/guida-matricola.ts new file mode 100644 index 0000000..3be4959 --- /dev/null +++ b/src/queries/guida-matricola.ts @@ -0,0 +1,10 @@ +"use server" + +import { trpc } from "@/lib/backend" + +export async function getLatestGuidaMatricola() { + const guide = await trpc.web.guides_matricole.getLatestGuide.query() + if (!guide) return null + + return { version: guide.version, date: guide.date, url: guide.file } +}