Skip to content

Commit 35408fc

Browse files
committed
Merge branch 'main' into mia/global-slack-app
2 parents d885b00 + 04f57d4 commit 35408fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+972
-370
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NB: These are _not_ prefixed with NEXT_PUBLIC because we don't want their values to be sewn into the Docker image
22
# Base configuration
3-
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/calendar_2023"
3+
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/internal_site"
44
PUBLIC_URL=http://localhost:3000
55
SESSION_SECRET= # A random string, in production should be a secure secret e.g. `openssl rand -base64 32`
66

.github/pull_request_template.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
https://linear.app/ystv/issue/INT-XXX <!-- fill this in, or remove if there isn't one -->
2+
3+
## What
4+
5+
<!-- What does this PR do? One sentence if possible. -->
6+
7+
## Why
8+
9+
<!-- How does this PR improve YSTV members' lives? -->
10+
11+
## How
12+
13+
<!-- Is there anything noteworthy about how you implemented it? Something for the reviewer to be aware of? -->
14+
15+
## Testing
16+
17+
<!-- Give evidence that it works, to save your reviewer's time. Talk about how you tested it. Include screenshots. -->

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN apt-get update -y && apt-get install -y build-essential python3
88
WORKDIR /app
99
COPY ./.yarn/ .yarn/
1010
COPY . /app/
11-
RUN --mount=type=cache,id=calendar2023-yarn,target=.yarn/cache yarn install --immutable --inline-builds
11+
RUN --mount=type=cache,id=internal-site-yarn,target=.yarn/cache yarn install --immutable --inline-builds
1212

1313
ENV NODE_ENV=production
1414
ARG GIT_REV

Jenkinsfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pipeline {
55
agent {
66
node {
77
label 'docker && ramdisk'
8-
customWorkspace '/mnt/ramdisk/build/workspace/calendar'
8+
customWorkspace '/mnt/ramdisk/build/workspace/internal-site'
99
}
1010
}
1111

@@ -28,14 +28,14 @@ pipeline {
2828
}
2929
stage('Build Images') {
3030
environment {
31-
SENTRY_AUTH_TOKEN = credentials('calendar-sentry-auth-token')
31+
SENTRY_AUTH_TOKEN = credentials('internal-site-sentry-auth-token')
3232
}
3333
steps {
3434
sh """docker build \\
3535
--build-arg GIT_REV=${env.GIT_COMMIT} \\
3636
--build-arg VERSION=${env.TAG_NAME ?: 'v0.0.0'} \\
3737
--secret id=sentry-auth-token,env=SENTRY_AUTH_TOKEN \\
38-
-t registry.comp.ystv.co.uk/ystv/calendar2023:${imageTag}\\
38+
-t registry.comp.ystv.co.uk/ystv/internal-site:${imageTag}\\
3939
.
4040
"""
4141
}
@@ -50,7 +50,7 @@ pipeline {
5050
}
5151
}
5252
steps {
53-
dockerPush image: 'registry.comp.ystv.co.uk/ystv/calendar2023', tag: imageTag
53+
dockerPush image: 'registry.comp.ystv.co.uk/ystv/internal-site', tag: imageTag
5454
}
5555
}
5656

@@ -59,7 +59,7 @@ pipeline {
5959
changeRequest target: 'main'
6060
}
6161
steps {
62-
deployPreview action: 'deploy', job: 'calendar-preview', urlSuffix: 'internal.dev.ystv.co.uk'
62+
deployPreview action: 'deploy', job: 'internal-site-preview', urlSuffix: 'internal.dev.ystv.co.uk'
6363
}
6464
}
6565

@@ -69,12 +69,12 @@ pipeline {
6969
}
7070
steps {
7171
build job: 'Deploy Nomad Job', parameters: [
72-
string(name: 'JOB_FILE', value: 'calendar-dev.nomad'),
73-
text(name: 'TAG_REPLACEMENTS', value: "registry.comp.ystv.co.uk/ystv/calendar2023:${imageTag}")
72+
string(name: 'JOB_FILE', value: 'internal-site-dev.nomad'),
73+
text(name: 'TAG_REPLACEMENTS', value: "registry.comp.ystv.co.uk/ystv/internal-site:${imageTag}")
7474
], wait: true
7575
deployPreview action: 'cleanup'
7676
deployPreview action: 'cleanupMerge'
77-
sh "nomad alloc exec -task calendar-dev -job calendar-dev npx -y prisma migrate deploy --schema lib/db/schema.prisma"
77+
sh "nomad alloc exec -task internal-site-dev -job internal-site-dev npx -y prisma migrate deploy --schema lib/db/schema.prisma"
7878
}
7979
}
8080

@@ -85,10 +85,10 @@ pipeline {
8585
}
8686
steps {
8787
build job: 'Deploy Nomad Job', parameters: [
88-
string(name: 'JOB_FILE', value: 'calendar-prod.nomad'),
89-
text(name: 'TAG_REPLACEMENTS', value: "registry.comp.ystv.co.uk/ystv/calendar2023:${imageTag}")
88+
string(name: 'JOB_FILE', value: 'internal-site-prod.nomad'),
89+
text(name: 'TAG_REPLACEMENTS', value: "registry.comp.ystv.co.uk/ystv/internal-site:${imageTag}")
9090
], wait: true
91-
sh "nomad alloc exec -task calendar-prod -job calendar-prod npx -y prisma migrate deploy --schema lib/db/schema.prisma"
91+
sh "nomad alloc exec -task internal-site-prod -job internal-site-prod npx -y prisma migrate deploy --schema lib/db/schema.prisma"
9292
}
9393
}
9494
}

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# YSTV Calendar
1+
# YSTV Internal Site
22

33
This is the repo for https://internal.ystv.co.uk.
44
Formerly known as `experimental-hypothetical-new-internal-site-idea`.
55

66
## Getting Started
77

8-
To set up a local copy of the new calendar, you will need
8+
To set up a local copy of the new internal site, you will need
99

1010
- Node.js (18 or later) - https://nodejs.org/en/download
1111
- Yarn - once you have Node installed, run `corepack enable`
@@ -31,7 +31,7 @@ You will also need to set up the following:
3131

3232
### Postgres Database
3333

34-
Once you have PostgreSQL installed, run `createdb calendar_2023`.
34+
Once you have PostgreSQL installed, run `createdb internal_site`.
3535

3636
Now run `yarn prisma db push` to set up the database tables.
3737
If you get a permissions error, check your PostgreSQL authentication settings - you should have a `local all all peer` line in your pg_hba.conf.
@@ -95,6 +95,6 @@ Feature specific docs:
9595
- lib/ - low level utilities (auth, db, etc.)
9696
- server/ - custom server that handles socket.io communication
9797

98-
## Issue Tracking
98+
## Contributing
9999

100-
We use [Linear](https://linear.app/ystv) to track issues - to access it, sign in with your @ystv.co.uk Google account (ask a Computing Team member if you don't have one).
100+
Some documentation about how to contribute and some standards to follow is available [here](/docs/contributing.md)

app/(authenticated)/admin/positions/PositionView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
import { useDisclosure } from "@mantine/hooks";
2626
import { SearchBar } from "@/components/SearchBar";
2727
import { CreatePositionForm, UpdatePositionForm } from "./form";
28-
import { useValidSearchParams } from "@/lib/searchParams/validate";
2928
import { getSearchParamsString } from "@/lib/searchParams/util";
3029
import { PositionCard } from "./PositionCard";
3130
import {
@@ -36,6 +35,7 @@ import {
3635
updatePositionAction,
3736
} from "./actions";
3837
import { useQuery } from "@tanstack/react-query";
38+
import { useValidSearchParams } from "@/lib/searchParams/validateHook";
3939

4040
export function PositionView(props: { initialPositions: TFetchPositions }) {
4141
const pathname = usePathname();

app/(authenticated)/admin/roles/RoleView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
} from "@/components/Pagination";
2323
import { useDisclosure } from "@mantine/hooks";
2424
import { SearchBar } from "@/components/SearchBar";
25-
import { useValidSearchParams } from "@/lib/searchParams/validate";
2625
import { getSearchParamsString } from "@/lib/searchParams/util";
2726
import { RoleCard } from "./RoleCard";
2827
import { CreateRoleForm, UpdateRoleForm } from "./form";
@@ -36,6 +35,7 @@ import {
3635
updateRoleAction,
3736
} from "./actions";
3837
import { useQuery } from "@tanstack/react-query";
38+
import { useValidSearchParams } from "@/lib/searchParams/validateHook";
3939

4040
export function RoleView(props: { initialRoles: TFetchRoles }) {
4141
const pathname = usePathname();

app/(authenticated)/admin/users/UserView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
PaginationProvider,
2020
} from "@/components/Pagination";
2121
import { SearchBar } from "@/components/SearchBar";
22-
import { useValidSearchParams } from "@/lib/searchParams/validate";
22+
import { useValidSearchParams } from "@/lib/searchParams/validateHook";
2323
import { getSearchParamsString } from "@/lib/searchParams/util";
2424
import { UserCard } from "./UserCard";
2525
import { useQuery } from "@tanstack/react-query";

app/(authenticated)/calendar/YSTVCalendar.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import { z } from "zod";
3232
import { keepPreviousData, useQuery } from "@tanstack/react-query";
3333
import { fetchEvents } from "./actions";
3434
import { calendarEventsQueryKey } from "./helpers";
35+
import { EventColours } from "@/features/calendar/types";
36+
import { EventType } from "@/features/calendar/types";
3537

3638
dayjs.extend(weekOfYear);
3739

@@ -86,6 +88,12 @@ const HistoryStateSchema = z.object({
8688
filter: z.enum(["all", "mine", "vacant"]).optional(),
8789
});
8890

91+
const getEventColor = (evt: Event): string => {
92+
if (evt.is_cancelled) return "#B00020";
93+
if (evt.is_tentative) return "#8b8b8b";
94+
return EventColours[evt.event_type as EventType] || "#FFC0CB";
95+
};
96+
8997
export default function YSTVCalendar() {
9098
const currentDate = new Date();
9199

@@ -363,13 +371,13 @@ export default function YSTVCalendar() {
363371
end: evt.end_date,
364372
url: `/calendar/${evt.event_id}`,
365373
};
366-
if (evt.is_tentative) {
367-
eventObject.color = "#8b8b8b";
368-
}
374+
375+
eventObject.color = getEventColor(evt);
376+
369377
if (evt.is_cancelled) {
370-
eventObject.color = "#B00020";
371378
eventObject.className = "ystv-calendar-strike-through";
372379
}
380+
373381
if (evt.end_date.valueOf() < currentDate.valueOf()) {
374382
eventObject.className += " opacity-50";
375383
}
@@ -381,8 +389,6 @@ export default function YSTVCalendar() {
381389
);
382390
}
383391

384-
type EventType = "show" | "meeting" | "social" | "other";
385-
386392
interface Event {
387393
event_id: number;
388394
event_type: EventType | string;

app/(authenticated)/calendar/[eventID]/EventActionsUI.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
ConditionalField,
1919
DatePickerField,
2020
SearchedMemberSelect,
21+
SelectField,
2122
TextAreaField,
2223
TextField,
2324
} from "@/components/FormFields";
@@ -58,6 +59,31 @@ function EditModal(props: { event: EventObjectType; close: () => void }) {
5859
{/*<CheckBoxField name="is_private" label="Private Event" />*/}
5960
<br />
6061
<CheckBoxField name="is_tentative" label="Tentative Event" />
62+
<br />
63+
<Alert
64+
variant="light"
65+
color="orange"
66+
icon={<TbAlertTriangle />}
67+
title="Recurring Event"
68+
className="mt-4"
69+
>
70+
This event is recurring. It is linked to a number of other events which
71+
can be upated at the same time, but changing the timings has to be done
72+
individually.
73+
</Alert>
74+
<br />
75+
<SelectField
76+
name="recurring_update_type"
77+
label="Events to Update"
78+
options={[
79+
{ type: "none", label: "Only update this event" },
80+
{ type: "future", label: "Update this and future events" },
81+
{ type: "past", label: "Update this and past events" },
82+
{ type: "all", label: "Update all events" },
83+
]}
84+
getOptionValue={(obj) => obj.type}
85+
renderOption={(obj) => obj.label}
86+
/>
6187
{props.event.event_type === "public" && (
6288
<Alert
6389
variant="light"

0 commit comments

Comments
 (0)