Skip to content

Commit 66f4bd6

Browse files
feat: added toasts instead of alerts (#1740)
1 parent 583e33b commit 66f4bd6

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

components/setup/profile-step.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from "@tabler/icons-react"
1313
import { FC, useCallback, useState } from "react"
1414
import { LimitDisplay } from "../ui/limit-display"
15+
import { toast } from "sonner"
1516

1617
interface ProfileStepProps {
1718
username: string
@@ -63,7 +64,7 @@ export const ProfileStep: FC<ProfileStepProps> = ({
6364
const usernameRegex = /^[a-zA-Z0-9_]+$/
6465
if (!usernameRegex.test(username)) {
6566
onUsernameAvailableChange(false)
66-
alert(
67+
toast.error(
6768
"Username must be letters, numbers, or underscores only - no other characters or spacing allowed."
6869
)
6970
return

components/utility/change-password.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
DialogTitle
1313
} from "../ui/dialog"
1414
import { Input } from "../ui/input"
15+
import { toast } from "sonner"
1516

1617
interface ChangePasswordProps {}
1718

@@ -22,11 +23,11 @@ export const ChangePassword: FC<ChangePasswordProps> = () => {
2223
const [confirmPassword, setConfirmPassword] = useState("")
2324

2425
const handleResetPassword = async () => {
25-
if (!newPassword) return alert("Please enter your new password.")
26+
if (!newPassword) return toast.info("Please enter your new password.")
2627

2728
await supabase.auth.updateUser({ password: newPassword })
2829

29-
alert("Password changed successfully.")
30+
toast.success("Password changed successfully.")
3031

3132
return router.push("/login")
3233
}

components/utility/profile-settings.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export const ProfileSettings: FC<ProfileSettingsProps> = ({}) => {
258258
const usernameRegex = /^[a-zA-Z0-9_]+$/
259259
if (!usernameRegex.test(username)) {
260260
setUsernameAvailable(false)
261-
alert(
261+
toast.error(
262262
"Username must be letters, numbers, or underscores only - no other characters or spacing allowed."
263263
)
264264
return

components/workspace/assign-workspaces.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
DropdownMenuTrigger
1010
} from "../ui/dropdown-menu"
1111
import { Input } from "../ui/input"
12+
import { toast } from "sonner"
1213

1314
interface AssignWorkspaces {
1415
selectedWorkspaces: Tables<"workspaces">[]
@@ -135,7 +136,7 @@ const WorkspaceItem: FC<WorkspaceItemProps> = ({
135136
}) => {
136137
const handleSelect = () => {
137138
if (selected && selectedWorkspaces.length === 1) {
138-
alert("You must select at least one workspace")
139+
toast.info("You must select at least one workspace")
139140
return
140141
}
141142

0 commit comments

Comments
 (0)