-
Notifications
You must be signed in to change notification settings - Fork 5
fix: ui/ux imrovements #573
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
Closed
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9e403dc
fix: ui/ux imrovements
coodos 637ba08
chore: icon name
coodos fc4fa4d
chore: change cancel icon
coodos bcb3903
chore: change cancel icon
coodos db0948c
fix: drawer css error
coodos a0be3ca
fix: make toast account for safe area height
coodos 905cc84
feat: add eye icon back to ePassport card
coodos 0d5313a
fix: drawer
coodos f9ddf9d
feat: change the drawer to page for verirication
coodos 8c96e23
chore: ux improvments to onboarding
coodos 47c2919
chore: fix redirect
coodos 691347c
chore: bump versions
coodos 571daa3
chore: margins
coodos fb5c8e6
fix: inset margins
coodos 625921b
fix: top padding inset on picture pages
coodos feb7828
fix: back buttons
coodos 5485dc6
fix: back button consistency
coodos cc975a5
fix: ux issues
coodos 3c9482a
chore: move user data to stores
coodos a977ab7
fix: selfie page
coodos 09aa717
fixed: claim flow
coodos 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
There are no files selected for viewing
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
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,95 @@ | ||
| <script lang="ts"> | ||
| import { toastStore } from "./toast"; | ||
| import { cn } from "$lib/utils"; | ||
| import { Cancel01Icon } from "@hugeicons/core-free-icons"; | ||
| import { HugeiconsIcon } from "@hugeicons/svelte"; | ||
|
|
||
| let toasts = $state< | ||
| Array<{ | ||
| id: string; | ||
| message: string; | ||
| type?: "success" | "error" | "info"; | ||
| duration?: number; | ||
| }> | ||
| >([]); | ||
|
|
||
| $effect(() => { | ||
| const unsubscribe = toastStore.subscribe((value) => { | ||
| toasts = value; | ||
| }); | ||
| return unsubscribe; | ||
| }); | ||
|
|
||
| function removeToast(id: string) { | ||
| toastStore.remove(id); | ||
| } | ||
|
|
||
| const getToastClasses = (type?: string) => { | ||
| switch (type) { | ||
| case "success": | ||
| return "bg-green-50 border-green-200 text-green-800"; | ||
| case "error": | ||
| return "bg-red-50 border-red-200 text-red-800"; | ||
| case "info": | ||
| default: | ||
| return "bg-blue-50 border-blue-200 text-blue-800"; | ||
| } | ||
| }; | ||
| </script> | ||
|
|
||
| <div | ||
| class="fixed left-1/2 -translate-x-1/2 z-[9999] flex flex-col gap-2 pointer-events-none w-full max-w-md px-4" | ||
| style="top: calc(env(safe-area-inset-top) + 44px);" | ||
| > | ||
| {#each toasts as toast (toast.id)} | ||
| <div | ||
| class={cn( | ||
| "pointer-events-auto flex items-center justify-between gap-3 rounded-lg border p-4 shadow-lg animate-in slide-in-from-top-2 fade-in", | ||
| getToastClasses(toast.type), | ||
| )} | ||
| role="alert" | ||
| > | ||
| <p class="text-sm font-medium flex-1">{toast.message}</p> | ||
| <button | ||
| onclick={() => removeToast(toast.id)} | ||
| class="flex-shrink-0 hover:opacity-70 transition-opacity" | ||
| aria-label="Close toast" | ||
| > | ||
| <HugeiconsIcon | ||
| icon={Cancel01Icon} | ||
| size={20} | ||
| strokeWidth={2} | ||
| className="text-current" | ||
| /> | ||
| </button> | ||
| </div> | ||
| {/each} | ||
| </div> | ||
|
|
||
| <style> | ||
| @keyframes slide-in-from-top-2 { | ||
| from { | ||
| transform: translateY(-100%); | ||
| opacity: 0; | ||
| } | ||
| to { | ||
| transform: translateY(0); | ||
| opacity: 1; | ||
| } | ||
| } | ||
|
|
||
| @keyframes fade-in { | ||
| from { | ||
| opacity: 0; | ||
| } | ||
| to { | ||
| opacity: 1; | ||
| } | ||
| } | ||
|
|
||
| .animate-in { | ||
| animation: | ||
| slide-in-from-top-2 0.3s ease-out, | ||
| fade-in 0.3s ease-out; | ||
| } | ||
| </style> | ||
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,53 @@ | ||
| import { writable } from "svelte/store"; | ||
|
|
||
| export interface Toast { | ||
| id: string; | ||
| message: string; | ||
| type?: "success" | "error" | "info"; | ||
| duration?: number; | ||
| } | ||
|
|
||
| const createToastStore = () => { | ||
| const { subscribe, update } = writable<Toast[]>([]); | ||
|
|
||
| return { | ||
| subscribe, | ||
| add: (toast: Omit<Toast, "id">) => { | ||
| const id = crypto.randomUUID(); | ||
| const newToast: Toast = { | ||
| id, | ||
| duration: 3000, | ||
| ...toast, | ||
| }; | ||
|
|
||
| update((toasts) => [...toasts, newToast]); | ||
|
|
||
| // Auto remove after duration | ||
| if (newToast.duration && newToast.duration > 0) { | ||
| setTimeout(() => { | ||
| remove(id); | ||
| }, newToast.duration); | ||
| } | ||
|
|
||
| return id; | ||
| }, | ||
| remove: (id: string) => { | ||
| update((toasts) => toasts.filter((t) => t.id !== id)); | ||
| }, | ||
| clear: () => { | ||
| update(() => []); | ||
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const toastStore = createToastStore(); | ||
|
|
||
| export const toast = { | ||
| success: (message: string, duration?: number) => | ||
| toastStore.add({ message, type: "success", duration }), | ||
| error: (message: string, duration?: number) => | ||
| toastStore.add({ message, type: "error", duration }), | ||
| info: (message: string, duration?: number) => | ||
| toastStore.add({ message, type: "info", duration }), | ||
| }; | ||
|
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Add exit animations for smoother UX.
The component defines entrance animations (
slide-in-from-top-2,fade-in) but no exit animations. When a toast is removed, it disappears abruptly, which creates a jarring user experience.Consider using Svelte's transition directives for smoother enter/exit animations:
Then you can remove the custom CSS animations and use Svelte's built-in transition system.
🤖 Prompt for AI Agents