Skip to content

Commit 2681280

Browse files
committed
fix frontend + pastel colours for reschedule requests
fixed pending accept button with correct api call working rescheduling - auto refresh fix scrollable areas on dashboard conflicts sends reschedule requests fix rescheduling errors - updated api linting fixes
1 parent dd13277 commit 2681280

9 files changed

Lines changed: 638 additions & 398 deletions

File tree

public/swagger/swagger.json

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,7 @@
17301730
"content": {
17311731
"application/json": {
17321732
"schema": {
1733-
"type": "string"
1733+
"type": "number"
17341734
}
17351735
}
17361736
}
@@ -2404,20 +2404,20 @@
24042404
"required": [
24052405
"title",
24062406
"meetingDuration",
2407-
"startTime",
2408-
"endTime",
24092407
"location",
2410-
"attendees"
2408+
"attendees",
2409+
"endRangeTime",
2410+
"startRangeTime"
24112411
],
24122412
"properties": {
24132413
"title": {
24142414
"type": "string",
24152415
"description": "name of the meeting"
24162416
},
24172417
"meetingDuration": {
2418-
"type": "string",
2419-
"description": "The length of the meeting, denoted in **ISO 8601** format. - Example:\n - **1 hour** → `'PT1H'`\n - **2 hours, 30 minutes** → `'PT2H30M'`\n- `'P'` is the duration designator. - `'T'` separates date and time components. - `'H'` (hours) and `'M'` (minutes) specify the time duration. - If omitted, the default duration is **30 minutes** (`'PT30M'`).\n",
2420-
"example": "PT2H30M"
2418+
"type": "integer",
2419+
"format": "int32",
2420+
"description": "The length of the meeting in minutes"
24212421
},
24222422
"startRangeTime": {
24232423
"type": "string",
@@ -2516,8 +2516,6 @@
25162516
"title",
25172517
"meetingDuration",
25182518
"attendees",
2519-
"startTime",
2520-
"endTime",
25212519
"location",
25222520
"startRangeTime",
25232521
"endRangeTime"
@@ -2528,9 +2526,9 @@
25282526
"description": "name of the meeting"
25292527
},
25302528
"meetingDuration": {
2531-
"type": "string",
2532-
"description": "The length of the meeting, denoted in **ISO 8601** format. - Example:\n - **1 hour** → `'PT1H'`\n - **2 hours, 30 minutes** → `'PT2H30M'`\n- `'P'` is the duration designator. - `'T'` separates date and time components. - `'H'` (hours) and `'M'` (minutes) specify the time duration. - If omitted, the default duration is **30 minutes** (`'PT30M'`).\n",
2533-
"example": "PT2H30M"
2529+
"type": "integer",
2530+
"format": "int32",
2531+
"description": "The length of the meeting in minutes"
25342532
},
25352533
"attendees": {
25362534
"type": "array",

shared

src/app/dashboard/page.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { errorToast } from '@/hooks/use-toast'
2020
import { format } from 'date-fns'
2121

2222
export default function Dashboard() {
23-
const [calendar, setCalendar] = useState<Array<CalendarEvent>>([])
23+
const [calendar, setCalendar] = useState<CalendarEvent[]>([])
2424
const [invites, setInvites] = useState<InvitesMe[]>([])
2525

2626
useEffect(() => {
@@ -32,6 +32,9 @@ export default function Dashboard() {
3232
const startFormatted = now.toISOString().slice(0, 19) + 'Z'
3333
const endFormatted = endOfDay.toISOString().slice(0, 19) + 'Z'
3434

35+
console.log('startFormatted', startFormatted)
36+
console.log('endFormatted', endFormatted)
37+
3538
try {
3639
const data = await slotifyClient.GetAPICalendarMe({
3740
queries: {

src/components/calendar-overview.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,12 @@ export function CalendarOverview() {
410410
onOpenChangeAction={setIsCreateEventOpen}
411411
closeCreateEventDialogOpen={() => setIsCreateEventOpen(false)}
412412
initialTitle={''}
413-
initialDuration={'1hr'}
413+
initialDuration={60}
414414
initialParticipants={[]}
415415
initialSelectedRange={null}
416416
inputsDisabled={false}
417+
isRescheduleAccepted={false}
418+
isComplete={false}
417419
/>
418420

419421
<Dialog

src/components/calendar/create-event.tsx

Lines changed: 25 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,29 @@ interface CreateEventProps {
2929
onOpenChangeAction: (open: boolean) => void
3030
closeCreateEventDialogOpen: () => void
3131
initialTitle?: string
32-
initialDuration?: string
32+
initialDuration?: number
3333
initialParticipants?: User[]
3434
initialSelectedRange?: { start: Date; end: Date } | null
3535
inputsDisabled?: boolean
36-
}
37-
38-
// Mapping from dropdown option to minutes
39-
const durationMapping: { [key: string]: number } = {
40-
'30 minutes': 30,
41-
'1hr': 60,
42-
'2hrs': 120,
36+
isRescheduleAccepted: boolean
37+
isComplete: boolean
38+
rescheduleID?: number | null
39+
getRescheduleEvents?: () => Promise<void>
4340
}
4441

4542
export function CreateEvent({
4643
open,
4744
onOpenChangeAction,
4845
closeCreateEventDialogOpen,
4946
initialTitle = '',
50-
initialDuration = '1hr',
47+
initialDuration,
5148
initialParticipants = [],
5249
initialSelectedRange = null,
5350
inputsDisabled = false,
51+
isRescheduleAccepted,
52+
isComplete,
53+
rescheduleID = null,
54+
getRescheduleEvents,
5455
}: CreateEventProps) {
5556
const [myEvents, setMyEvents] = useState<CalendarEvent[]>([])
5657
const [title, setTitle] = useState(initialTitle)
@@ -122,38 +123,6 @@ export function CreateEvent({
122123
[selectedRange],
123124
)
124125

125-
// useEffect(() => {
126-
// const searchUsers = async () => {
127-
// if (!userSearchQuery) {
128-
// setSearchResults([])
129-
// return
130-
// }
131-
// try {
132-
// let response
133-
// if (userSearchQuery.includes('@')) {
134-
// // Search by email
135-
// response = await slotifyClient.GetAPIUsers({
136-
// queries: { email: userSearchQuery },
137-
// })
138-
// } else {
139-
// // Search by name
140-
// response = await slotifyClient.GetAPIUsers({
141-
// queries: { name: userSearchQuery },
142-
// })
143-
// }
144-
// setSearchResults(response)
145-
// } catch (error) {
146-
// console.error('Error searching users:', error)
147-
// toast({
148-
// title: 'Error',
149-
// description: 'Failed to search users.',
150-
// variant: 'destructive',
151-
// })
152-
// }
153-
// }
154-
// searchUsers()
155-
// }, [userSearchQuery])
156-
157126
// Add a user from search results to selected participants
158127
const handleAddParticipant = (user: User) => {
159128
if (
@@ -226,7 +195,8 @@ export function CreateEvent({
226195
})
227196
}
228197

229-
const durationInMinutes = durationMapping[duration] || 60
198+
const durationInMinutes = duration
199+
console.log('durationInMinutes', durationInMinutes)
230200
const meetingDuration = `PT${durationInMinutes}M`
231201

232202
// Fetch scheduling suggestions
@@ -247,6 +217,7 @@ export function CreateEvent({
247217
isRequired: false,
248218
suggestLocation: false,
249219
},
220+
minimumAttendeePercentage: 0,
250221
})
251222

252223
setAvailabilityData(response)
@@ -328,14 +299,16 @@ export function CreateEvent({
328299
id='duration'
329300
value={duration}
330301
onChange={e => {
331-
setDuration(e.target.value)
302+
setDuration(Number(e.target.value))
303+
console.log('e.target.value', e.target.value)
304+
console.log('duration', duration)
332305
}}
333306
className='block w-full rounded-md border border-gray-300 p-2'
334307
disabled={inputsDisabled}
335308
>
336-
<option value='30 minutes'>30 minutes</option>
337-
<option value='1hr'>1hr</option>
338-
<option value='2hrs'>2hrs</option>
309+
<option value={30}>30 minutes</option>
310+
<option value={60}>1hr</option>
311+
<option value={120}>2hrs</option>
339312
</select>
340313
</div>
341314

@@ -398,8 +371,13 @@ export function CreateEvent({
398371
currentUser={currentUser}
399372
participants={selectedParticipants}
400373
location={''} //TODO fix this
401-
eventTitle={title}
374+
eventTitle={title ?? 'New Meeting'}
402375
closeCreateEventDialogOpen={closeCreateEventDialogOpen}
376+
isRescheduleAccepted={isRescheduleAccepted!}
377+
isComplete={isComplete!}
378+
rescheduleID={rescheduleID}
379+
selectedRange={memoizedRange}
380+
getRescheduleEvents={getRescheduleEvents}
403381
/>
404382
</div>
405383
</div>

0 commit comments

Comments
 (0)