diff --git a/messages/ar.json b/messages/ar.json index be771fa..44fab91 100644 --- a/messages/ar.json +++ b/messages/ar.json @@ -205,6 +205,8 @@ "rejectionReason": "السبب", "actionRevoke": "إلغاء الاعتماد", "actionApprove": "اعتماد", + "revokeConfirmTitle": "إلغاء اعتماد المبدع؟", + "revokeConfirmBody": "سيؤدي إلغاء اعتماد {name} إلى منعه من تسجيل مشاريع جديدة. هل تريد المتابعة؟", "toastScoresTitle": "الدرجات مكتوبة على السلسلة", "toastScoresMsg": "{name} أُعيد التحقق: ائتمان {credit}، أخضر {green}.", "toastFundTitle": "تم نشر رأس المال", @@ -213,6 +215,7 @@ "toastApprovedMsg": "يمكن لـ {name} تسجيل المشاريع الآن.", "toastRevokedTitle": "تم إلغاء اعتماد المبدع", "toastRevokedMsg": "لم يعد {name} قادراً على تسجيل مشاريع جديدة.", + "toastRevokedUndo": "تراجع", "panelPushTitle": "إرسال تحديث درجات", "panelPushHint": "يكتب قراءة Oracle جديدة في ProjectRegistry.", "panelFundTitle": "تمويل مشروع", diff --git a/messages/en.json b/messages/en.json index 4f91082..0a2f0a8 100644 --- a/messages/en.json +++ b/messages/en.json @@ -228,6 +228,10 @@ "statusRejected": "Rejected", "rejectionReason": "Reason", "actionRevoke": "Revoke", + "revokeConfirmTitle": "Revoke creator?", + "revokeConfirm": "Yes, revoke", + "revokeConfirmBody": "Are you sure you want to revoke {name}? You can undo this action.", + "revokeCancel": "Cancel", "actionApprove": "Approve", "toastScoresTitle": "Scores written on-chain", "toastScoresMsg": "{name} re-verified: credit {credit}, green {green}.", @@ -237,6 +241,7 @@ "toastApprovedMsg": "{name} can now register projects.", "toastRevokedTitle": "Creator revoked", "toastRevokedMsg": "{name} can no longer register new projects.", + "actionUndo": "Undo", "panelPushTitle": "Push score update", "panelPushHint": "Writes a new oracle reading to the ProjectRegistry.", "panelFundTitle": "Fund a project", diff --git a/messages/es.json b/messages/es.json index 93ce671..2e77277 100644 --- a/messages/es.json +++ b/messages/es.json @@ -205,6 +205,10 @@ "rejectionReason": "Motivo", "actionRevoke": "Revoke", "actionApprove": "Approve", + "actionConfirmRevoke": "Sí, revocar", + "actionCancel": "Cancelar", + "revokeConfirmBody": "{name} ya no podrá registrar nuevos proyectos. Esta acción puede deshacerse.", + "toastRevokedUndo": "Deshacer", "toastScoresTitle": "Scores written on-chain", "toastScoresMsg": "{name} re-verified: credit {credit}, green {green}.", "toastFundTitle": "Capital deployed", diff --git a/messages/fr.json b/messages/fr.json index f8a7a3d..7073d57 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -220,6 +220,15 @@ "statusRejected": "Rejeté", "rejectionReason": "Raison", "actionRevoke": "Révoquer", + "revokeConfirm": "Oui, révoquer", + "revokeConfirmBody": "Cette action révoque l'accès du créateur au registre. Voulez-vous continuer ?", + "revokeCancel": "Annuler", + "revokeToast": "Créateur révoqué", + "revokeUndo": "Annuler"voquer", + "revokeConfirmBody": "La révocation retirera immédiatement l'accès de ce créateur. Vous pourrez annuler cette action.", + "revokeCancel": "Annuler", + "revokeToast": "Créateur révoqué", + "revokeUndo": "Annuler", "actionApprove": "Approuver", "toastScoresTitle": "Scores écrits sur la chaîne", "toastScoresMsg": "{name} re-vérifié : crédit {credit}, vert {green}.", @@ -229,6 +238,9 @@ "toastApprovedMsg": "{name} peut désormais enregistrer des projets.", "toastRevokedTitle": "Créateur révoqué", "toastRevokedMsg": "{name} ne peut plus enregistrer de nouveaux projets.", + "revokeConfirmTitle": "Révoquer ce créateur ?", + "revokeConfirmBody": "{name} ne pourra plus enregistrer de nouveaux projets. Vous pourrez annuler.", + "toastRevokedUndo": "Annuler la révocation", "panelPushTitle": "Envoyer une mise à jour de scores", "panelPushHint": "Écrit une nouvelle lecture oracle dans le ProjectRegistry.", "panelFundTitle": "Financer un projet", diff --git a/src/components/Toast.tsx b/src/components/Toast.tsx index bb79e6d..84dad7f 100644 --- a/src/components/Toast.tsx +++ b/src/components/Toast.tsx @@ -1,4 +1,4 @@ -'use client' +'use client'; import { createContext, @@ -10,12 +10,6 @@ import { } from 'react' import { CloseIcon } from './icons' -/** - * Heliobond Toast — enters and exits from the same edge, swipe-to-dismiss in - * spirit. Tones use an ink/semantic label + icon, never color alone. State - * changes that matter (preview, balance) belong in aria-live regions elsewhere; - * this is for transient confirmations. - */ export type ToastTone = 'neutral' | 'success' | 'error' | 'solar' export interface ToastProps { @@ -23,12 +17,13 @@ export interface ToastProps { title?: string message?: string action?: ReactNode + undo:? () => void onDismiss?: () => void href?: string style?: CSSProperties } -export function Toast({ tone = 'neutral', title, message, action, onDismiss, href, style }: ToastProps) { +export function Toast({ tone = 'neutral', title, message, action, undo, onDismiss, href, style }: ToastProps) { const accents: Record = { neutral: 'var(--ink)', success: 'var(--growth)', @@ -37,53 +32,80 @@ export function Toast({ tone = 'neutral', title, message, action, onDismiss, hre } const accent = accents[tone] || accents.neutral - const inner = ( + const hasActions = Boolean(action) || Boolean(undo) + + const content = ( <>