Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar v0 #88

Merged
merged 56 commits into from
Nov 2, 2023
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
770d3ed
testing out full calendar
Jul 19, 2023
f8041a7
get events as function working
Aug 2, 2023
32354f9
remove incorrect prop
Aug 2, 2023
0c2c052
preview for to calendar graphql query
Aug 3, 2023
3a1f958
styling full calendar
Aug 7, 2023
179f8a0
fix calendar height
Aug 7, 2023
4c3fed7
styling artists on calendar slot
Aug 7, 2023
728d11e
update event time so it works with datetime-local input
Aug 7, 2023
b1dd229
update getallartists query and set initial values for artist field
Aug 7, 2023
6179b7e
add extra artist fields
Aug 7, 2023
ffbf200
add reload/loading button
Aug 7, 2023
32a2e0e
add animation pause state to tailwind
Aug 7, 2023
644b669
fix typescript error
Aug 7, 2023
b5f529f
remove packge lock from accidental npm install
Aug 7, 2023
f8ac091
update yarn checksums
Aug 7, 2023
bfae306
testing preview on vercel
Aug 8, 2023
afaaf3f
preview now working on graphql
Aug 8, 2023
b876a39
adding status colours, status input and link to show on contentful
Aug 8, 2023
44eb830
creating calendar show now working
Aug 9, 2023
cb39352
fix day view
Aug 9, 2023
39a92dc
fix disabled options on multi select when limit is set to 1
Aug 9, 2023
61f5707
editing events now working
Aug 15, 2023
9856585
remove footer from calendar page
Aug 15, 2023
874f8cb
fix issue with editing shows when certain fields don't exist
Aug 16, 2023
c2257a9
make loading icon rotate at least once
Aug 16, 2023
4c5b016
fix day header format
Aug 16, 2023
c367abf
add dropdown menu for new event and images
Aug 17, 2023
993c3b9
dont update internal name
Aug 25, 2023
a613067
add automated email template
Aug 25, 2023
9613cfb
adjust title and id so naming is inline with full calendar
Aug 29, 2023
3e7f494
returned new event from contentful now parsed correctly for full cale…
Sep 4, 2023
535927d
new submission form with initial fields filled out from contentful
Sep 13, 2023
c27a853
fix type errors
Sep 13, 2023
ca60b40
upcoming show emails api working + extended day on calendar to 2am
Sep 27, 2023
94fdab6
add datepicker
Sep 28, 2023
de09a07
improve calendar on mobile
Sep 28, 2023
9ba04b9
tighten up toolbar on desktop
Sep 28, 2023
af840e6
reduce margin on mobile
Sep 28, 2023
845bb9f
set default view to day on mobile
Sep 28, 2023
5747929
move crud updates on contentful to client
Oct 16, 2023
35d8463
remove json
Oct 16, 2023
66b3f95
remove unncessary functions
Oct 16, 2023
4fd4bc8
add keyboard shortcuts
Oct 16, 2023
880ae8a
dont respond to key handlers if show dialog is open
Oct 18, 2023
51a1beb
edit button added to all pages with corresponding id on contentful (#77)
antiantivirus Oct 18, 2023
6855c17
Supabase auth (#82)
antiantivirus Oct 23, 2023
cef342d
adjust url for calendar to remove footer and chatroom button
Oct 23, 2023
c08cb7d
prepare calendar for read-only mode
Oct 23, 2023
3d9f2ef
revert show submission and api route
Nov 1, 2023
a0cc916
add radix ui radio group
Nov 1, 2023
cee7bfb
transpile radix ui package to solve deployment issue
Nov 1, 2023
81aaaf9
transpile all radix ui packages
Nov 1, 2023
001d843
fix contentful show link
Nov 1, 2023
efe8236
merge master and resolve conflicts
Nov 2, 2023
ac66325
remove border from date input on desktop
Nov 2, 2023
cae77c1
fix conflicts with main
Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update getallartists query and set initial values for artist field
Jack MB committed Aug 7, 2023
commit b1dd22907b19760d52a3fefed54d7b043127b66e
4 changes: 3 additions & 1 deletion components/formFields/multiSelectField.tsx
Original file line number Diff line number Diff line change
@@ -7,17 +7,19 @@ export default function MultiSelectField({
description,
options,
limit,
value,
...props
}: {
label: string;
description?: string;
name: string;
required?: boolean;
value?: Array<{ value: string; label: string }>;
options: Array<{ value: string; label: string }>;
limit?: number;
}) {
const [ariaFocusMessage, setAriaFocusMessage] = useState("");
const [selectedOptions, SetSelectedOptions] = useState([]);
const [selectedOptions, SetSelectedOptions] = useState(value);
const [isMenuOpen, setIsMenuOpen] = useState(false);
const [field, meta, helpers] = useField(props);
const { setFieldValue } = useFormikContext();
11 changes: 8 additions & 3 deletions lib/contentful/calendar.ts
Original file line number Diff line number Diff line change
@@ -28,7 +28,9 @@ export async function getCalendarShows(preview: boolean, start, end) {
artistsCollection(limit: 9) {
items {
name
slug
sys {
id
}
}
}
}
@@ -42,14 +44,17 @@ export async function getCalendarShows(preview: boolean, start, end) {

const shows = extractCollection<ScheduleShow>(res, "showCollection");

console.log(shows[0]);
console.log(shows[0].artistsCollection);

// const end = Date.now();

const processed = shows.map((event) => {
return {
title: event.title,
artists: event.artistsCollection.items,
artists: event.artistsCollection.items.map((artists) => ({
value: artists.sys.id,
label: artists.name,
})),
start: event.date.slice(0, -1),
end: event.dateEnd.slice(0, -1),
};
10 changes: 8 additions & 2 deletions lib/contentful/pages/submission.ts
Original file line number Diff line number Diff line change
@@ -110,8 +110,14 @@ export async function getAllArtists() {
const artistsTwo = await getArtists(1000, 1000);
const artistsThree = await getArtists(1000, 2000);

const AllArtists = artists.concat(artistsTwo.concat(artistsThree));
return AllArtists;
const allArtists = artists.concat(artistsTwo.concat(artistsThree));

const mappedArtists = allArtists.map((artists) => ({
value: artists.sys.id,
label: artists.name,
}));

return mappedArtists;
}

// export async function getArtistsPage(
33 changes: 22 additions & 11 deletions pages/calendar.tsx
Original file line number Diff line number Diff line change
@@ -6,15 +6,15 @@ import timeGridPlugin from "@fullcalendar/timegrid";
import listPlugin from "@fullcalendar/list";
import Loading from "../components/loading";
import * as Dialog from "@radix-ui/react-dialog";
import { useState } from "react";
import { useState, useEffect } from "react";
import InputField from "../components/formFields/inputField";
import MultiSelectField from "../components/formFields/multiSelectField";
import { Formik } from "formik";
import { Cross } from "../icons/cross";
import { getAllArtists } from "../lib/contentful/pages/submission";
import { Arrow } from "../icons/arrow";

export default function CalendarPage() {
const [artists, setArtists] = useState(getAllArtists);

return (
<Layout>
<div className="calendar-container">
@@ -25,9 +25,17 @@ export default function CalendarPage() {
}

function Calendar() {
const [artists, setArtists] = useState(null);
const [showDialogOpen, setShowDialogOpen] = useState<boolean>(false);
const [selectedShow, setSelectedShow] = useState(null);

useEffect(() => {
(async () => {
const artists = await getAllArtists();
setArtists(artists);
})();
}, []);

function handleSelect(selectInfo) {
console.log("select info");
setShowDialogOpen(true);
@@ -46,7 +54,7 @@ function Calendar() {
booker: "George",
start: selectedShow?.startStr,
end: selectedShow?.endStr,
artists: selectedShow?.artists,
artists: selectedShow?.extendedProps?.artists,
};

const _handleSubmit = (values, actions) => {
@@ -127,11 +135,13 @@ function Calendar() {
type="text"
/>
<InputField name="booker" label="Booker" required type="text" />
<InputField
name="artist"
label="Artist(s)"
required
type="text"
<MultiSelectField
label="Artist(s)*"
description="Please include guests, collectives and show hosts."
name="artists"
options={artists}
limit={10}
value={initialValues.artists}
/>
<InputField
name="start"
@@ -148,9 +158,10 @@ function Calendar() {
</form>
</Formik>
<Dialog.Close asChild>
<button className="font-medium underline">
<button className="font-medium underline flex gap-3 items-center">
{" "}
{selectedShow?.title ? "Edit" : "Add"} show
<Arrow />
</button>
</Dialog.Close>
</Dialog.Content>
@@ -176,7 +187,7 @@ function renderEventContent(eventInfo) {
eventInfo.event.extendedProps.artists.map((artist, i) => (
<span key={i}>
{i > 0 && ", "}
{artist.name}
{artist.label}
</span>
))}
</p>
5 changes: 1 addition & 4 deletions pages/submission.tsx
Original file line number Diff line number Diff line change
@@ -18,10 +18,7 @@ export async function getStaticProps({ preview = false }) {
value: genre.sys.id,
label: genre.name,
})),
artists: AllArtists.map((artists) => ({
value: artists.sys.id,
label: artists.name,
})),
artists: AllArtists,
preview,
...(await getSubmissionPage(preview)),
},
4 changes: 4 additions & 0 deletions styles/globals.css
Original file line number Diff line number Diff line change
@@ -268,3 +268,7 @@
.fc .fc-toolbar.fc-header-toolbar {
margin-bottom: 1rem;
}

.fc .fc-button {
@apply px-3 py-2;
}