feat: list schedules atom (#24205)

* feat: add api v2 endpoint to fetch all user schedules

* chore: update typing

* feat: custom hook to fetch all user schedules

* refactor: shift logic to transform schedules into function of its own

* init: list schedules atom

* feat: api endpoints for list schedules atom

* refactor: accept redirect url as prop

* fix: pass redirect url prop

* integrate list schedules atom with availability settings

* refactor: extract types to be reused in api v2 endpoints

* skip availability settings page for the time being until we have api v2 endpoints in prod

* feat: add docs for list schedules atom

* fixup

* export Schedule type

* make sure we always have a default schedule if user deletes his default schedule

* chore: implement code rabbit feedback

* chore: implement PR feedback

* fix: resolve merge conflicts

* fix: import path

* update platform libraries

* fix: type check

* resolve  merge conflicts

* update atoms export

* update platform libraries schedule

* chore: arrange atoms in alphabetical order

* update atoms controller to include endpoints for list schedules atom

* add create atom scheule atom

* fix: invalidate schedules on new schedule creation

* chore: add changesets
This commit is contained in:
Rajiv Sahal authored and GitHub committed 2025-10-15 17:57:22 +02:00
1 parent 3402f79912
commit 0757b00db7
21 files changed
+483 -24

No files matched your search

@@ -26,6 +26,7 @@ export function ScheduleListItem({
updateDefault,
isDeletable,
duplicateFunction,
redirectUrl,
}: {
schedule: RouterOutputs["viewer"]["availability"]["list"]["schedules"][number];
deleteFunction: ({ scheduleId }: { scheduleId: number }) => void;
@@ -37,6 +38,7 @@ export function ScheduleListItem({
isDeletable: boolean;
updateDefault: ({ scheduleId, isDefault }: { scheduleId: number; isDefault: boolean }) => void;
duplicateFunction: ({ scheduleId }: { scheduleId: number }) => void;
redirectUrl: string;
}) {
const { t, i18n } = useLocale();
@@ -44,10 +46,7 @@ export function ScheduleListItem({
<li key={schedule.id}>
<div className="hover:bg-muted flex items-center justify-between px-3 py-5 transition sm:px-4">
<div className="group flex w-full items-center justify-between ">
<Link
href={`/availability/${schedule.id}`}
className="flex-grow truncate text-sm"
title={schedule.name}>
<Link href={redirectUrl} className="flex-grow truncate text-sm" title={schedule.name}>
<div className="space-x-2 rtl:space-x-reverse">
<span className="text-emphasis truncate font-medium">{schedule.name}</span>
{schedule.isDefault && (