import { Checkbox, Form, Input, SubmitButton } from '../components/form' import * as Yup from 'yup' import { Alert, Button, InputGroup } from 'react-bootstrap' import { useMe } from '../components/me' import LayoutCenter from '../components/layout-center' import { useState } from 'react' import { gql, useMutation } from '@apollo/client' import { getGetServerSideProps } from '../api/ssrApollo' export const getServerSideProps = getGetServerSideProps() export const SettingsSchema = Yup.object({ tipDefault: Yup.number().typeError('must be a number').required('required') .positive('must be positive').integer('must be whole') }) export default function Settings () { const me = useMe() const [success, setSuccess] = useState() const [setSettings] = useMutation( gql` mutation setSettings($tipDefault: Int!, $noteItemSats: Boolean!, $noteEarning: Boolean!, $noteAllDescendants: Boolean!, $noteMentions: Boolean!, $noteDeposits: Boolean!, $noteInvites: Boolean!, $noteJobIndicator: Boolean!) { setSettings(tipDefault: $tipDefault, noteItemSats: $noteItemSats, noteEarning: $noteEarning, noteAllDescendants: $noteAllDescendants, noteMentions: $noteMentions, noteDeposits: $noteDeposits, noteInvites: $noteInvites, noteJobIndicator: $noteJobIndicator) }` ) return (

settings

{ await setSettings({ variables: { tipDefault: Number(tipDefault), ...values } }) setSuccess('settings saved') }} > {success && setSuccess(undefined)} dismissible>{success}} sats} />
notify me when ...
saturday newsletter
save
) }