Skip to content

Commit

Permalink
Merge pull request #217 from mnw439/add-const-vars-for-school
Browse files Browse the repository at this point in the history
Add constant variables for school short, name and website
  • Loading branch information
rvyk authored Nov 17, 2024
2 parents 1534e30 + 6a47bcb commit 205aa3f
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/actions/getCalendar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use server";

import { SCHOOL_SHORT } from "@/constants/school";
import { REVALIDATE_TIME } from "@/constants/settings";
import { TableHour, TableLesson } from "@majusss/timetable-parser";
import * as ics from "ics";
Expand Down Expand Up @@ -55,7 +56,7 @@ const createEvent = (
.join(" ");

const categories = [
"ZSTiO",
SCHOOL_SHORT,
...(className ? [className] : []),
...(groupName ? [groupName] : []),
];
Expand Down
7 changes: 4 additions & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { Metadata, Viewport } from "next";
import { Poppins } from "next/font/google";
import { ReactNode } from "react";
import "./globals.css";
import { SCHOOL_SHORT, SCHOOL_NAME_ACCUSATIVE } from "@/constants/school";

export const fetchCache = "default-cache";

Expand All @@ -19,11 +20,11 @@ const poppins = Poppins({

export const metadata: Metadata = {
title: {
template: "%s | ZSTiO - Plan lekcji",
default: "ZSTiO - Plan lekcji",
template: `%s | ${SCHOOL_SHORT} - Plan lekcji`,
default: `${SCHOOL_SHORT} - Plan lekcji`,
},
description:
"W prosty sposób sprawdź plan zajęć i zastępstwa dla różnych klas, nauczycieli oraz sal w Zespole Szkół Technicznych i Ogólnokształcących im. Stefana Banacha w Jarosławiu.",
`W prosty sposób sprawdź plan zajęć i zastępstwa dla różnych klas, nauczycieli oraz sal w ${SCHOOL_NAME_ACCUSATIVE}.`,
metadataBase: new URL(process.env.NEXT_PUBLIC_APP_URL as string),

alternates: {
Expand Down
7 changes: 4 additions & 3 deletions src/app/manifest.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { SCHOOL_SHORT, SCHOOL_NAME_ACCUSATIVE } from "@/constants/school";
import { MetadataRoute } from "next";

export default function manifest(): MetadataRoute.Manifest {
return {
name: "Plan lekcji ZSTiO",
short_name: "Plan lekcji ZSTiO",
name: `Plan lekcji ${SCHOOL_SHORT}`,
short_name: `Plan lekcji ${SCHOOL_SHORT}`,
description:
"W prosty sposób sprawdź plan zajęć i zastępstwa dla różnych klas, nauczycieli oraz sal w Zespole Szkół Technicznych i Ogólnokształcących im. Stefana Banacha w Jarosławiu.",
`W prosty sposób sprawdź plan zajęć i zastępstwa dla różnych klas, nauczycieli oraz sal w ${SCHOOL_NAME_ACCUSATIVE}.`,
start_url: "/",
display: "standalone",
orientation: "portrait",
Expand Down
3 changes: 2 additions & 1 deletion src/app/substitutions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { getSubstitutions } from "@/actions/getSubstitutions";
import { BottomBar } from "@/components/common/BottomBar";
import { Substitutions } from "@/components/substitutions/Substitutions";
import { Topbar } from "@/components/topbar/Topbar";
import { SCHOOL_SHORT } from "@/constants/school";
import { redirect } from "next/navigation";

export const generateMetadata = async () => {
const substitutions = await getSubstitutions();

return {
title: substitutions.heading,
description: `Sprawdź zastępstwa w ZSTiO na (${substitutions.timeRange})`,
description: `Sprawdź zastępstwa w ${SCHOOL_SHORT} na (${substitutions.timeRange})`,
};
};

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
7 changes: 4 additions & 3 deletions src/components/timetable/Timetable.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import logo_zstio_high from "@/assets/logo-zstio-high.png";
import school_logo_high from "@/assets/school-logo-high.png";
import { Button } from "@/components/ui/Button";
import { SHORT_HOURS } from "@/constants/settings";
import { translationDict } from "@/constants/translations";
Expand All @@ -18,6 +18,7 @@ import {
TableHourCell,
} from "./Cells";
import { TableLessonCell } from "./LessonCells";
import { SCHOOL_SHORT } from "@/constants/school";

interface TimetableProps {
timetable: OptivumTimetable;
Expand Down Expand Up @@ -197,8 +198,8 @@ const NotFoundTimetable: FC<NotFoundTimetableProps> = ({ id }) => {
return (
<div className="flex h-full flex-col items-center justify-center">
<Image
src={logo_zstio_high}
alt="Logo szkoły ZSTiO"
src={school_logo_high}
alt={`Logo szkoły ${SCHOOL_SHORT}`}
className="aspect-square w-24"
/>
<div className="grid gap-1 text-center">
Expand Down
9 changes: 5 additions & 4 deletions src/components/topbar/Topbar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import logo_zstio from "@/assets/logo-zstio.png";
import school_logo from "@/assets/school-logo.png";
import { FavoriteStar } from "@/components/common/FavoriteStar";
import { ShortLessonSwitcherCell } from "@/components/timetable/Cells";
import { translationDict } from "@/constants/translations";
Expand All @@ -12,6 +12,7 @@ import Link from "next/link";
import { FC, Fragment, useMemo } from "react";
import { useIsClient } from "usehooks-ts";
import { TopbarButtons } from "./Buttons";
import { SCHOOL_WEBSITE, SCHOOL_SHORT } from "@/constants/school";

interface TopbarProps {
timetable?: OptivumTimetable;
Expand Down Expand Up @@ -81,12 +82,12 @@ export const Topbar: FC<TopbarProps> = ({ timetable, substitutions }) => {

const SchoolLink: FC = () => (
<Link
href="https://zstiojar.edu.pl"
href={SCHOOL_WEBSITE}
className="group inline-flex w-fit items-center gap-x-4"
>
<Image
src={logo_zstio}
alt="Logo szkoły ZSTiO"
src={school_logo}
alt={`Logo szkoły ${SCHOOL_SHORT}`}
className="aspect-square w-10"
/>
<div className="inline-flex items-center gap-x-2 text-primary/70 transition-colors group-hover:text-primary/90 max-md:hidden">
Expand Down
3 changes: 3 additions & 0 deletions src/constants/school.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const SCHOOL_SHORT = "ZSTiO";
export const SCHOOL_NAME_ACCUSATIVE = "Zespole Szkół Technicznych i Ogólnokształcących im. Stefana Banacha w Jarosławiu";
export const SCHOOL_WEBSITE = "https://zstiojar.edu.pl";

0 comments on commit 205aa3f

Please sign in to comment.