From a2d1dbebba5230a0b797e82f975a4b595ac8c6ce Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:45:13 +0100 Subject: [PATCH] feat: editmode availbility slider (#11197) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add loading data and banner * [WIP] hasEditPerms middleware * fix: type error in booker (#11011) * New Crowdin translations by Github Action * refactor: removed redundant test (#10785) Co-authored-by: gitstart-calcom Co-authored-by: Shivam Kalra * feat: 2fa backup codes (#10600) Co-authored-by: Peer Richelsen * Delete add-PRs-to-project-reviewing-PRs.yml (#11008) Co-authored-by: alannnc * New Crowdin translations by Github Action * fix: multiple duration when booking (#11032) * fix: other reported issues (#11015) * fix: weird margin top in avatar * fix: pending users are shown on booking page * fix: avatar and naming issues * fix: toast alignment and removing unneeded titles * missing changes from toast improvements * feat: empty state for teams without event types * Removing console.log * feat: cal ai (#10992) Co-authored-by: nicktrn <55853254+nicktrn@users.noreply.github.com> Co-authored-by: tedspare Co-authored-by: Alex van Andel * New Crowdin translations by Github Action * fix: meeting ended trigger for webhooks and zapier sometimes not working (#10946) Co-authored-by: mohammed gehad Co-authored-by: Monto <138862352+monto7926@users.noreply.github.com> Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> * feat: team admin: see connected apps of team members (#11036) * added feature:team admin can see connected apps of members * fixed the type error * Update packages/lib/server/queries/teams/index.ts * Minor fixes --------- Co-authored-by: alannnc * fix: lower case slugs in teams (#11026) * fix: lower case slugs in teams Signed-off-by: Udit Takkar * fix: use slugify Signed-off-by: Udit Takkar --------- Signed-off-by: Udit Takkar * refactor: improvements on german translation (#10898) * fix: fix-tablet-menu-not-centered-sidebar (#11020) Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> * chore: add Popover in storybook (#11021) Co-authored-by: gitstart-calcom Co-authored-by: Udit Takkar * fix: Set mobile availability (#11027) * chore: add ColorPicker in storybook (CALCOM-10760) (#10866) Co-authored-by: gitstart-calcom * feat: adds next cold start profiler (#11014) * Handle disabling of ORGANIZATIONS_ENABLED flag (#11041) * New Crowdin translations by Github Action * styles:dark mode color fix (#11004) * chore: sheet darkmode and improve responsive (#11047) * fix: handle collective multiple host on destinationCalendar (#10967) * fix: include app data and credentials from DB (#11048) * include app data and credentials from DB * Improve performance * fix: Error when running storybook (#11037) Co-authored-by: gitstart-calcom Co-authored-by: Peer Richelsen * fix: broken company profile link on team booking page (#10978) * chore: add ErrorBoundary in storybook (CALCOM-10760) (#10872) Co-authored-by: gitstart-calcom * feat: sorting for workflow and routing forms (#10780) Co-authored-by: Udit Takkar Co-authored-by: Peer Richelsen * resolve zod versions across child packages (#11052) * fix: List storybook file is empty (fix-list) (#10965) Co-authored-by: gitstart-calcom * fix: admin org list without members (#11051) Co-authored-by: Peer Richelsen * chore: add ToggleGroup in storybook (#10802) Co-authored-by: gitstart-calcom Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> * fix: add metadata to stripe payment intent (#11053) * fix: Logo storybook file with invalid icons (fix-logo) (#11018) Co-authored-by: gitstart-calcom * fix: Add controls for Select Field storybook file (#10936) Co-authored-by: gitstart-calcom * fix: Fix tooltip control on ButtonPlayground storybook file (fix-ButtonTooltip) (#10937) Co-authored-by: gitstart-calcom * fix: email embed – remove collapsible and permanently show times (#10996) Co-authored-by: Hariom Balhara Co-authored-by: Mehul * chore: add Timezone Select in storybook (CALCOM-10760) (#10966) Co-authored-by: gitstart-calcom Co-authored-by: Peer Richelsen * chore: add Switch in storybook (CALCOM-10760) (#10804) Co-authored-by: gitstart-calcom Co-authored-by: Peer Richelsen * Sync packages * fix: zod utils due to upgrade * easy fix (#11054) * fix sub quantity update stripe (#11057) * v3.2.7 * Revert "feat: adds next cold start profiler (#11014)" (#11072) This reverts commit 05631d093f30f9c74ebc58b0ff6a8b11824dffe1. * fix: Fixes username invite issue (#10998) * Fixes username invite issue * Ensure we only suggest email invites in org members --------- Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> * Fix sheet layout * WIP permissions when userschedule doesnt match * WIP get handler weird behaviour * Update toast * add disabled - handle membership overlap * Handle permissions + perf improvments * use input uid * Remove Console.log * Clean up * Revert changes accidental * Fix merge artifacts * Remove dead code * Remove code after return * Update read permission check * Revert avatar changes as fixed elsewhere * Handle if user has not completed onboarding * Disable button * Update packages/lib/hasEditPermissionForUser.ts * Correct Error throwing * Update packages/features/timezone-buddy/components/AvailabilityEditSheet.tsx * Fix type erro * Add i18n * Improve Spacing * Update yarn.lock --------- Signed-off-by: Udit Takkar Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Crowdin Bot Co-authored-by: GitStart-Cal.com <121884634+gitstart-calcom@users.noreply.github.com> Co-authored-by: gitstart-calcom Co-authored-by: Shivam Kalra Co-authored-by: nicktrn <55853254+nicktrn@users.noreply.github.com> Co-authored-by: Peer Richelsen Co-authored-by: alannnc Co-authored-by: Leo Giovanetti Co-authored-by: DexterStorey <36115192+DexterStorey@users.noreply.github.com> Co-authored-by: tedspare Co-authored-by: Alex van Andel Co-authored-by: Monto <138862352+montocoder@users.noreply.github.com> Co-authored-by: mohammed gehad Co-authored-by: Monto <138862352+monto7926@users.noreply.github.com> Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: Abhijeet Singh Co-authored-by: Kamil B. Demirci Co-authored-by: Denzil Samuel <71846487+samueldenzil@users.noreply.github.com> Co-authored-by: Udit Takkar Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Co-authored-by: Omar López Co-authored-by: Hariom Balhara Co-authored-by: Sahil Padvi <71093044+Sahil25061999@users.noreply.github.com> Co-authored-by: Patel Divyesh Co-authored-by: neo773 <62795688+neo773@users.noreply.github.com> Co-authored-by: Mehul --- apps/web/public/static/locales/en/common.json | 3 + .../schedules/components/Schedule.tsx | 26 ++- .../components/AvailabilityEditSheet.tsx | 199 ++++++++++++++++++ .../components/AvailabilitySliderTable.tsx | 41 +++- packages/lib/hasEditPermissionForUser.ts | 64 ++++++ .../viewer/availability/schedule/_router.tsx | 20 ++ .../availability/schedule/get.handler.ts | 24 +-- .../schedule/getScheduleByUserId.handler.ts | 52 +++++ .../schedule/getScheduleByUserId.schema.ts | 7 + .../availability/schedule/update.handler.ts | 17 +- .../team/listTeamAvailability.handler.ts | 2 + .../server/routers/viewer/teams/_router.tsx | 21 ++ .../teams/hasEditPermissionForUser.handler.ts | 19 ++ .../teams/hasEditPermissionForUser.schema.ts | 7 + packages/ui/components/data-table/index.tsx | 11 +- packages/ui/components/sheet/sheet.tsx | 19 +- packages/ui/components/table/TableNew.tsx | 5 +- yarn.lock | 7 +- 18 files changed, 502 insertions(+), 42 deletions(-) create mode 100644 packages/features/timezone-buddy/components/AvailabilityEditSheet.tsx create mode 100644 packages/lib/hasEditPermissionForUser.ts create mode 100644 packages/trpc/server/routers/viewer/availability/schedule/getScheduleByUserId.handler.ts create mode 100644 packages/trpc/server/routers/viewer/availability/schedule/getScheduleByUserId.schema.ts create mode 100644 packages/trpc/server/routers/viewer/teams/hasEditPermissionForUser.handler.ts create mode 100644 packages/trpc/server/routers/viewer/teams/hasEditPermissionForUser.schema.ts diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 478d87fdfc..278afdba9e 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -2050,5 +2050,8 @@ "no_members_found": "No members found", "event_setup_length_error":"Event Setup: The duration must be at least 1 minute.", "availability_schedules":"Availability Schedules", + "view_only_edit_availability_not_onboarded":"This user has not completed onboarding. You will not be able to set their availability until they have completed onboarding.", + "view_only_edit_availability":"You are viewing this user's availability. You can only edit your own availability.", + "edit_users_availability":"Edit user's availability: {{username}}", "ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑" } diff --git a/packages/features/schedules/components/Schedule.tsx b/packages/features/schedules/components/Schedule.tsx index 5ceec95205..50b6c609f9 100644 --- a/packages/features/schedules/components/Schedule.tsx +++ b/packages/features/schedules/components/Schedule.tsx @@ -43,11 +43,13 @@ const ScheduleDay = ({ weekday, control, CopyButton, + disabled, }: { name: ArrayPath; weekday: string; control: Control; CopyButton: JSX.Element; + disabled?: boolean; }) => { const { watch, setValue } = useFormContext(); const watchDayRange = watch(name); @@ -60,7 +62,7 @@ const ScheduleDay = ({