Skip to content

Commit

Permalink
feat: openinghours
Browse files Browse the repository at this point in the history
  • Loading branch information
dowl-air committed Jan 4, 2025
1 parent 93d4e28 commit 397259b
Show file tree
Hide file tree
Showing 19 changed files with 762 additions and 775 deletions.
3 changes: 2 additions & 1 deletion app/(with-navbar)/(authenticated)/(admin)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { checkAuth } from "@/actions/checkAuth";
import { signIn } from "@/auth";
import { redirect } from "next/navigation";

export default async function AuthLayout({ children }: { children: React.ReactNode }) {
const user = await checkAuth();
if (!user) return await signIn();
if (user.id !== "iMKZNJV5PE4XQjnKmZut") return <div>Unauthorized</div>;
if (user.id !== "iMKZNJV5PE4XQjnKmZut") return redirect("/");
return <>{children}</>;
}
4 changes: 2 additions & 2 deletions app/(with-navbar)/(with-footer)/[type]/[nameID]/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { loginRedirect } from "@/actions/login.redirect";
import Admission from "@/components/tower/tiles/Admission";
import HistoryText from "@/components/tower/tiles/HistoryText";
import OpeningHours_ from "@/components/tower/tiles/openingHours/OpeningHours";
import OpeningHoursTile from "@/components/tower/tiles/openingHours/OpeningHoursTile";
import ParameterTile from "@/components/tower/tiles/parameters/ParameterTile";

const Loading = () => {
Expand Down Expand Up @@ -47,7 +47,7 @@ const Loading = () => {

<div className="flex flex-col gap-6 items-center justify-center self-center mx-1 sm:mx-3 flex-1 max-w-screen-xl w-full mb-20">
<div className="flex flex-wrap gap-3 w-full items-center justify-center">
<OpeningHours_ tower={null} />
<OpeningHoursTile tower={null} />
<Admission />
<ParameterTile>
<div className="card-body items-center">
Expand Down
2 changes: 1 addition & 1 deletion app/(with-navbar)/(with-footer)/[type]/[nameID]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Metadata } from "next";
import HistoryText from "@/components/tower/tiles/HistoryText";
import Map from "@/components/tower/tiles/Map";
import Parameters from "@/components/tower/tiles/parameters/Parameters";
import OpeningHours from "@/components/tower/tiles/openingHours/OpeningHours";
import OpeningHours from "@/components/tower/tiles/openingHours/OpeningHoursTile";
import Admission from "@/components/tower/tiles/Admission";
import OpeningHoursDialog from "@/components/tower/tiles/openingHours/OpeningHoursDialog";
import { getTowerObjectByNameID, getTowerRatingAndCount } from "@/actions/towers/towers.action";
Expand Down
38 changes: 36 additions & 2 deletions components/tower/tiles/Admission.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,45 @@
type AccessType = "walk" | "bike" | "car" | "train" | "bus" | "cable-car" | "other" | "unknown";
type TouristColor = "green" | "yellow" | "blue" | "red" | "nocolor" | "cyclePath";
type Difficulty = "easy" | "medium" | "hard" | "unknown";

const simpleAcess = [
{
type: ["bus", "car"],
touristColor: ["green"],
description: "Pěšky po zelené z obce Radošov.",
distance: 1.5,
duration: 30,
difficulty: "easy",
},
{
type: ["car"],
description: "Parkoviště u rozhledny.",
distance: 0.1,
duration: 0,
difficulty: "easy",
},
{
type: ["car", "train"],
touristColor: ["blue"],
description: "Po modré z obce Bystřice.",
distance: 2.5,
duration: 60,
difficulty: "medium",
},
];

function Admission() {
return (
<div
className={`card card-compact sm:card-normal min-w-[300px] max-w-[calc(min(94vw,420px))] sm:h-[225px] flex-1 overflow-hidden shadow-xl group bg-[rgba(255,255,255,0.05)]`}
>
<div className="card-body">
<h2 className="card-title text-base sm:text-lg md:text-xl">Vstupné</h2>
<p className="text-base md:text-lg">Bezplatný vstup.</p>
<h2 className="card-title text-base sm:text-lg md:text-xl">Přístup</h2>
<p className="text-base md:text-lg text-success font-bold">Bezplatný vstup.</p>
{/* <p className="text-base md:text-lg text-nowrap">
Zpoplatněno: <b>60 Kč</b>
</p> */}
<p></p>
</div>
<div className="btn btn-warning btn-sm hidden absolute top-[0.1rem] right-[0.5rem] group-hover:inline-flex">Navrhnout úpravu</div>
</div>
Expand Down
Loading

0 comments on commit 397259b

Please sign in to comment.