fix image uploading/edit

This commit is contained in:
keyan 2023-08-13 14:12:18 -05:00
parent 9727fb4838
commit 03f0329984
3 changed files with 20 additions and 18 deletions

View File

@ -9,13 +9,14 @@ import { useShowModal } from './modal'
export default function Avatar ({ onSuccess }) {
const [uploading, setUploading] = useState()
const ref = useRef()
const [scale, setScale] = useState(1)
const showModal = useShowModal()
const Body = ({ onClose, file, upload }) => {
const [scale, setScale] = useState(1)
const ref = useRef()
return (
<div className='text-right mt-1 p-4'>
<div className='text-end mt-1 p-4'>
<AvatarEditor
ref={ref} width={200} height={200}
image={file}
@ -26,13 +27,14 @@ export default function Avatar ({ onSuccess }) {
}}
/>
<BootstrapForm.Group controlId='formBasicRange'>
<BootstrapForm.Control
type='range' onChange={e => setScale(parseFloat(e.target.value))}
<BootstrapForm.Range
onChange={e => setScale(parseFloat(e.target.value))}
min={1} max={2} step='0.05'
defaultValue={scale}
// defaultValue={scale}
/>
</BootstrapForm.Group>
<Button onClick={() => {
<Button
onClick={() => {
ref.current.getImageScaledToCanvas().toBlob(blob => {
if (blob) {
upload(blob)

View File

@ -80,7 +80,7 @@ export default function JobForm ({ item, sub }) {
} else {
await router.push(`/~${sub.name}/recent`)
}
}, [upsertJob, router])
}, [upsertJob, router, item?.id, sub?.name, logoId])
const invoiceableUpsertJob = useInvoiceable(submitUpsertJob, { requireSession: true })

View File

@ -52,7 +52,7 @@ export default function Settings ({ ssrData }) {
return (
<CenterLayout>
<div className='py-3 w-100'>
<h2 className='mb-2 text-left'>settings</h2>
<h2 className='mb-2 text-start'>settings</h2>
<Form
initial={{
tipDefault: settings?.tipDefault || 21,
@ -248,7 +248,7 @@ export default function Settings ({ ssrData }) {
<AccordianItem
headerColor='var(--bs-body-color)'
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={
<>
<Input
@ -270,7 +270,7 @@ export default function Settings ({ ssrData }) {
<SubmitButton variant='info' className='ms-auto mt-1 px-4'>save</SubmitButton>
</div>
</Form>
<div className='text-left w-100'>
<div className='text-start w-100'>
<div className='form-label'>saturday newsletter</div>
<Button href='https://mail.stacker.news/subscription/form' target='_blank'>(re)subscribe</Button>
{settings?.authMethods && <AuthMethods methods={settings.authMethods} />}