feat(ui): expand & brand toast notifications (add success level, flash→toast, MokoOnyx theming) #803
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Expand and brand MokoGIT's client-side toast notification system so transient
user feedback (success/info/warning/error) is delivered consistently through toasts
that match the MokoOnyx design language — instead of the current mix of error-only
toasts and server-rendered flash banners.
Current state
A toast module already exists (
web_src/js/modules/toast.ts,web_src/css/modules/toast.css,built on
toastify-js) and exposes:showInfoToast(),showWarningToast(),showErrorToast()— with per-level icon/background/duration,
preventDuplicates, optional HTML body, and gravity/position/duration overrides.
hideToastsFrom(),hideToastsAll().Usage today is heavily error-centric (≈53
showErrorToastcalls vs. 6 warning / 6 info),and there is no success toast at all. Positive, post-action feedback ("Settings saved",
"Branch created", "Copied to clipboard") is still delivered by server-rendered flash
banners — persistent, layout-shifting, and gone only on the next full page load.
Goals
successlevel +showSuccessToast()— the one missing intent. Greensemantic color, checkmark icon, sensible default duration.
ctx.Flashsuccess/info/warning/error messages into client-side toasts on page load, so post-redirect feedback is
transient and does not push page content down. Keep a no-JS fallback (render the flash
banner when JS is unavailable).
levelsmap /toast.csswith the brand semantic palette and theme tokens so toastsfollow light/dark:
#448344, danger/error#a51f18, warning#ad6200, info/accent#3f8ff0--mokogit-shadowelevation.nothing or a flash: copy-to-clipboard, async settings saves, token/secret created,
webhook test sent, etc.
aria-liveregion (polite forinfo/success, assertive for error/warning), toasts are keyboard-dismissible, respect
prefers-reduced-motion, and never steal focus.Technical notes
web_src/**(JS/CSS) rather than template surgery so it survivesupstream Gitea merges — same constraint as the theme/reskin work.
ToastLevelsmap + add theshowSuccessToastexport intoast.ts; add thematching
.test.tscase.(
web_src/js/features/…) and re-emit as toasts, then remove the banner; gate on theelement existing so no-JS still shows the banner.
toast.csscolors to the theme variables introduced bytheme-mokogit-*.css/mokogit-brand.css.Acceptance criteria
showSuccessToast()exists, exported, brand-green with a checkmark, and covered by a unit test.aria-liveregion; toasts are dismissible via keyboard; animations respectprefers-reduced-motion.preventDuplicatesstill works; toasts stack and auto-dismiss on their level duration; hover pauses dismissal.vite buildis green and notheme-gitea-*regressions are introduced.Testing checklist (pre-close — do not close on implementation alone)
prefers-reduced-motion: reducedisables slide/fade animation.Out of scope / follow-ups
Authored-by: Moko Consulting
Branch created:
feature/803-feat-ui-expand-brand-toast-notificationsFolded into the consolidated design on #719 (work package WP-D). Toast colors are already theme-aware; the real gaps are the missing
successlevel (add toIntent+levels, exportshowSuccessToast+ test) and a flash→toast bridge (web_src/js/features/flash-toast.tsre-emitting server.flash-messageelements as aria-live toasts, with a no-JS banner fallback). See #719 for the full plan.