Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
12f96c7
Adding the new color palette and variations to globals.css
liug88 Jun 1, 2025
a4a5bf7
Update color palette to add variations for bone and lion colors
liug88 Jun 1, 2025
0196021
Inital Landing Page with Nav Bar and Dark Mode Toggle
liug88 Jun 1, 2025
13ace58
Added Hero Section with Call to Action Buttons
liug88 Jun 1, 2025
a97b510
Features Section with 3 Plancake benefits
liug88 Jun 1, 2025
7e14c3b
Added Steps on how to use plancake (a little cheesy ngl) TBD
liug88 Jun 2, 2025
f84298c
Call to Action Section
liug88 Jun 2, 2025
e7a4d0b
Footer
liug88 Jun 2, 2025
1c75cce
Merge branch 'main-preview' into landing-page
mirmirmirr Jun 7, 2025
95541ea
adjust styling for colors and dark mode
mirmirmirr Jun 7, 2025
c155f99
Merge pull request #6 from plan-cake/landing-page
mirmirmirr Jun 14, 2025
0b0325e
Merge pull request #7 from plan-cake/background-configurations
danielshid Jun 15, 2025
bd450e4
add timezone conversion logic
mirmirmirr Jun 15, 2025
6c34d1e
clean up schedule grid timezone configuration
mirmirmirr Jun 27, 2025
a15e263
add availability dragging support
mirmirmirr Jun 27, 2025
bf92f90
Merge pull request #9 from plan-cake/main
liug88 Jun 29, 2025
278021e
Redesign landing page and update branding to Plancake
liug88 Jun 29, 2025
e489bdb
Revamp homepage branding and update color scheme
liug88 Jun 29, 2025
6595f22
Redesign header and hero, add custom logo component
liug88 Jun 29, 2025
3816601
Logo Container
liug88 Jun 29, 2025
0b3d508
Refactor schedule grid to use Tailwind classes
liug88 Jun 29, 2025
fb25799
add label displays for generic weekdays
mirmirmirr Jul 1, 2025
00c00cf
clean painting
mirmirmirr Jul 1, 2025
048c7c1
refine schedule grid css
mirmirmirr Jul 2, 2025
61d00b2
hamburger (incomplete)
danielshid Jul 5, 2025
7aed253
Add UI-Changes to Create Event
mirmirmirr Jul 6, 2025
6f46e75
Fix Duration Option typo
mirmirmirr Jul 6, 2025
8dee2cb
Merge branch 'main-preview' into schedule-grid-timezone
mirmirmirr Jul 6, 2025
ceace41
Remove Timezone Label
mirmirmirr Jul 6, 2025
ba9d401
Remove Debug
mirmirmirr Jul 6, 2025
2230cb8
Merge branch 'schedule-grid-timezone' of https://github.com/plan-cake…
mirmirmirr Jul 6, 2025
4e049c3
Remove scrolling logic
mirmirmirr Jul 6, 2025
6e08a4a
Update date-range-drawer.tsx
mirmirmirr Jul 6, 2025
7ba7d1c
Merge pull request #10 from plan-cake/schedule-grid-timezone
liug88 Jul 6, 2025
6adf94a
initial work for availability page
mirmirmirr Jul 9, 2025
b5039dd
base results page
mirmirmirr Jul 12, 2025
7f1e463
adjust for mobile version
mirmirmirr Jul 12, 2025
f51f017
add adjustments for mobile
mirmirmirr Jul 12, 2025
1cd52d9
Merge remote-tracking branch 'origin/main-preview' into navigation-bar
danielshid Jul 12, 2025
8209618
Add placeholder logic for api calls
mirmirmirr Jul 16, 2025
c9e5f6a
change ring to inset-ring
mirmirmirr Jul 16, 2025
519d814
vertical line added + touch-ups
danielshid Jul 18, 2025
643067e
Condense add-availability for mobile
mirmirmirr Jul 19, 2025
2b168db
Revamp homepage and logo styles for improved UI
liug88 Jul 19, 2025
a956b93
Replace images with emojis and update styles
liug88 Jul 19, 2025
451f45f
Update logo colors and text stroke styles
liug88 Jul 19, 2025
c954a89
Refine homepage layout and update section content
liug88 Jul 19, 2025
7b2b4f0
Add client-side mount check to Logo component
liug88 Jul 19, 2025
3041b28
Restructure Event Info Drawer
mirmirmirr Jul 19, 2025
13142bb
Add bottom submit availability button for mobile
mirmirmirr Jul 19, 2025
44d359a
Add icons for mobile
mirmirmirr Jul 19, 2025
baa6da7
Merge branch 'main' into main-preview
mirmirmirr Jul 19, 2025
c8e5d68
Merge branch 'main' into availability-page
mirmirmirr Jul 19, 2025
4c90a5f
Merge branch 'main' into results-page
mirmirmirr Jul 19, 2025
0ea5c1d
Make timezone more readable
mirmirmirr Jul 19, 2025
ad68d90
Add copy toast
mirmirmirr Jul 19, 2025
eb9888b
Merge remote-tracking branch 'origin/main-preview' into navigation-bar
danielshid Jul 22, 2025
5cffab7
slightly cleaner
danielshid Jul 22, 2025
84a137c
Update to fix single block select
mirmirmirr Jul 25, 2025
800730b
Change container to sticky
mirmirmirr Jul 25, 2025
7f5b6e7
Merge branch 'results-page' into schedule-preview
mirmirmirr Jul 26, 2025
cd21193
fix time-block availability painting ques
mirmirmirr Jul 26, 2025
8c673c8
add copy toast
mirmirmirr Jul 26, 2025
a465849
differentiate full availability
mirmirmirr Jul 26, 2025
7c98141
Refactor theme toggle to fixed position in header
liug88 Jul 26, 2025
0ac5466
Centering the Why Plancake? Section on mobile
liug88 Jul 26, 2025
411b90f
Merge remote-tracking branch 'origin/landing-page' into navigation-bar
danielshid Jul 28, 2025
a234e42
added menu to updated landing page
danielshid Jul 28, 2025
4eb79f6
fix dark mode text color
mirmirmirr Aug 2, 2025
29809a9
add options to change timezone in availability + results page
mirmirmirr Aug 2, 2025
4f84aac
modify event-details panel
mirmirmirr Aug 2, 2025
fa22f0b
show isDisabled blocks regardless of the mode
mirmirmirr Aug 2, 2025
b31498c
add the missing end hour block
mirmirmirr Aug 2, 2025
5a74979
github-actions: auto-format code
github-actions[bot] Aug 2, 2025
9bf8a18
Merge branch 'main-preview' into schedule-preview
mirmirmirr Aug 2, 2025
da8135c
Update app/schedule/results/page.tsx
mirmirmirr Aug 2, 2025
9cbd402
Update app/ui/components/event-info-drawer.tsx
mirmirmirr Aug 2, 2025
5f85846
Merge remote-tracking branch 'origin/landing-page' into navigation-bar
danielshid Aug 2, 2025
fa39182
removed span on dropdown options
danielshid Aug 6, 2025
9e596ae
resolved hamburger hydration errors
danielshid Aug 12, 2025
c59eda4
dashboard sample
danielshid Aug 17, 2025
5fa3c75
Merge pull request #12 from plan-cake/navigation-bar
mirmirmirr Aug 30, 2025
45f3b4c
Merge pull request #13 from plan-cake/landing-page
mirmirmirr Sep 2, 2025
2b964c8
consolidate schedule-grid timeslot generation
mirmirmirr Sep 3, 2025
324206a
restructure types and utils
mirmirmirr Sep 3, 2025
c628782
adjust import statements
mirmirmirr Sep 3, 2025
a70441e
change expandEventRange per timezone
mirmirmirr Sep 4, 2025
5b26863
extract timeslots and create drag hook from timeblock
mirmirmirr Sep 5, 2025
786b63c
change availability set to store Date objects
mirmirmirr Sep 5, 2025
fd9462a
remove TimeBlock interface
mirmirmirr Sep 5, 2025
ef00bda
change availability set from Date to string
mirmirmirr Sep 14, 2025
d83f5b2
generate timslots from visibleDays
mirmirmirr Sep 14, 2025
8104217
login page done
danielshid Sep 20, 2025
5254fa8
Merge pull request #14 from plan-cake/dashboard
mirmirmirr Sep 20, 2025
11f2992
refactor timeslot generation and timeblock building
mirmirmirr Sep 26, 2025
9ce1e8a
group timeslots by timezone-adjusted day
mirmirmirr Sep 26, 2025
6f4a008
adjust timslot parameters
mirmirmirr Sep 26, 2025
4901447
fix grid border styles
mirmirmirr Sep 26, 2025
a8b094e
clean up unused imports and add memo for dayGroupedSlots generation
mirmirmirr Sep 26, 2025
6b80e98
filter timeblocks in schedule-grid
mirmirmirr Sep 26, 2025
5324537
modularize schedule-grid
mirmirmirr Sep 26, 2025
4cd6fb9
sign-up page done
danielshid Sep 26, 2025
225f9b5
separate the different types of timeblocks
mirmirmirr Sep 26, 2025
72d89da
fix interactive-timeblock update
mirmirmirr Sep 26, 2025
cd7ee97
update package
mirmirmirr Sep 30, 2025
3c5556b
reformat create event
mirmirmirr Sep 30, 2025
8f0d912
reformat results page
mirmirmirr Sep 30, 2025
69ed4ae
fix hour labels
mirmirmirr Sep 30, 2025
0b301ab
Update utils.tsx
mirmirmirr Sep 30, 2025
fba387f
switch out username for email
danielshid Sep 30, 2025
88a530b
github-actions: auto-format code
github-actions[bot] Sep 30, 2025
313b75c
oops i forgot to run format \O/
danielshid Sep 30, 2025
d4b7fd0
Merge branch 'login' of https://github.com/plan-cake/frontend into login
danielshid Sep 30, 2025
dce5a0d
Merge pull request #16 from plan-cake/login
danielshid Oct 1, 2025
75eb0ec
Add forgot password page
jzgom067 Oct 2, 2025
20fd8ef
Add reset password page
jzgom067 Oct 2, 2025
9858e27
Add extra checks to reset password page
jzgom067 Oct 2, 2025
40ac04c
Add email sent section to sign up
jzgom067 Oct 2, 2025
039e1ad
Change login and signup pages to have email fields
jzgom067 Oct 2, 2025
e44e9c2
Add verify email page
jzgom067 Oct 2, 2025
ceb8e5f
Add email verification functionality
jzgom067 Oct 2, 2025
e9d16c2
give each timeblock a background
mirmirmirr Oct 2, 2025
9ea410a
adjust color visibility
mirmirmirr Oct 2, 2025
a80d84c
make color adjustments
mirmirmirr Oct 2, 2025
e97b2be
Create MessagePage component
jzgom067 Oct 2, 2025
b02fd18
Separate email sent page from sign up
jzgom067 Oct 2, 2025
914e612
Separate success page from reset password
jzgom067 Oct 2, 2025
c9f62aa
Remove random email verification
jzgom067 Oct 2, 2025
9f5cf85
Remove button type file
jzgom067 Oct 2, 2025
432d4be
Decrease spacing in message page
jzgom067 Oct 2, 2025
9f354d5
Change secondary button to use border
jzgom067 Oct 2, 2025
048a0f1
Change button type to avoid form submission
jzgom067 Oct 2, 2025
ac921ec
Change description argument to optional
jzgom067 Oct 2, 2025
cf541de
Move MessagePage to layouts folder
jzgom067 Oct 2, 2025
275d296
Add cooldown to resend email button
jzgom067 Oct 2, 2025
8e96365
Fix email resend timer persistence
jzgom067 Oct 3, 2025
765d814
Add new event link to hamburger menu
jzgom067 Oct 3, 2025
030a8d7
Change hamburger menu login option name
jzgom067 Oct 3, 2025
5b7cf87
Add example.env
jzgom067 Oct 3, 2025
4a1a848
Update example.env
jzgom067 Oct 3, 2025
c3aa837
Add setup for local API testing
jzgom067 Oct 3, 2025
3fd594d
Create API error format util function
jzgom067 Oct 3, 2025
cd077df
Add login API functionality
jzgom067 Oct 3, 2025
9cb9ecd
Add login restriction
jzgom067 Oct 3, 2025
0899531
Fix login button functionality
jzgom067 Oct 3, 2025
8fd8bcc
Add sign up API functionality
jzgom067 Oct 3, 2025
7a5ae7e
Add resend verification email API functionality
jzgom067 Oct 3, 2025
943382d
Add verify email API functionality
jzgom067 Oct 3, 2025
9cc83d4
Add forgot password API functionality
jzgom067 Oct 3, 2025
e21ec07
Add reset password API functionality
jzgom067 Oct 3, 2025
d0509c0
Add logout button to dashboard page
jzgom067 Oct 3, 2025
4e9349e
Add logout API functionality
jzgom067 Oct 3, 2025
25d7d8a
implement event range reducer
mirmirmirr Oct 3, 2025
6cea867
update utils.tsx for schedule
mirmirmirr Oct 3, 2025
106f778
switch time storage from string to int
mirmirmirr Oct 3, 2025
c77a1bf
add generateSlotsForWeekdayRange
mirmirmirr Oct 4, 2025
8fd6591
add daylabel for weekdays
mirmirmirr Oct 4, 2025
b92f404
Update schedule-grid.tsx
mirmirmirr Oct 4, 2025
076f5b7
clean up code
mirmirmirr Oct 4, 2025
73d1fe5
update page name change
mirmirmirr Oct 4, 2025
a172997
Update event-info-drawer.tsx
mirmirmirr Oct 4, 2025
f452b81
fix page formatting
mirmirmirr Oct 4, 2025
015001e
Add account button to header with API function
jzgom067 Oct 7, 2025
1368b28
update timezone select to use react-timezone-select
mirmirmirr Oct 7, 2025
648acbc
Create frosted-glass CSS class
jzgom067 Oct 7, 2025
1b6a3df
Shorten frosted glass child selector
jzgom067 Oct 7, 2025
51a1df9
Move mounted render logic to header component
jzgom067 Oct 7, 2025
bc126ee
Fix login button functionality
jzgom067 Oct 7, 2025
185e7a9
Remove cookie check todo comment
jzgom067 Oct 7, 2025
87ac6a1
Add cursor-pointer to theme and account buttons
jzgom067 Oct 7, 2025
a249bd9
Consolidate className styles
jzgom067 Oct 7, 2025
4c24c25
Reorganize header files
jzgom067 Oct 7, 2025
1d0edca
update date range input to read only
mirmirmirr Oct 8, 2025
dfce304
switch from input to span
mirmirmirr Oct 8, 2025
9b23ead
fix extra hour on timezone conversions
mirmirmirr Oct 8, 2025
71232e8
allow for calculations for the last hour of the day
mirmirmirr Oct 8, 2025
fa0bb9c
truncate timezone select
mirmirmirr Oct 8, 2025
2b2baad
initialize event information reducers
mirmirmirr Oct 8, 2025
f264df6
Merge pull request #17 from plan-cake/more-auth-pages
mirmirmirr Oct 8, 2025
42af72f
Merge pull request #18 from plan-cake/navigation
mirmirmirr Oct 8, 2025
add88a7
Remove empty else block
jzgom067 Oct 8, 2025
ba2b2ca
Add account button dropdown menu
jzgom067 Oct 8, 2025
7e4d359
Separate account and log in buttons again
jzgom067 Oct 8, 2025
651b91f
Remove commented line
jzgom067 Oct 8, 2025
b0644e6
Add icons to dropdown items
jzgom067 Oct 8, 2025
7cd2729
Merge pull request #19 from plan-cake/auth-api-connection
mirmirmirr Oct 8, 2025
d44e271
define window.location.origin for copy toast
mirmirmirr Oct 8, 2025
1a5a21c
remove onChangeSpecific to date range input
mirmirmirr Oct 8, 2025
d37558f
create a new folder for selectors
mirmirmirr Oct 8, 2025
6ad54d3
create eventTypeSelect component
mirmirmirr Oct 8, 2025
d9c84a3
reformat weekday choices
mirmirmirr Oct 8, 2025
1893d0e
remove padding for event type selector
mirmirmirr Oct 8, 2025
4b0694b
add availability reducer
mirmirmirr Oct 8, 2025
52213e3
remove userAvailability type
mirmirmirr Oct 8, 2025
423ca80
update schedule-grid for availability painting
mirmirmirr Oct 8, 2025
6ed1bf8
change timezone select to just accept string
mirmirmirr Oct 8, 2025
37ce6b5
update weekday timeslot calculations
mirmirmirr Oct 8, 2025
9d7256f
update to use event info hook
mirmirmirr Oct 8, 2025
1ac5319
add create event button
mirmirmirr Oct 8, 2025
aa38d76
add custom code input
mirmirmirr Oct 8, 2025
ce99f79
Merge branch 'main-preview' into schedule-preview
mirmirmirr Oct 8, 2025
6117651
remove tailwind and postcss
mirmirmirr Oct 8, 2025
5696a4a
Revert "remove tailwind and postcss"
mirmirmirr Oct 8, 2025
35f475e
Add functionality to dropdown items
jzgom067 Oct 8, 2025
a1205a6
Remove logout button from dashboard
jzgom067 Oct 8, 2025
31f19a5
Remove auto focus on dropdown close
jzgom067 Oct 8, 2025
55e8188
Remove router from account button
jzgom067 Oct 8, 2025
62bb4e3
edit layout
mirmirmirr Oct 8, 2025
956965c
add header padding to pages
mirmirmirr Oct 8, 2025
ad1e8c2
Add LoginContext for account button update
jzgom067 Oct 8, 2025
97d85db
Add new event button to header
jzgom067 Oct 8, 2025
fd2ef0b
Add plus icon to new event button
jzgom067 Oct 8, 2025
4875b05
Add auto-hide on new event button
jzgom067 Oct 8, 2025
0271f39
Change account button style to frosted glass
jzgom067 Oct 8, 2025
3788d4e
Fix LoginContext provider reference
jzgom067 Oct 8, 2025
b3e4a22
add layout for dark mode
mirmirmirr Oct 8, 2025
3f00a1c
Merge pull request #20 from plan-cake/profile-element
mirmirmirr Oct 8, 2025
28aad0a
Merge branch 'main-preview' into schedule-preview
mirmirmirr Oct 8, 2025
bf7d3f0
clean import paths for providers
mirmirmirr Oct 8, 2025
bdbbaef
remove layout padding
mirmirmirr Oct 8, 2025
111a3ac
update schedule layout to have padding
mirmirmirr Oct 8, 2025
8dd5292
Merge pull request #11 from plan-cake/schedule-preview
jzgom067 Oct 8, 2025
dd815dd
fix dark/light for dark system
mirmirmirr Oct 8, 2025
3796299
fix schedule grid background color
mirmirmirr Oct 8, 2025
d99b87d
Merge pull request #21 from plan-cake/dark-and-light-mode
jzgom067 Oct 8, 2025
7d44d07
Further organize header files
jzgom067 Oct 9, 2025
f204bb1
Add link to landing page from logo
jzgom067 Oct 9, 2025
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
8 changes: 4 additions & 4 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ jobs:
runs-on: ubuntu-latest

permissions:
contents: write # Required to push to the repo
contents: write # Required to push to the repo

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }} # Checkout PR branch
ref: ${{ github.head_ref }} # Checkout PR branch

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
node-version: "20"
cache: "npm"

- name: Install dependencies
run: npm ci
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

certificates
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ To clone and run this application, [Node.js](https://nodejs.org/en/download/) (w
npm install npm@latest -g
```

### `.env` Setup

Create a file called `.env` in the root directory, copying the contents of `example.env`.

Replace all values in the file with the relevant information.

### Installation

```bash
Expand Down
58 changes: 58 additions & 0 deletions app/_lib/availability/availability-reducer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { AvailabilitySet } from "./types";
import { createEmptyUserAvailability, toggleUtcSlot } from "./utils";

export interface AvailabilityState {
displayName: string;
timeZone: string;
userAvailability: AvailabilitySet;
}

export type AvailabilityAction =
| { type: "RESET_AVAILABILITY" }
| { type: "SET_DISPLAY_NAME"; payload: string }
| { type: "SET_TIME_ZONE"; payload: string }
| {
type: "TOGGLE_SLOT";
payload: { slot: string };
};

// 3. Create the reducer function
export function availabilityReducer(
state: AvailabilityState,
action: AvailabilityAction,
): AvailabilityState {
switch (action.type) {
case "RESET_AVAILABILITY": {
return {
...state,
userAvailability: createEmptyUserAvailability(),
};
}

case "SET_DISPLAY_NAME": {
return {
...state,
displayName: action.payload,
};
}

case "SET_TIME_ZONE": {
return {
...state,
timeZone: action.payload,
};
}

case "TOGGLE_SLOT": {
const { slot } = action.payload;
return {
...state,
userAvailability: toggleUtcSlot(state.userAvailability, slot),
};
}

default: {
return state;
}
}
}
2 changes: 2 additions & 0 deletions app/_lib/availability/types.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// a set containing ISO strings of selected UTC date-time slots
export type AvailabilitySet = Set<string>;
41 changes: 41 additions & 0 deletions app/_lib/availability/use-availability.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { useReducer, useCallback } from "react";
import { availabilityReducer, AvailabilityState } from "./availability-reducer";
import { createEmptyUserAvailability } from "./utils";

export function useAvailability(
initialDisplayName = "",
initialTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone,
) {
const initialState: AvailabilityState = {
displayName: initialDisplayName,
timeZone: initialTimeZone,
userAvailability: createEmptyUserAvailability(),
};

const [state, dispatch] = useReducer(availabilityReducer, initialState);

// DISPATCHERS
const setDisplayName = useCallback((name: string) => {
dispatch({ type: "SET_DISPLAY_NAME", payload: name });
}, []);

const setTimeZone = useCallback((tz: string) => {
dispatch({ type: "SET_TIME_ZONE", payload: tz });
}, []);

const toggleSlot = useCallback((slot: string) => {
dispatch({ type: "TOGGLE_SLOT", payload: { slot } });
}, []);

const resetAvailability = useCallback(() => {
dispatch({ type: "RESET_AVAILABILITY" });
}, []);

return {
state,
setDisplayName,
setTimeZone,
toggleSlot,
resetAvailability,
};
}
55 changes: 55 additions & 0 deletions app/_lib/availability/utils.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// app/_lib/availability.ts

import { fromZonedTime } from "date-fns-tz";
import { AvailabilitySet } from "@/app/_lib/availability/types";

// Creates an empty UserAvailability object
export const createEmptyUserAvailability = (): AvailabilitySet => {
return new Set<string>();
};

// Toggles a single time slot in the user's availability
export function toggleUtcSlot(
prev: AvailabilitySet,
timeSlot: string, // ISO string
): AvailabilitySet {
const updated = new Set(prev);
if (updated.has(timeSlot)) {
updated.delete(timeSlot);
} else {
updated.add(timeSlot);
}
return updated;
}

// Checks if a specific time slot is in the user's availability
export function isSlotSelected(
availability: AvailabilitySet,
timeSlot: Date,
): boolean {
return availability.has(timeSlot.toISOString());
}

// Converts a local time representation to a UTC ISO string
export function getUtcIsoString(
dateKey: string, // "YYYY-MM-DD"
hour: number,
minute: number,
timezone: string,
): string {
const localDateTimeString = `${dateKey}T${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}:00`;
const utcDate = fromZonedTime(localDateTimeString, timezone);
return utcDate.toISOString();
}

// Gets a UTC ISO slot for a specific date and time
export function getUtcIsoSlot(
dateKey: string,
hour: number,
minute: number,
timezone: string,
): { utcDate: Date; isoString: string } {
const localDateTimeString = `${dateKey}T${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}:00`;
const utcDate = fromZonedTime(localDateTimeString, timezone);
return { utcDate, isoString: utcDate.toISOString() };
}
24 changes: 24 additions & 0 deletions app/_lib/providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"use client";

import { ThemeProvider } from "next-themes";
import { createContext, useState } from "react";

export const LoginContext = createContext<{
loggedIn: boolean;
setLoggedIn: (loggedIn: boolean) => void;
}>({
loggedIn: false,
setLoggedIn: () => {},
});

export function Providers({ children }: { children: React.ReactNode }) {
const [loggedIn, setLoggedIn] = useState(false);

return (
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<LoginContext.Provider value={{ loggedIn, setLoggedIn }}>
{children}
</LoginContext.Provider>
</ThemeProvider>
);
}
52 changes: 52 additions & 0 deletions app/_lib/schedule/event-info-reducer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { EventInformation } from "./types";
import { EventRangeReducer, EventRangeAction } from "./event-range-reducer";

export type EventInfoAction =
| { type: "SET_TITLE"; payload: string }
| { type: "SET_CUSTOM_CODE"; payload: string }
| EventRangeAction
| { type: "RESET" };

export function EventInfoReducer(
state: EventInformation,
action: EventInfoAction,
): EventInformation {
switch (action.type) {
case "SET_TITLE":
return {
...state,
title: action.payload,
};
case "SET_CUSTOM_CODE":
return {
...state,
customCode: action.payload,
};
case "RESET":
return {
title: "",
customCode: "",
eventRange: {
type: "specific",
duration: 60,
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
dateRange: {
from: new Date().toISOString(),
to: new Date().toISOString(),
},
timeRange: {
from: 9,
to: 17,
},
},
};
default:
return {
...state,
eventRange: EventRangeReducer(
state.eventRange,
action as EventRangeAction,
),
};
}
}
Loading