-
Notifications
You must be signed in to change notification settings - Fork 40
feat: set up new Preferences page & edit/view drawers (MSQ V2) #5654
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
base: main
Are you sure you want to change the base?
Changes from all commits
101468e
141c318
25a6472
43fb98c
5eac551
0b81d89
1787568
7b2de0a
c58d1e2
375d8e1
ef30979
b5a29d3
dece4d5
79d8048
f10822f
ae1e700
3489879
b68ea77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,12 +10,13 @@ import { reservedCommunityTypeFactoryAll } from './seed-helpers/reserved-communi | |
| const options: { [name: string]: { type: 'string' | 'boolean' } } = { | ||
| environment: { type: 'string' }, | ||
| jurisdictionName: { type: 'string' }, | ||
| msqV2: { type: 'boolean' }, | ||
| }; | ||
|
|
||
| const prisma = new PrismaClient(); | ||
| async function main() { | ||
| const { | ||
| values: { environment, jurisdictionName }, | ||
| values: { environment, jurisdictionName, msqV2 }, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ |
||
| } = parseArgs({ options }); | ||
| switch (environment) { | ||
| case 'production': | ||
|
|
@@ -30,7 +31,7 @@ async function main() { | |
| case 'staging': | ||
| // Staging setup should have realistic looking data with a preset list of listings | ||
| // along with all of the required tables (ami, users, etc) | ||
| stagingSeed(prisma, jurisdictionName as string); | ||
| stagingSeed(prisma, jurisdictionName as string, msqV2 as boolean); | ||
| break; | ||
| case 'development': | ||
| default: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { useState } from "react" | ||
|
|
||
| export type UseMutateOptions = { | ||
| onSuccess?: () => void | ||
| onError?: (err: any) => void | ||
| } | ||
|
|
||
| export const useMutate = <UseMutateResponse>() => { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: with this file here can we switch the usage of the ui-component version over to this version? Looks like the ui-component useMutate is used in a handful of files |
||
| const [data, setData] = useState<UseMutateResponse | undefined>(undefined) | ||
| const [isSuccess, setSuccess] = useState(false) | ||
| const [isLoading, setLoading] = useState(false) | ||
| const [isError, setError] = useState<unknown>(null) | ||
|
|
||
| const mutate = async ( | ||
| mutateFn: (args?: unknown) => Promise<UseMutateResponse>, | ||
| options?: UseMutateOptions | ||
| ) => { | ||
| let response: UseMutateResponse | undefined = undefined | ||
|
|
||
| try { | ||
| setLoading(true) | ||
| response = await mutateFn() | ||
| setData(response) | ||
| setSuccess(true) | ||
| options?.onSuccess?.() | ||
| setLoading(false) | ||
| } catch (err) { | ||
| setSuccess(false) | ||
| setLoading(false) | ||
| setError(err) | ||
| options?.onError?.(err) | ||
| } | ||
|
|
||
| return response | ||
| } | ||
|
|
||
| const reset = () => { | ||
| setData(undefined) | ||
| setSuccess(false) | ||
| setLoading(false) | ||
| setError(null) | ||
| } | ||
|
|
||
| return { | ||
| mutate, | ||
| reset, | ||
| data, | ||
| isSuccess, | ||
| isLoading, | ||
| isError, | ||
| } | ||
| } | ||
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.
nit: the default ordinal should be 1 and not 0. Otherwise these seeded preferences show as ordinal 0