Skip to content

Comments

chore: refactor alerts and snackbars#89

Merged
tstirrat15 merged 1 commit intomainfrom
refactor-snackbar-to-sonnet
Dec 10, 2025
Merged

chore: refactor alerts and snackbars#89
tstirrat15 merged 1 commit intomainfrom
refactor-snackbar-to-sonnet

Conversation

@tstirrat15
Copy link
Contributor

Description

Part of getting this project off of material-ui. This refactors snackbars to use sonners and MUI alerts to use ShadCN alerts.

Changes

Will annotate.

Testing

Review. See that the popups and alerts still look good.

@vercel
Copy link

vercel bot commented Dec 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
playground Ready Ready Preview Comment Dec 10, 2025 9:55pm

Copy link
Contributor Author

@tstirrat15 tstirrat15 left a comment

Choose a reason for hiding this comment

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

See comments

);

export function DeveloperErrorDisplay(props: { error: DeveloperError }) {
export function DeveloperErrorDisplay({ error }: { error: DeveloperError }) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did a few of these refactorings.

Comment on lines +71 to +75
<Alert variant="destructive">
<CircleX />
<AlertTitle>{error.message}</AlertTitle>
{error.path.length > 0 && (
<AlertDescription>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the pattern for these alerts - Alert, icon, AlertTitle, AlertDescription.

Comment on lines +78 to +80
{error.path.map((item) => (
<li key={item}>{item}</li>
))}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using item as key here is better.

Comment on lines +99 to +100
{!services.problemService.hasProblems && <span>No problems found</span>}
{services.problemService.invalidRelationships.map(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just flattening props.

<Alert variant={isError ? "destructive" : "default"}>
{isError ? <CircleX /> : <MessageCircleWarning />}
<AlertDescription>
{Object.entries(parsed).map(([key, value]) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Entries is more ergonomic here.

Comment on lines +315 to +316
toast.error("Error sharing", {
description: errorData.error || "Failed to share playground",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're refactoring showAlert to use the toast function from sonner. This is where ShadCN went with this kind of functionality. We can change where we want the toasts to show if we want; currently it's the bottom-right corner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was superseded by the AlertDialog component from Shadcn.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer necessary with Sonner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a relic from the CRA days.

Comment on lines +61 to +62
<>
<Toaster />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just adding the <Toaster /> component and renesting things.

@tstirrat15 tstirrat15 merged commit be603f7 into main Dec 10, 2025
5 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants