Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
✨ Show a toast when poll notifications are toggled (#2804)
Luke Vella267b6771ad16
diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.jsonindex 5392e83bb..2a36cb559 100644--- a/apps/web/public/locales/en/app.json+++ b/apps/web/public/locales/en/app.json@@ -476,6 +476,8 @@"notFoundTitle": "Page not found","notifications": "Notifications","notificationsDescription": "Choose which email notifications you receive",+ "notificationToggleMutedToast": "Notifications are off for this poll",+ "notificationToggleUnmutedToast": "Notifications are on for this poll","notifyNewComment": "New comment","notifyNewResponse": "New response","noUsers": "No users found",@@ -723,6 +725,7 @@"unbanUser": "Unban user","unconfirmedEventsEmptyStateDescription": "Unconfirmed events will show up here.","unconfirmedEventsEmptyStateTitle": "No Unconfirmed Events",+ "undo": "Undo","unexpectedError": "Unexpected Error","unlicensed": "Unlicensed","unmuteNotifications": "Unmute notifications",diff --git a/apps/web/src/features/poll/components/notification-toggle.tsx b/apps/web/src/features/poll/components/notification-toggle.tsxindex a854df0d1..6becca15d 100644--- a/apps/web/src/features/poll/components/notification-toggle.tsx+++ b/apps/web/src/features/poll/components/notification-toggle.tsx@@ -1,6 +1,7 @@"use client";import { Button } from "@rallly/ui/button";+import { toast } from "@rallly/ui/sonner";import { Tooltip, TooltipContent, TooltipTrigger } from "@rallly/ui/tooltip";import { BellIcon, BellOffIcon } from "lucide-react";import { usePoll } from "@/features/poll/client";@@ -22,6 +23,31 @@ export function NotificationToggle() {muted: vars.muted,};});+ if (vars.muted) {+ toast(+ t("notificationToggleMutedToast", {+ defaultValue: "Notifications are off for this poll",+ }),+ {+ icon: <BellOffIcon className="size-4" />,+ action: {+ label: t("undo", { defaultValue: "Undo" }),+ onClick: () => {+ toggleMuted.mutate({ pollId: vars.pollId, muted: false });+ },+ },+ },+ );+ } else {+ toast(+ t("notificationToggleUnmutedToast", {+ defaultValue: "Notifications are on for this poll",+ }),+ {+ icon: <BellIcon className="size-4" />,+ },+ );+ }},});@@ -43,6 +69,7 @@ export function NotificationToggle() {}): t("muteNotifications", { defaultValue: "Mute notifications" })}+ loading={toggleMuted.isPending}onClick={() => {toggleMuted.mutate({ pollId: poll.id, muted: !poll.muted });}}diff --git a/packages/ui/src/sonner.tsx b/packages/ui/src/sonner.tsxindex 3f657a18e..9f8047c21 100644--- a/packages/ui/src/sonner.tsx+++ b/packages/ui/src/sonner.tsx@@ -12,10 +12,16 @@ const Toaster = ({ ...props }: ToasterProps) => {<Sonnertheme={theme as ToasterProps["theme"]}className="toaster group"+ style={+ {+ "--normal-bg": "var(--popover)",+ "--normal-text": "var(--popover-foreground)",+ "--normal-border": "var(--popover-border)",+ } as React.CSSProperties+ }toastOptions={{classNames: {- toast:- "group toast group-[.toaster]:bg-popover group-[.toaster]:text-popover-foreground group-[.toaster]:border-popover-border group-[.toaster]:shadow-lg",+ toast: "group toast group-[.toaster]:shadow-lg",description:"group-[.toast]:text-gray-500 dark:group-[.toast]:text-gray-400",actionButton: