Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

💄 Show a loading toast while a conferencing account disconnects (#3386)

Luke Vellaa23080fb79bf
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json
index 4f154f4a2..60629e97f 100644
--- a/apps/web/public/locales/en/app.json
+++ b/apps/web/public/locales/en/app.json
@@ -175,6 +175,7 @@
"conferencingConnectFailed": "We couldn't connect that account. Please try again.",
"conferencingDescription": "Connect the tools you use for video calls so we can add meeting links to your events.",
"conferencingDisconnected": "Account disconnected",
+ "conferencingDisconnecting": "Disconnecting account…",
"conferencingNotConnected": "{provider} is not connected. Visit the <a>Conferencing settings</a> page to connect your account.",
"configuredByEnvironmentVariable": "This setting has been configured by environment variable.",
"confirm": "Confirm",
diff --git a/apps/web/src/features/conferencing/components/conferencing-provider-list.tsx b/apps/web/src/features/conferencing/components/conferencing-provider-list.tsx
index 7630351bf..ef19b4cb5 100644
--- a/apps/web/src/features/conferencing/components/conferencing-provider-list.tsx
+++ b/apps/web/src/features/conferencing/components/conferencing-provider-list.tsx
@@ -32,15 +32,7 @@ export function ConferencingProviderList({
}) {
const { t } = useTranslation();
const disconnect = useMutation(
- mutationOptions(disconnectConferencingConnectionAction, {
- onSuccess: () => {
- toast.success(
- t("conferencingDisconnected", {
- defaultValue: "Account disconnected",
- }),
- );
- },
- }),
+ mutationOptions(disconnectConferencingConnectionAction),
);
return (
@@ -79,8 +71,19 @@ export function ConferencingProviderList({
<DropdownMenuContent align="end">
<DropdownMenuItem
variant="destructive"
+ disabled={disconnect.isPending}
onClick={() => {
- disconnect.mutate({ id: connection.id });
+ toast.promise(
+ disconnect.mutateAsync({ id: connection.id }),
+ {
+ loading: t("conferencingDisconnecting", {
+ defaultValue: "Disconnecting account…",
+ }),
+ success: t("conferencingDisconnected", {
+ defaultValue: "Account disconnected",
+ }),
+ },
+ );
}}
>
<UnplugIcon />