Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@base-ui/react": "^1.6.0",
"@better-auth/passkey": "^1.5.5",
"@dnd-kit/react": "^0.4.0",
"@polinetwork/backend": "^0.17.0",
"@polinetwork/backend": "^0.17.1",
"@t3-oss/env-core": "^0.13.10",
"@tanstack/react-router": "1.170.17",
"@tanstack/react-start": "1.168.27",
Expand Down
115 changes: 90 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 6 additions & 12 deletions src/features/associations/association-dialogs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ import {
import { Field, FieldDescription, FieldError, FieldGroup, FieldLabel } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
import { Textarea } from "@/components/ui/textarea"
import { getAssociationInitials } from "./associations.constants"
import { ASSOCIATION_LOGO_MAX_SIZE, ASSOCIATION_LOGO_TYPES, getAssociationInitials } from "./associations.constants"
import { createAssociation, deleteAssociation, editAssociation } from "./associations.functions"
import { associationSaveErrorMessage } from "./associations.validation"
import type { Association } from "./types"

export type AssociationDialogState = { mode: "create" } | { mode: "edit"; association: Association }
Expand Down Expand Up @@ -72,9 +73,9 @@ export function AssociationDialog({
if (pending) return
if (
logoFile &&
(!["image/jpeg", "image/png", "image/svg+xml"].includes(logoFile.type) || logoFile.size > 2 * 1024 * 1024)
(!ASSOCIATION_LOGO_TYPES.some((type) => type === logoFile.type) || logoFile.size > ASSOCIATION_LOGO_MAX_SIZE)
) {
setError("Choose a JPG, PNG, or SVG logo no larger than 2 MB.")
setError("Choose a JPG, PNG, or SVG logo no larger than 1 MB.")
return
}

Expand All @@ -92,14 +93,7 @@ export function AssociationDialog({
const saved = editing ? await editAssociationFn({ data }) : await createAssociationFn({ data })
onSaved(saved, dialog.mode)
} catch (cause) {
const message = cause instanceof Error ? cause.message : ""
setError(
message.includes("NOT_FOUND")
? "This association no longer exists."
: message.includes("LOGO")
? "Choose a JPG, PNG, or SVG logo no larger than 2 MB."
: "The association could not be saved. Check the fields and your permissions."
)
setError(associationSaveErrorMessage(cause))
} finally {
setPending(false)
}
Expand Down Expand Up @@ -146,7 +140,7 @@ export function AssociationDialog({
<Button type="button" variant="outline" onClick={() => logoInput.current?.click()}>
<Upload data-icon="inline-start" /> {logoFile ? "Change selected logo" : "Choose logo"}
</Button>
<FieldDescription>Optional JPG, PNG, or SVG, up to 2 MB.</FieldDescription>
<FieldDescription>Optional JPG, PNG, or SVG, up to 1 MB.</FieldDescription>
</Field>
</div>
<Field>
Expand Down
Loading
Loading