Skip to content

Add toast notification component with JS init, template, examples, migration, and tests - #1360

Merged
lovasoa merged 8 commits into
mainfrom
ajouter-un-composant-toast-olb490
Aug 3, 2026
Merged

Add toast notification component with JS init, template, examples, migration, and tests#1360
lovasoa merged 8 commits into
mainfrom
ajouter-un-composant-toast-olb490

Conversation

@lovasoa

@lovasoa lovasoa commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

addresses #1358

small.mp4

Motivation

  • Provide a lightweight, accessible notification UI that can show transient confirmations and queued notifications without occupying page content.
  • Replace transient inline alert usages with a dedicated toast component that supports auto-dismiss, manual dismissal, positions, icons, colors, Markdown, and URL-fragment triggers.

Description

  • Introduce a new toast Handlebars template (sqlpage/templates/toast.handlebars) that supports title, description, description_md, icon, color, dismissible, duration, position, trigger, id, and class properties.
  • Add client-side logic in sqlpage/sqlpage.js to initialize toasts, create per-position containers, manage stacking and automatic/manual dismissal, and open toasts via URL fragment triggers with open_toasts_for_hash and sqlpage_toast initialization hooks.
  • Add a migration (examples/official-site/sqlpage/migrations/76_toast.sql) that registers the toast component, its parameters, and multiple examples in the component registry.
  • Update example pages to use toast instead of transient alert entries and add a component rendering test file at tests/sql_test_files/component_rendering/toast.sql.
  • Update the changelog (CHANGELOG.md) to document the new toast component.

Testing

  • Added an end-to-end Playwright test tests/end-to-end/official-site.spec.ts that verifies initialization, stacking, dismiss behavior, Markdown rendering, fragment-trigger behavior, and positioning of toasts, and the new test passed in the test run.
  • Added a SQL component rendering test file tests/sql_test_files/component_rendering/toast.sql to validate server-side output for various toast configurations and it passed in automated checks.
  • Ran the existing UI test suite (including chart, map, and form examples) with the new toast tests and all automated tests succeeded.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f551bc483

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sqlpage/sqlpage.js Outdated
Comment thread sqlpage/sqlpage.js Outdated
Comment thread sqlpage/templates/toast.handlebars Outdated
Comment thread sqlpage/templates/toast.handlebars
Comment thread sqlpage/sqlpage.js
Comment thread sqlpage/sqlpage.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 500e2f39e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sqlpage/sqlpage.js Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 93c9f08843

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sqlpage/templates/toast.handlebars Outdated
@lovasoa
lovasoa force-pushed the ajouter-un-composant-toast-olb490 branch from 276b968 to 6cbb525 Compare August 3, 2026 10:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b29821716d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<div
{{~#if id}} id="{{id}}"{{/if}}
{{~#if trigger}} data-toast-trigger="{{trigger}}"{{/if}} class="toast
{{~#if color}} toast-colored bg-{{color}} text-{{#if (eq color 'white')}}light{{else}}{{color}}{{/if}}-fg{{/if}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add an explicit mapping for the gray toast color

When color = 'gray'—a color listed in examples/official-site/colors.sql—this emits bg-gray text-gray-fg, but neither the bundled Tabler 1.4 stylesheet nor sqlpage.css defines those utilities. The toast consequently retains its neutral background instead of rendering gray; map gray to an available gray shade, define the missing utilities, or explicitly exclude it from the documented toast colors.

Useful? React with 👍 / 👎.

@lovasoa
lovasoa merged commit 7457370 into main Aug 3, 2026
51 checks passed
@lovasoa
lovasoa deleted the ajouter-un-composant-toast-olb490 branch August 3, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant