-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/master' into 625-add-team-to-about
# Conflicts: # client/sanity/schema.ts
- Loading branch information
Showing
73 changed files
with
2,817 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import { AboutItemSchema } from "@/models/sanity/AboutItem/Schema" | ||
import { ContactDetailSchema } from "@/models/sanity/ContactDetail/Schema" | ||
import { HomePageSchema } from "@/models/sanity/HomePage/Schema" | ||
import { LodgeInfoSchema } from "@/models/sanity/LodgeInfo/Schema" | ||
import { type SchemaTypeDefinition } from "sanity" | ||
import { CommitteeMemberSchema } from "@/models/sanity/CommitteeMembers/Schema" | ||
import { LifeMemberSchema } from "@/models/sanity/LifeMembers/Schema" | ||
|
||
export const schema: { types: SchemaTypeDefinition[] } = { | ||
types: [ | ||
AboutItemSchema, | ||
HomePageSchema, | ||
ContactDetailSchema, | ||
CommitteeMemberSchema, | ||
LifeMemberSchema | ||
] | ||
types: [AboutItemSchema, HomePageSchema, ContactDetailSchema, LodgeInfoSchema, CommitteeMemberSchema, | ||
LifeMemberSchema] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"use client" | ||
|
||
import WrappedAdminBookingHistoryView from "@/components/composite/Admin/AdminBookingHistoryView/WrappedAdminBookingHistoryView" | ||
import { AdminHeading } from "../AdminHeading" | ||
|
||
export default function AdminBookingHistoryPage() { | ||
return ( | ||
<> | ||
<AdminHeading title="History" /> | ||
<WrappedAdminBookingHistoryView /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
.../src/components/composite/Admin/AdminBookingHistoryView/AdminBookingHistoryItem.story.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import type { Meta, StoryObj } from "@storybook/react" | ||
import { BookingHistoryEvent } from "@/models/History" | ||
import { Timestamp } from "firebase/firestore" | ||
import AdminBookingHistoryItem from "./AdminBookingHistoryItem" | ||
|
||
const meta: Meta<typeof AdminBookingHistoryItem> = { | ||
component: AdminBookingHistoryItem | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
const bookingAdditionItem: BookingHistoryEvent = { | ||
event_type: "added_user_to_booking", | ||
timestamp: Timestamp.fromMillis(69), | ||
start_date: Timestamp.now(), | ||
end_date: Timestamp.now(), | ||
uid: "jack sun" | ||
} | ||
|
||
const bookingDeletionItem: BookingHistoryEvent = { | ||
event_type: "removed_user_from_booking", | ||
timestamp: Timestamp.fromMillis(69), | ||
start_date: Timestamp.now(), | ||
end_date: Timestamp.now(), | ||
uid: "stephen zhang" | ||
} | ||
|
||
const availabilityChangeItem: BookingHistoryEvent = { | ||
event_type: "changed_date_availability", | ||
timestamp: Timestamp.fromMillis(69), | ||
start_date: Timestamp.now(), | ||
end_date: Timestamp.now(), | ||
change: -32 | ||
} | ||
|
||
export const AdditionItem: Story = { | ||
args: { | ||
item: bookingAdditionItem, | ||
name: "stephen zhang" | ||
} | ||
} | ||
|
||
export const DeletionItem: Story = { | ||
args: { | ||
item: bookingDeletionItem, | ||
name: "Jack sun" | ||
} | ||
} | ||
|
||
export const AvailabilityChangeItem: Story = { | ||
args: { | ||
item: availabilityChangeItem | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
client/src/components/composite/Admin/AdminBookingHistoryView/AdminBookingHistoryItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import { DateUtils } from "@/components/utils/DateUtils" | ||
import { BookingHistoryEvent } from "@/models/History" | ||
import { useMemo } from "react" | ||
|
||
interface IAdminBookingHistoryItem { | ||
/** | ||
* The event that is to be parsed and displayed in list view | ||
*/ | ||
item: BookingHistoryEvent | ||
/** | ||
* The name of the user associated with the event (**NOT** the admin performing it) | ||
*/ | ||
name?: string | ||
/** | ||
* The email of the user associated with the event (**NOT** the admin performing it) | ||
*/ | ||
email?: string | ||
} | ||
|
||
const AdminBookingHistoryItem = ({ | ||
item, | ||
name, | ||
}: IAdminBookingHistoryItem) => { | ||
/** | ||
* Used for parsing the history event and presenting it | ||
*/ | ||
const InnerContent = useMemo(() => { | ||
const UserInformation = () => { | ||
return ( | ||
<h5 className="border-dark-blue-100 w-fit border-2 px-3"> | ||
User: <strong>{name}</strong> | Email: <strong>{email}</strong> | ||
</h5> | ||
) | ||
} | ||
const SharedContent = () => { | ||
return ( | ||
<> | ||
<p> | ||
At{" "} | ||
<strong> | ||
{new Date( | ||
DateUtils.timestampMilliseconds(item.timestamp) | ||
).toLocaleString()} | ||
</strong>{" "} | ||
for the date range{" "} | ||
<strong> | ||
{DateUtils.formattedNzDate( | ||
new Date(DateUtils.timestampMilliseconds(item.start_date)) | ||
)} | ||
</strong>{" "} | ||
to{" "} | ||
<strong> | ||
{DateUtils.formattedNzDate( | ||
new Date(DateUtils.timestampMilliseconds(item.end_date)) | ||
)} | ||
</strong> | ||
</p> | ||
</> | ||
) | ||
} | ||
switch (item.event_type) { | ||
case "added_user_to_booking": | ||
return ( | ||
<> | ||
<h5 className="font-bold uppercase underline">Added to booking</h5> | ||
<UserInformation /> | ||
<SharedContent /> | ||
</> | ||
) | ||
case "removed_user_from_booking": | ||
return ( | ||
<> | ||
<h5 className="font-bold uppercase underline"> | ||
Removed from booking | ||
</h5> | ||
<UserInformation /> | ||
<SharedContent /> | ||
</> | ||
) | ||
case "changed_date_availability": | ||
return ( | ||
<> | ||
<h5 className="font-bold uppercase underline"> | ||
Availability Changed | ||
</h5> | ||
<div className="flex gap-1"> | ||
<SharedContent /> | ||
<p> | ||
for <strong>{item.change}</strong> slots | ||
</p> | ||
</div> | ||
</> | ||
) | ||
} | ||
}, [item, name, email]) | ||
|
||
return ( | ||
<> | ||
<div className="border-gray-3 flex w-full flex-col gap-1 rounded-md border bg-white p-4"> | ||
{InnerContent} | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default AdminBookingHistoryItem |
Oops, something went wrong.