fix image uploading/edit
This commit is contained in:
parent
9727fb4838
commit
03f0329984
|
@ -9,13 +9,14 @@ import { useShowModal } from './modal'
|
||||||
|
|
||||||
export default function Avatar ({ onSuccess }) {
|
export default function Avatar ({ onSuccess }) {
|
||||||
const [uploading, setUploading] = useState()
|
const [uploading, setUploading] = useState()
|
||||||
const ref = useRef()
|
|
||||||
const [scale, setScale] = useState(1)
|
|
||||||
const showModal = useShowModal()
|
const showModal = useShowModal()
|
||||||
|
|
||||||
const Body = ({ onClose, file, upload }) => {
|
const Body = ({ onClose, file, upload }) => {
|
||||||
|
const [scale, setScale] = useState(1)
|
||||||
|
const ref = useRef()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='text-right mt-1 p-4'>
|
<div className='text-end mt-1 p-4'>
|
||||||
<AvatarEditor
|
<AvatarEditor
|
||||||
ref={ref} width={200} height={200}
|
ref={ref} width={200} height={200}
|
||||||
image={file}
|
image={file}
|
||||||
|
@ -26,20 +27,21 @@ export default function Avatar ({ onSuccess }) {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<BootstrapForm.Group controlId='formBasicRange'>
|
<BootstrapForm.Group controlId='formBasicRange'>
|
||||||
<BootstrapForm.Control
|
<BootstrapForm.Range
|
||||||
type='range' onChange={e => setScale(parseFloat(e.target.value))}
|
onChange={e => setScale(parseFloat(e.target.value))}
|
||||||
min={1} max={2} step='0.05'
|
min={1} max={2} step='0.05'
|
||||||
defaultValue={scale}
|
// defaultValue={scale}
|
||||||
/>
|
/>
|
||||||
</BootstrapForm.Group>
|
</BootstrapForm.Group>
|
||||||
<Button onClick={() => {
|
<Button
|
||||||
ref.current.getImageScaledToCanvas().toBlob(blob => {
|
onClick={() => {
|
||||||
if (blob) {
|
ref.current.getImageScaledToCanvas().toBlob(blob => {
|
||||||
upload(blob)
|
if (blob) {
|
||||||
onClose()
|
upload(blob)
|
||||||
}
|
onClose()
|
||||||
}, 'image/jpeg')
|
}
|
||||||
}}
|
}, 'image/jpeg')
|
||||||
|
}}
|
||||||
>save
|
>save
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -80,7 +80,7 @@ export default function JobForm ({ item, sub }) {
|
||||||
} else {
|
} else {
|
||||||
await router.push(`/~${sub.name}/recent`)
|
await router.push(`/~${sub.name}/recent`)
|
||||||
}
|
}
|
||||||
}, [upsertJob, router])
|
}, [upsertJob, router, item?.id, sub?.name, logoId])
|
||||||
|
|
||||||
const invoiceableUpsertJob = useInvoiceable(submitUpsertJob, { requireSession: true })
|
const invoiceableUpsertJob = useInvoiceable(submitUpsertJob, { requireSession: true })
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ export default function Settings ({ ssrData }) {
|
||||||
return (
|
return (
|
||||||
<CenterLayout>
|
<CenterLayout>
|
||||||
<div className='py-3 w-100'>
|
<div className='py-3 w-100'>
|
||||||
<h2 className='mb-2 text-left'>settings</h2>
|
<h2 className='mb-2 text-start'>settings</h2>
|
||||||
<Form
|
<Form
|
||||||
initial={{
|
initial={{
|
||||||
tipDefault: settings?.tipDefault || 21,
|
tipDefault: settings?.tipDefault || 21,
|
||||||
|
@ -248,7 +248,7 @@ export default function Settings ({ ssrData }) {
|
||||||
<AccordianItem
|
<AccordianItem
|
||||||
headerColor='var(--bs-body-color)'
|
headerColor='var(--bs-body-color)'
|
||||||
show={settings?.nostrPubkey}
|
show={settings?.nostrPubkey}
|
||||||
header={<h4 className='text-left'>nostr <small><a href='https://github.com/nostr-protocol/nips/blob/master/05.md' target='_blank' rel='noreferrer'>NIP-05</a></small></h4>}
|
header={<h4 className='text-start'>nostr <small><a href='https://github.com/nostr-protocol/nips/blob/master/05.md' target='_blank' rel='noreferrer'>NIP-05</a></small></h4>}
|
||||||
body={
|
body={
|
||||||
<>
|
<>
|
||||||
<Input
|
<Input
|
||||||
|
@ -270,7 +270,7 @@ export default function Settings ({ ssrData }) {
|
||||||
<SubmitButton variant='info' className='ms-auto mt-1 px-4'>save</SubmitButton>
|
<SubmitButton variant='info' className='ms-auto mt-1 px-4'>save</SubmitButton>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
<div className='text-left w-100'>
|
<div className='text-start w-100'>
|
||||||
<div className='form-label'>saturday newsletter</div>
|
<div className='form-label'>saturday newsletter</div>
|
||||||
<Button href='https://mail.stacker.news/subscription/form' target='_blank'>(re)subscribe</Button>
|
<Button href='https://mail.stacker.news/subscription/form' target='_blank'>(re)subscribe</Button>
|
||||||
{settings?.authMethods && <AuthMethods methods={settings.authMethods} />}
|
{settings?.authMethods && <AuthMethods methods={settings.authMethods} />}
|
||||||
|
|
Loading…
Reference in New Issue