Repository navigation
fix(ui): Post-merge test fixes for accessibility and async handling #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
618edd4
fix(ui): post-merge test fixes - accessibility and async handling
860648e
refactor(ui): consolidate duplicate UI patterns
430d6b7
feat(ui): add Notebook Runtime dashboard page
07038f8
fix(ui): avoid template literals for Turbopack compatibility
842a99b
fix(ui): address CodeRabbit PR review comments
9caa6dc
fix(ui): add defensive Array.isArray checks to prevent map/reduce errors
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Submodule PMOVES-DoX
updated
161 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* ═══════════════════════════════════════════════════════════════════════════ | ||
| Alert Banner Component | ||
| Reusable alert/notification banner with variants and dismiss functionality | ||
| ═══════════════════════════════════════════════════════════════════════════ */ | ||
|
|
||
| import type { HTMLAttributes } from "react"; | ||
|
|
||
| export interface AlertBannerProps extends HTMLAttributes<HTMLDivElement> { | ||
| /** The message to display */ | ||
| message: string; | ||
| /** Visual style variant */ | ||
| variant?: "error" | "warning" | "success" | "info"; | ||
| /** Optional dismiss callback */ | ||
| onDismiss?: () => void; | ||
| } | ||
|
|
||
| const VARIANT_CLASSES: Record<NonNullable<AlertBannerProps["variant"]>, string> = { | ||
| error: "bg-red-50 border-red-300 text-red-800", | ||
| warning: "bg-amber-50 border-amber-300 text-amber-800", | ||
| success: "bg-green-50 border-green-300 text-green-800", | ||
| info: "bg-blue-50 border-blue-300 text-blue-800", | ||
| }; | ||
|
|
||
| /** | ||
| * Reusable alert banner component for displaying notifications and errors. | ||
| * Supports multiple visual variants and an optional dismiss button. | ||
| * | ||
| * @example | ||
| * // Error with dismiss | ||
| * <AlertBanner message="Something went wrong" variant="error" onDismiss={() => setError(null)} /> | ||
| * | ||
| * @example | ||
| * // Success without dismiss | ||
| * <AlertBanner message="Operation completed" variant="success" /> | ||
| */ | ||
| export function AlertBanner({ | ||
| message, | ||
| variant = "error", | ||
| onDismiss, | ||
| className, | ||
| ...props | ||
| }: AlertBannerProps) { | ||
| const baseClasses = "rounded border p-4 text-sm flex items-center justify-between"; | ||
| const variantClasses = VARIANT_CLASSES[variant]; | ||
|
|
||
| return ( | ||
| <div | ||
| className={`${baseClasses} ${variantClasses} ${className || ""}`} | ||
| role="alert" | ||
| aria-live="assertive" | ||
| {...props} | ||
| > | ||
| <span>{message}</span> | ||
| {onDismiss && ( | ||
| <button | ||
| onClick={onDismiss} | ||
| className="ml-4 hover:opacity-70 transition-opacity" | ||
| aria-label="Dismiss notification" | ||
| > | ||
| × | ||
| </button> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| /* ═══════════════════════════════════════════════════════════════════════════ | ||
| Confirmation Dialog Component | ||
| Reusable modal for confirming destructive or critical actions | ||
| ═══════════════════════════════════════════════════════════════════════════ */ | ||
|
|
||
| export interface ConfirmDialogProps { | ||
| /** Whether the dialog is visible */ | ||
| isOpen: boolean; | ||
| /** Title displayed at the top of the dialog */ | ||
| title: string; | ||
| /** Message explaining the action to be confirmed */ | ||
| message: string; | ||
| /** Text for the confirm button (default: "Confirm") */ | ||
| confirmLabel?: string; | ||
| /** Text for the cancel button (default: "Cancel") */ | ||
| cancelLabel?: string; | ||
| /** Called when user confirms */ | ||
| onConfirm: () => void; | ||
| /** Called when user cancels or closes */ | ||
| onCancel: () => void; | ||
| /** Visual style for the confirm button */ | ||
| variant?: "danger" | "warning" | "info"; | ||
| } | ||
|
|
||
| const VARIANT_CLASSES: Record< | ||
| NonNullable<ConfirmDialogProps["variant"]>, | ||
| string | ||
| > = { | ||
| danger: "bg-red-600 hover:bg-red-700 focus:ring-red-500", | ||
| warning: "bg-amber-600 hover:bg-amber-700 focus:ring-amber-500", | ||
| info: "bg-blue-600 hover:bg-blue-700 focus:ring-blue-500", | ||
| }; | ||
|
|
||
| /** | ||
| * Reusable confirmation modal for critical actions. | ||
| * Replaces the native confirm() with a customizable React component. | ||
| * | ||
| * @example | ||
| * // Dangerous action deletion | ||
| * <ConfirmDialog | ||
| * isOpen={showDialog} | ||
| * title="Delete Rule" | ||
| * message="Are you sure you want to delete this rule? This action cannot be undone." | ||
| * variant="danger" | ||
| * onConfirm={() => handleDelete()} | ||
| * onCancel={() => setShowDialog(false)} | ||
| * /> | ||
| */ | ||
| export function ConfirmDialog({ | ||
| isOpen, | ||
| title, | ||
| message, | ||
| confirmLabel = "Confirm", | ||
| cancelLabel = "Cancel", | ||
| onConfirm, | ||
| onCancel, | ||
| variant = "danger", | ||
| }: ConfirmDialogProps) { | ||
| if (!isOpen) return null; | ||
|
|
||
| const handleConfirm = () => { | ||
| onConfirm(); | ||
| }; | ||
|
|
||
| return ( | ||
| <div | ||
| className="fixed inset-0 z-50 flex items-center justify-center" | ||
| role="dialog" | ||
| aria-modal="true" | ||
| aria-labelledby="confirm-dialog-title" | ||
| aria-describedby="confirm-dialog-message" | ||
| > | ||
| {/* Backdrop */} | ||
| <div | ||
| className="fixed inset-0 bg-black/50 transition-opacity" | ||
| onClick={onCancel} | ||
| aria-hidden="true" | ||
| /> | ||
|
|
||
| {/* Dialog */} | ||
| <div className="relative z-10 bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6"> | ||
| <h3 | ||
| id="confirm-dialog-title" | ||
| className="text-lg font-medium text-neutral-900 mb-2" | ||
| > | ||
| {title} | ||
| </h3> | ||
| <p | ||
| id="confirm-dialog-message" | ||
| className="text-sm text-neutral-600 mb-6" | ||
| > | ||
| {message} | ||
| </p> | ||
|
|
||
| <div className="flex justify-end gap-3"> | ||
| <button | ||
| type="button" | ||
| onClick={onCancel} | ||
| className="px-4 py-2 rounded border border-neutral-300 text-neutral-700 hover:bg-neutral-50 focus:outline-none focus:ring-2 focus:ring-neutral-300 focus:ring-offset-2" | ||
| > | ||
| {cancelLabel} | ||
| </button> | ||
| <button | ||
| type="button" | ||
| onClick={handleConfirm} | ||
| className={`px-4 py-2 rounded text-white focus:outline-none focus:ring-2 focus:ring-offset-2 ${VARIANT_CLASSES[variant]}`} | ||
| > | ||
| {confirmLabel} | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /* ═══════════════════════════════════════════════════════════════════════════ | ||
| Common Components Barrel Export | ||
| Shared UI components used across the application | ||
| ═══════════════════════════════════════════════════════════════════════════ */ | ||
|
|
||
| export { AlertBanner } from "./AlertBanner"; | ||
| export type { AlertBannerProps } from "./AlertBanner"; | ||
|
|
||
| export { ConfirmDialog } from "./ConfirmDialog"; | ||
| export type { ConfirmDialogProps } from "./ConfirmDialog"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.