Skip to content

Commit

Permalink
Merge pull request #166 from ystv/int-199-set-event-title-bars-to-the…
Browse files Browse the repository at this point in the history
…-event-name

[INT-199] Add titles to pages to differentiate tabs
  • Loading branch information
archessmn authored Oct 9, 2024
2 parents 424e4cb + 5b6063f commit d661f20
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 36 deletions.
30 changes: 17 additions & 13 deletions app/(authenticated)/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import { PageInfo } from "@/components/PageInfo";
import { Button, Card, Stack } from "@mantine/core";
import Link from "next/link";

export const dynamic = "force-dynamic";

export default function AdminPage() {
return (
<Card>
<Stack>
<Link href={"/admin/users"}>
<Button variant="default">Users</Button>
</Link>
<Link href={"/admin/positions"}>
<Button variant="default">Crew Positions</Button>
</Link>
<Link href={"/admin/roles"}>
<Button variant="default">Roles</Button>
</Link>
</Stack>
</Card>
<>
<PageInfo title="Admin" />
<Card>
<Stack>
<Link href={"/admin/users"}>
<Button variant="default">Users</Button>
</Link>
<Link href={"/admin/positions"}>
<Button variant="default">Crew Positions</Button>
</Link>
<Link href={"/admin/roles"}>
<Button variant="default">Roles</Button>
</Link>
</Stack>
</Card>
</>
);
}
8 changes: 7 additions & 1 deletion app/(authenticated)/admin/positions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { searchParamsSchema } from "./schema";
import { redirect } from "next/navigation";
import { validateSearchParams } from "@/lib/searchParams/validate";
import { getSearchParamsString } from "@/lib/searchParams/util";
import { PageInfo } from "@/components/PageInfo";

export const dynamic = "force-dynamic";

Expand Down Expand Up @@ -33,5 +34,10 @@ export default async function PositionPage({
);
}

return <PositionView initialPositions={initialPositionsData} />;
return (
<>
<PageInfo title="Positions" />
<PositionView initialPositions={initialPositionsData} />
</>
);
}
8 changes: 7 additions & 1 deletion app/(authenticated)/admin/roles/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { validateSearchParams } from "@/lib/searchParams/validate";
import { getSearchParamsString } from "@/lib/searchParams/util";
import { fetchRolesAction } from "./actions";
import { Stack, Text } from "@mantine/core";
import { PageInfo } from "@/components/PageInfo";

export const dynamic = "force-dynamic";

Expand Down Expand Up @@ -43,5 +44,10 @@ export default async function PositionPage({
);
}

return <RoleView initialRoles={initialRolesData} />;
return (
<>
<PageInfo title="Roles" />
<RoleView initialRoles={initialRolesData} />
</>
);
}
19 changes: 12 additions & 7 deletions app/(authenticated)/admin/users/[userID]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
} from "@/features/people";
import { z } from "zod";
import { AdminUserView } from "./AdminUserView";
import { PageInfo } from "@/components/PageInfo";
import { getUserName } from "@/components/UserHelpers";

export default async function SingleUserPage({
params,
Expand All @@ -30,12 +32,15 @@ export default async function SingleUserPage({
const userAbsentRoles = getUserAbsentRoles({ user_id: user.user_id });

return (
<AdminUserView
user={user}
giveUserRole={giveUserRole}
removeUserRole={removeUserRole}
editUserAction={editUserAdmin}
userAbsentRoles={userAbsentRoles}
/>
<>
<PageInfo title={`User - ${getUserName(user)}`} />
<AdminUserView
user={user}
giveUserRole={giveUserRole}
removeUserRole={removeUserRole}
editUserAction={editUserAdmin}
userAbsentRoles={userAbsentRoles}
/>
</>
);
}
8 changes: 7 additions & 1 deletion app/(authenticated)/admin/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { searchParamsSchema } from "./schema";
import { redirect } from "next/navigation";
import { validateSearchParams } from "@/lib/searchParams/validate";
import { getSearchParamsString } from "@/lib/searchParams/util";
import { PageInfo } from "@/components/PageInfo";

export default async function PositionPage({
searchParams,
Expand Down Expand Up @@ -31,5 +32,10 @@ export default async function PositionPage({
);
}

return <UserView initialUsers={initialUsersData} />;
return (
<>
<PageInfo title="Users" />
<UserView initialUsers={initialUsersData} />
</>
);
}
2 changes: 2 additions & 0 deletions app/(authenticated)/calendar/[eventID]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import SlackLoginButton from "@/components/slack/SlackLoginButton";
import { CheckWithTechPromptContents } from "./CheckWithTech";
import { C } from "@fullcalendar/core/internal-common";
import dayjs from "dayjs";
import { PageInfo } from "@/components/PageInfo";

async function AttendeesView({
event,
Expand Down Expand Up @@ -190,6 +191,7 @@ export default async function EventPage({
}
return (
<>
<PageInfo title={event.name} />
{event.is_cancelled ? (
<Alert
variant="light"
Expand Down
14 changes: 9 additions & 5 deletions app/(authenticated)/calendar/discover/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { listVacantEvents } from "@/features/calendar/events";
import { CrewPositionType, getAllCrewPositions } from "@/features/calendar";
import { DiscoverView } from "@/app/(authenticated)/calendar/discover/DiscoverView";
import { PageInfo } from "@/components/PageInfo";

export default async function CalendarDiscoverPage({
searchParams,
Expand Down Expand Up @@ -44,11 +45,14 @@ export default async function CalendarDiscoverPage({
});

return (
<DiscoverView
vacantRoles={vacantRoles}
crewPositions={crewPositions}
position={position}
/>
<>
<PageInfo title="Discover Roles" />
<DiscoverView
vacantRoles={vacantRoles}
crewPositions={crewPositions}
position={position}
/>
</>
);
}

Expand Down
2 changes: 2 additions & 0 deletions app/(authenticated)/calendar/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { App } from "@slack/bolt";
import { Channel } from "@slack/web-api/dist/response/ConversationsListResponse";
import { env } from "@/lib/env";
import { createEvent } from "./actions";
import { PageInfo } from "@/components/PageInfo";

async function getSlackChannels(): Promise<Channel[]> {
var fetchedSlackChannels: Channel[] = [];
Expand Down Expand Up @@ -60,6 +61,7 @@ export default async function NewEventPage() {

return (
<div className="mx-auto max-w-xl">
<PageInfo title="New Event" />
<h1 className="mb-4 mt-0 text-4xl font-bold">New Event</h1>
<MembersProvider members={allMembers}>
<SlackChannelsProvider slackChannels={publicSlackChannels}>
Expand Down
22 changes: 21 additions & 1 deletion app/(authenticated)/feedback/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import { isSlackEnabled } from "@/lib/slack/slackApiConnection";
import { doHandleUserReport } from "./actions";
import { UserReportForm } from "./form";
import { PageInfo } from "@/components/PageInfo";
import { BackButton } from "@/components/BackButton";

export default async function ReportPage() {
export default async function ReportPage({
searchParams,
}: {
searchParams: {
return_to?: string;
};
}) {
if (!isSlackEnabled) {
return (
<div>
<PageInfo title="Feedback" />
<BackButton
path={
searchParams.return_to && decodeURIComponent(searchParams.return_to)
}
/>
<h1>Not available</h1>
<p>
Unfortunately the slack integration isn&apos;t enabled for this site,
Expand All @@ -17,6 +31,12 @@ export default async function ReportPage() {

return (
<div>
<PageInfo title="Feedback" />
<BackButton
path={
searchParams.return_to && decodeURIComponent(searchParams.return_to)
}
/>
<h1>Report a problem or request a feature</h1>
<p>
We want to know how we can make the internal site better! Please let us
Expand Down
2 changes: 2 additions & 0 deletions app/(authenticated)/quotes/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { requirePermission } from "@/lib/auth/server";
import { AddQuote, QuoteView } from "./AddEditQuoteForm";
import { Stack } from "@mantine/core";
import { QuotesPagination } from "./pagination";
import { PageInfo } from "@/components/PageInfo";

export const dynamic = "force-dynamic";

Expand All @@ -20,6 +21,7 @@ export default async function QuotesPage(props: {

return (
<div>
<PageInfo title="Quotes Board" />
<h1>Quotes</h1>
<Stack>
{total > 0 ? (
Expand Down
2 changes: 2 additions & 0 deletions app/(authenticated)/user/me/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import { hasWrapped } from "../../wrapped/util";
import Link from "next/link";
import { env } from "@/lib/env";
import { SignoutButton } from "@/components/SignoutButton";
import { PageInfo } from "@/components/PageInfo";

export default async function UserPage() {
const user = People.SecureUserModel.parse(await mustGetCurrentUser());
const prefs = People.preferenceDefaults(user.preferences);
const slackUser = user.identities.find((i) => i.provider === "slack");
return (
<div>
<PageInfo title="My Profile" />
<Card withBorder>
<Group>
{user.avatar && (
Expand Down
18 changes: 11 additions & 7 deletions app/(authenticated)/webcam/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@ import { Center, Group, Loader, Stack } from "@mantine/core";
import { Suspense } from "react";
import { WebcamGrid } from "./WebcamGrid";
import { addWebcam, editWebcam, removeWebcam } from "./actions";
import { PageInfo } from "@/components/PageInfo";

export const dynamic = "force-dynamic";

export default function WebcamPage() {
const webcamFeeds = fetchWebcamFeeds();

return (
<Center>
<Stack w={"100%"}>
<Suspense fallback={<Loader />}>
<WebcamGrid webcams={webcamFeeds} />
</Suspense>
</Stack>
</Center>
<>
<PageInfo title="Webcams" />
<Center>
<Stack w={"100%"}>
<Suspense fallback={<Loader />}>
<WebcamGrid webcams={webcamFeeds} />
</Suspense>
</Stack>
</Center>
</>
);
}
2 changes: 2 additions & 0 deletions app/(authenticated)/wrapped/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { mustGetCurrentUser } from "@/lib/auth/server";
import { notFound } from "next/navigation";
import { createHash } from "node:crypto";
import { hasWrapped } from "./util";
import { PageInfo } from "@/components/PageInfo";

export default async function WrappedPage({
searchParams,
Expand All @@ -24,6 +25,7 @@ export default async function WrappedPage({
const fileURL = `https://cdn.ystv.co.uk/wrapped2024/${emailHash}.mp4`;
return (
<div>
<PageInfo title="YSTV Wrapped" />
<video
src={fileURL}
controls
Expand Down
2 changes: 2 additions & 0 deletions app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { isSlackEnabled } from "@/lib/slack/slackApiConnection";
import { Center, Stack } from "@mantine/core";
import { env } from "@/lib/env";
import { ensureNoActiveSession } from "@/lib/auth/server";
import { PageInfo } from "@/components/PageInfo";

export default async function GoogleSignInPage(props: {
searchParams: { error?: string; redirect?: string };
Expand All @@ -17,6 +18,7 @@ export default async function GoogleSignInPage(props: {

return (
<div className="relative block h-full w-full">
<PageInfo title="Login" />
<Image
src={BG}
alt=""
Expand Down
30 changes: 30 additions & 0 deletions components/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use client";

import { Button } from "@mantine/core";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { FaChevronLeft } from "react-icons/fa";

export function BackButton(props: { path?: string }) {
const router = useRouter();

useEffect(() => {
if (props.path) router.prefetch(props.path);
});

return (
<Button
onClick={() => {
if (props.path) {
router.push(props.path);
} else {
router.back();
}
}}
leftSection={<FaChevronLeft />}
variant="subtle"
>
Back
</Button>
);
}
7 changes: 7 additions & 0 deletions components/PageInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use client";

export function PageInfo(props: { title?: string }) {
return (
<title>{`${props.title ? props.title + " | " : ""}YSTV Calendar`}</title>
);
}

0 comments on commit d661f20

Please sign in to comment.