bugfix: all the toasts unfied inside organizations feature. other features still need a refactor for toasts though.

This commit is contained in:
2026-05-17 13:59:00 +03:30
parent 046257c071
commit 2025a868ea
4 changed files with 206 additions and 72 deletions

View File

@@ -1,6 +1,7 @@
'use client';
import { DialogCloseButton } from '@/components/ui/common/DialogCloseButton';
import { ToastStack, type ToastMessages } from '@/components/ui/common/Toast';
import type { OrganizationInvitationHistoryItemDto } from '@/lib/api/organization';
import { Badge, organizationConnectionStatusVariant } from '@/components/ui/common/Badge';
import { Table } from '@/components/ui/common/Table';
@@ -28,8 +29,8 @@ type InvitationHistoryDialogProps = {
copiedId: string | null;
copyingInvitationId: string | null;
onCopy: (invitation: OrganizationInvitationHistoryItemDto) => void;
copyError?: string;
copySuccess?: string;
/** Same page-level toasts, rendered at top of dialog while it is open. */
toastMessages?: ToastMessages;
};
export function InvitationHistoryDialog({
@@ -40,8 +41,7 @@ export function InvitationHistoryDialog({
copiedId,
copyingInvitationId,
onCopy,
copyError,
copySuccess,
toastMessages,
}: InvitationHistoryDialogProps) {
if (!open) return null;
@@ -60,17 +60,7 @@ export function InvitationHistoryDialog({
<DialogCloseButton onClick={onClose} />
</div>
{copyError && (
<div className="rounded-[var(--radius-md)] border border-red-500/40 bg-red-500/10 px-4 py-3 text-sm text-red-700 dark:text-red-300">
{copyError}
</div>
)}
{copySuccess && (
<div className="rounded-[var(--radius-md)] border border-primary/30 bg-primary-soft/40 px-4 py-3 text-sm text-text-primary">
{copySuccess}
</div>
)}
{toastMessages && <ToastStack {...toastMessages} />}
{loading ? (
<p className="text-sm text-text-secondary">Loading invitation history...</p>