/availability - Add ability to set as default in the dropdown (#5717)
Co-authored-by: Nitesh Singh <[email protected]> Co-authored-by: gitstart <[email protected]> Co-authored-by: Matheus Benini Ferreira <[email protected]> Co-authored-by: Rafael Toledo <[email protected]> Co-authored-by: niteshsingh1357 <[email protected]> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> Co-authored-by: gitstart <[email protected]> Co-authored-by: gGh00sTt <[email protected]> Co-authored-by: Thiago Nascimbeni <[email protected]> Co-authored-by: Matheus Muniz <[email protected]> Co-authored-by: gitstart <[email protected]> Co-authored-by: Nitesh Singh <[email protected]> Co-authored-by: Matheus Benini Ferreira <[email protected]> Co-authored-by: Rafael Toledo <[email protected]> Co-authored-by: niteshsingh1357 <[email protected]> Co-authored-by: gitstart-app[bot] <57568882+gitstart-app[bot]@users.noreply.github.com> Co-authored-by: gitstart <[email protected]> Co-authored-by: gGh00sTt <[email protected]> Co-authored-by: Thiago Nascimbeni <[email protected]> Co-authored-by: Matheus Muniz <[email protected]> Co-authored-by: Omar López <[email protected]>
This commit is contained in:
3 files changed
+74
-17
No files matched your search
@@ -45,6 +45,24 @@ export function AvailabilityList({ schedules }: RouterOutputs["viewer"]["availab
|
||||
},
|
||||
});
|
||||
|
||||
const updateMutation = trpc.viewer.availability.schedule.update.useMutation({
|
||||
onSuccess: async ({ schedule }) => {
|
||||
await utils.viewer.availability.list.invalidate();
|
||||
showToast(
|
||||
t("availability_updated_successfully", {
|
||||
scheduleName: schedule.name,
|
||||
}),
|
||||
"success"
|
||||
);
|
||||
},
|
||||
onError: (err) => {
|
||||
if (err instanceof HttpError) {
|
||||
const message = `${err.statusCode}: ${err.message}`;
|
||||
showToast(message, "error");
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// Adds smooth delete button - item fades and old item slides into place
|
||||
|
||||
const [animationParentRef] = useAutoAnimate<HTMLUListElement>();
|
||||
@@ -71,6 +89,7 @@ export function AvailabilityList({ schedules }: RouterOutputs["viewer"]["availab
|
||||
}}
|
||||
key={schedule.id}
|
||||
schedule={schedule}
|
||||
updateDefault={updateMutation.mutate}
|
||||
deleteFunction={deleteMutation.mutate}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -1408,5 +1408,6 @@
|
||||
"enter_option": "Enter Option {{index}}",
|
||||
"add_an_option": "Add an option",
|
||||
"radio": "Radio",
|
||||
"kbar_search_placeholder" : "Start typing to search"
|
||||
"kbar_search_placeholder" : "Start typing to search",
|
||||
"set_as_default": "Set as default"
|
||||
}
|
||||
Reference in new issue
Block a user