Chore/change window.alert to shadcn alert#236
Open
IamKirbki wants to merge 8 commits into
Open
Conversation
Add timezone.Resolve() to normalize arbitrary timezone strings (IANA, GMT/UTC offsets, abbreviations) to canonical IANA names. Apply at CSV import and API upsert/update endpoints.
…ation and update functions
There was a problem hiding this comment.
Pull request overview
This PR replaces a native window.alert usage in the Console with a shadcn/Radix AlertDialog, and also introduces timezone normalization for user CSV imports (plus related docs/templates/UI updates).
Changes:
- Replace
window.alert(...)on project save failure with a shadcn/RadixAlertDialog. - Add a Go timezone resolver and auto-convert imported user
timezonevalues (abbreviations and GMT/UTC offsets) to IANA names. - Update Console user-create timezone input to a searchable picker and refresh CSV/docs examples to reflect the new timezone behavior.
Reviewed changes
Copilot reviewed 14 out of 18 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/pkg/timezone/resolver.go | Adds timezone resolution logic for abbreviations and offsets. |
| internal/pkg/timezone/resolver_test.go | Adds unit tests for timezone resolution. |
| internal/importer/users.go | Converts imported timezone values via the new resolver. |
| internal/importer/users_test.go | Adds importer tests for timezone conversion/passthrough. |
| internal/http/controllers/v1/management/test/users/valid.csv | Updates embedded test CSV timezone values. |
| internal/http/controllers/v1/management/test/users/out-of-order.csv | Updates embedded test CSV timezone values. |
| go.mod | Adds go-timezone dependency (currently marked indirect). |
| go.sum | Adds checksums for go-timezone. |
| docs/content/docs/users.mdx | Documents timezone auto-conversion for user imports. |
| docs/content/docs/lists.mdx | Documents timezone auto-conversion for list imports. |
| console/src/views/users/Users.tsx | Replaces freeform timezone input with searchable picker for create-user dialog. |
| console/src/views/project/ProjectForm.tsx | Replaces window.alert with AlertDialog on save failure. |
| console/src/components/ui/alert-dialog.tsx | Adds shadcn-style AlertDialog wrapper component. |
| console/public/templates/users.csv | Updates the downloadable “template” CSV with example rows. |
| console/package.json | Adds @radix-ui/react-alert-dialog. |
| console/pnpm-lock.yaml | Locks the new Radix dependency (and associated lock changes). |
Files not reviewed (1)
- console/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+19
to
+25
| "timezone": func(u *subjects.UpsertUserParams, v string) { | ||
| if resolved, err := timezone.Resolve(v); err == nil { | ||
| u.Timezone = &resolved | ||
| } else { | ||
| u.Timezone = &v | ||
| } | ||
| }, |
| github.com/timonwong/loggercheck v0.10.1 // indirect | ||
| github.com/tklauser/go-sysconf v0.3.13 // indirect | ||
| github.com/tklauser/numcpus v0.7.0 // indirect | ||
| github.com/tkuchiki/go-timezone v0.2.3 // indirect |
Comment on lines
+15
to
+38
| 0: "Europe/London", | ||
| 3600: "Europe/Paris", | ||
| 7200: "Europe/Amsterdam", | ||
| 10800: "Europe/Moscow", | ||
| 14400: "Asia/Dubai", | ||
| 18000: "Asia/Karachi", | ||
| 21600: "Asia/Dhaka", | ||
| 25200: "Asia/Bangkok", | ||
| 28800: "Asia/Shanghai", | ||
| 32400: "Asia/Tokyo", | ||
| 36000: "Australia/Sydney", | ||
| 39600: "Pacific/Noumea", | ||
| 43200: "Pacific/Auckland", | ||
| -3600: "Atlantic/Azores", | ||
| -7200: "Etc/GMT+2", | ||
| -10800: "America/Sao_Paulo", | ||
| -14400: "America/Halifax", | ||
| -18000: "America/New_York", | ||
| -21600: "America/Chicago", | ||
| -25200: "America/Denver", | ||
| -28800: "America/Los_Angeles", | ||
| -32400: "America/Anchorage", | ||
| -36000: "Pacific/Honolulu", | ||
| -39600: "Pacific/Pago_Pago", |
Comment on lines
+271
to
+274
| resolved to IANA timezone names. Abbreviations like `EST`, `PST`, `CET` and | ||
| GMT/UTC offsets like `GMT-5` or `+02:00` are converted to their IANA equivalents | ||
| (e.g., `America/New_York`, `America/Los_Angeles`). IANA names like | ||
| `America/New_York` are used as-is. |
Comment on lines
+142
to
+145
| resolved to IANA timezone names. Abbreviations like `EST`, `PST`, `CET` and | ||
| GMT/UTC offsets like `GMT-5` or `+02:00` are converted to their IANA equivalents | ||
| (e.g., `America/New_York`, `America/Los_Angeles`). IANA names like | ||
| `America/New_York` are used as-is. |
Comment on lines
+108
to
+112
| <AlertDialog open={!!saveError} onOpenChange={() => setSaveError(null)}> | ||
| <FormProvider {...form}> | ||
| <form onSubmit={handleSubmit} className="space-y-6"> | ||
| {isEditing ? ( | ||
| <> |
Comment on lines
+463
to
+472
| <Label>{t("timezone")}</Label> | ||
| <Popover open={isNewUserTimezoneOpen} onOpenChange={setIsNewUserTimezoneOpen}> | ||
| <PopoverTrigger asChild> | ||
| <Button | ||
| variant="outline" | ||
| role="combobox" | ||
| className="justify-between" | ||
| > | ||
| {newUserTimezone || t("select_timezone", "Select timezone")} | ||
| </Button> |
Comment on lines
+481
to
+483
| <CommandGroup> | ||
| {Intl.supportedValuesOf("timeZone").map((tz) => ( | ||
| <CommandItem |
Comment on lines
+1
to
+11
| external_id,email,phone,timezone,locale | ||
| user-1,user1@example.com,+1234567890,Europe/Amsterdam,en | ||
| user-2,user2@example.com,+1234567891,America/New_York,en | ||
| user-3,user3@example.com,+1234567892,GMT+2,en | ||
| user-4,user4@example.com,+1234567893,GMT-5,en | ||
| user-5,user5@example.com,+1234567894,UTC+8,en | ||
| user-6,user6@example.com,+1234567895,EST,en | ||
| user-7,user7@example.com,+1234567896,PST,en | ||
| user-8,user8@example.com,+1234567897,CET,en | ||
| user-9,user9@example.com,+1234567898,IST,en | ||
| user-10,user10@example.com,+1234567899,Asia/Tokyo,en No newline at end of file |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes: #168