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 {
|
extend type Mutation {
|
||||||
setName(name: String!): Boolean
|
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!,
|
noteAllDescendants: Boolean!, noteMentions: Boolean!, noteDeposits: Boolean!,
|
||||||
noteInvites: Boolean!, noteJobIndicator: Boolean!, hideInvoiceDesc: Boolean!): User
|
noteInvites: Boolean!, noteJobIndicator: Boolean!, hideInvoiceDesc: Boolean!): User
|
||||||
setPhoto(photoId: ID!): Int!
|
setPhoto(photoId: ID!): Int!
|
||||||
@ -58,6 +58,7 @@ export default gql`
|
|||||||
hasNewNotes: Boolean!
|
hasNewNotes: Boolean!
|
||||||
hasInvites: Boolean!
|
hasInvites: Boolean!
|
||||||
tipDefault: Int!
|
tipDefault: Int!
|
||||||
|
fiatCurrency: String
|
||||||
bio: Item
|
bio: Item
|
||||||
bioId: Int
|
bioId: Int
|
||||||
photoId: Int
|
photoId: Int
|
||||||
|
@ -13,6 +13,7 @@ export const ME = gql`
|
|||||||
freeComments
|
freeComments
|
||||||
hasNewNotes
|
hasNewNotes
|
||||||
tipDefault
|
tipDefault
|
||||||
|
fiatCurrency
|
||||||
bioId
|
bioId
|
||||||
hasInvites
|
hasInvites
|
||||||
upvotePopover
|
upvotePopover
|
||||||
@ -39,6 +40,7 @@ export const ME_SSR = gql`
|
|||||||
freePosts
|
freePosts
|
||||||
freeComments
|
freeComments
|
||||||
tipDefault
|
tipDefault
|
||||||
|
fiatCurrency
|
||||||
bioId
|
bioId
|
||||||
upvotePopover
|
upvotePopover
|
||||||
tipPopover
|
tipPopover
|
||||||
@ -57,6 +59,7 @@ export const ME_SSR = gql`
|
|||||||
export const SETTINGS_FIELDS = gql`
|
export const SETTINGS_FIELDS = gql`
|
||||||
fragment SettingsFields on User {
|
fragment SettingsFields on User {
|
||||||
tipDefault
|
tipDefault
|
||||||
|
fiatCurrency
|
||||||
noteItemSats
|
noteItemSats
|
||||||
noteEarning
|
noteEarning
|
||||||
noteAllDescendants
|
noteAllDescendants
|
||||||
|
@ -54,6 +54,7 @@ export default function Settings ({ data: { settings } }) {
|
|||||||
<Form
|
<Form
|
||||||
initial={{
|
initial={{
|
||||||
tipDefault: settings?.tipDefault || 21,
|
tipDefault: settings?.tipDefault || 21,
|
||||||
|
fiatCurrency: settings?.fiatCurrency || 'USD',
|
||||||
noteItemSats: settings?.noteItemSats,
|
noteItemSats: settings?.noteItemSats,
|
||||||
noteEarning: settings?.noteEarning,
|
noteEarning: settings?.noteEarning,
|
||||||
noteAllDescendants: settings?.noteAllDescendants,
|
noteAllDescendants: settings?.noteAllDescendants,
|
||||||
@ -64,8 +65,8 @@ export default function Settings ({ data: { settings } }) {
|
|||||||
hideInvoiceDesc: settings?.hideInvoiceDesc
|
hideInvoiceDesc: settings?.hideInvoiceDesc
|
||||||
}}
|
}}
|
||||||
schema={SettingsSchema}
|
schema={SettingsSchema}
|
||||||
onSubmit={async ({ tipDefault, ...values }) => {
|
onSubmit={async ({ tipDefault, fiatCurrency, ...values }) => {
|
||||||
await setSettings({ variables: { tipDefault: Number(tipDefault), ...values } })
|
await setSettings({ variables: { tipDefault: Number(tipDefault), fiatCurrency, ...values } })
|
||||||
setSuccess('settings saved')
|
setSuccess('settings saved')
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -77,6 +78,10 @@ export default function Settings ({ data: { settings } }) {
|
|||||||
autoFocus
|
autoFocus
|
||||||
append={<InputGroup.Text className='text-monospace'>sats</InputGroup.Text>}
|
append={<InputGroup.Text className='text-monospace'>sats</InputGroup.Text>}
|
||||||
/>
|
/>
|
||||||
|
<Input
|
||||||
|
label='fiat currency'
|
||||||
|
name='fiatCurrency'
|
||||||
|
/>
|
||||||
<div className='form-label'>notify me when ...</div>
|
<div className='form-label'>notify me when ...</div>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label='I stack sats from posts and comments'
|
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)
|
freePosts Int @default(0)
|
||||||
checkedNotesAt DateTime?
|
checkedNotesAt DateTime?
|
||||||
tipDefault Int @default(10)
|
tipDefault Int @default(10)
|
||||||
|
fiatCurrency String @default("USD")
|
||||||
pubkey String? @unique
|
pubkey String? @unique
|
||||||
trust Float @default(0)
|
trust Float @default(0)
|
||||||
upvoteTrust Float @default(0)
|
upvoteTrust Float @default(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user