Add input for fiat currency in settings
This commit is contained in:
parent
5fb310db5f
commit
5d4abecf3c
|
@ -29,7 +29,7 @@ export default gql`
|
|||
|
||||
extend type Mutation {
|
||||
setName(name: String!): Boolean
|
||||
setSettings(tipDefault: Int!, noteItemSats: Boolean!, noteEarning: Boolean!,
|
||||
setSettings(tipDefault: Int!, fiatCurrency: String!, noteItemSats: Boolean!, noteEarning: Boolean!,
|
||||
noteAllDescendants: Boolean!, noteMentions: Boolean!, noteDeposits: Boolean!,
|
||||
noteInvites: Boolean!, noteJobIndicator: Boolean!, hideInvoiceDesc: Boolean!): User
|
||||
setPhoto(photoId: ID!): Int!
|
||||
|
@ -58,6 +58,7 @@ export default gql`
|
|||
hasNewNotes: Boolean!
|
||||
hasInvites: Boolean!
|
||||
tipDefault: Int!
|
||||
fiatCurrency: String
|
||||
bio: Item
|
||||
bioId: Int
|
||||
photoId: Int
|
||||
|
|
|
@ -13,6 +13,7 @@ export const ME = gql`
|
|||
freeComments
|
||||
hasNewNotes
|
||||
tipDefault
|
||||
fiatCurrency
|
||||
bioId
|
||||
hasInvites
|
||||
upvotePopover
|
||||
|
@ -39,6 +40,7 @@ export const ME_SSR = gql`
|
|||
freePosts
|
||||
freeComments
|
||||
tipDefault
|
||||
fiatCurrency
|
||||
bioId
|
||||
upvotePopover
|
||||
tipPopover
|
||||
|
@ -57,6 +59,7 @@ export const ME_SSR = gql`
|
|||
export const SETTINGS_FIELDS = gql`
|
||||
fragment SettingsFields on User {
|
||||
tipDefault
|
||||
fiatCurrency
|
||||
noteItemSats
|
||||
noteEarning
|
||||
noteAllDescendants
|
||||
|
|
|
@ -54,6 +54,7 @@ export default function Settings ({ data: { settings } }) {
|
|||
<Form
|
||||
initial={{
|
||||
tipDefault: settings?.tipDefault || 21,
|
||||
fiatCurrency: settings?.fiatCurrency || 'USD',
|
||||
noteItemSats: settings?.noteItemSats,
|
||||
noteEarning: settings?.noteEarning,
|
||||
noteAllDescendants: settings?.noteAllDescendants,
|
||||
|
@ -64,8 +65,8 @@ export default function Settings ({ data: { settings } }) {
|
|||
hideInvoiceDesc: settings?.hideInvoiceDesc
|
||||
}}
|
||||
schema={SettingsSchema}
|
||||
onSubmit={async ({ tipDefault, ...values }) => {
|
||||
await setSettings({ variables: { tipDefault: Number(tipDefault), ...values } })
|
||||
onSubmit={async ({ tipDefault, fiatCurrency, ...values }) => {
|
||||
await setSettings({ variables: { tipDefault: Number(tipDefault), fiatCurrency, ...values } })
|
||||
setSuccess('settings saved')
|
||||
}}
|
||||
>
|
||||
|
@ -77,6 +78,10 @@ export default function Settings ({ data: { settings } }) {
|
|||
autoFocus
|
||||
append={<InputGroup.Text className='text-monospace'>sats</InputGroup.Text>}
|
||||
/>
|
||||
<Input
|
||||
label='fiat currency'
|
||||
name='fiatCurrency'
|
||||
/>
|
||||
<div className='form-label'>notify me when ...</div>
|
||||
<Checkbox
|
||||
label='I stack sats from posts and comments'
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "users" ADD COLUMN "fiatCurrency" TEXT NOT NULL DEFAULT 'USD';
|
|
@ -36,6 +36,7 @@ model User {
|
|||
freePosts Int @default(0)
|
||||
checkedNotesAt DateTime?
|
||||
tipDefault Int @default(10)
|
||||
fiatCurrency String @default("USD")
|
||||
pubkey String? @unique
|
||||
trust Float @default(0)
|
||||
upvoteTrust Float @default(0)
|
||||
|
|
Loading…
Reference in New Issue