mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-10-04 16:37:00 +02:00
remove redundant image upload button
This commit is contained in:
@@ -52,7 +52,6 @@ export const PostModal = ({ isOpen, onClose, initialDraft }: PostModalProps) =>
|
|||||||
const { isOpen: showPreview, onToggle: togglePreview } = useDisclosure();
|
const { isOpen: showPreview, onToggle: togglePreview } = useDisclosure();
|
||||||
const [draft, setDraft] = useState<DraftNostrEvent>(() => Object.assign(emptyDraft(), initialDraft));
|
const [draft, setDraft] = useState<DraftNostrEvent>(() => Object.assign(emptyDraft(), initialDraft));
|
||||||
const imageUploadRef = useRef<HTMLInputElement | null>(null);
|
const imageUploadRef = useRef<HTMLInputElement | null>(null);
|
||||||
const imageCaptureRef = useRef<HTMLInputElement | null>(null);
|
|
||||||
const [uploading, setUploading] = useState(false);
|
const [uploading, setUploading] = useState(false);
|
||||||
|
|
||||||
const uploadImage = async (imageFile: File) => {
|
const uploadImage = async (imageFile: File) => {
|
||||||
@@ -142,16 +141,6 @@ export const PostModal = ({ isOpen, onClose, initialDraft }: PostModalProps) =>
|
|||||||
if (img) uploadImage(img);
|
if (img) uploadImage(img);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<VisuallyHiddenInput
|
|
||||||
type="file"
|
|
||||||
accept="image/*"
|
|
||||||
ref={imageCaptureRef}
|
|
||||||
capture="environment"
|
|
||||||
onChange={(e) => {
|
|
||||||
const img = e.target.files?.[0];
|
|
||||||
if (img) uploadImage(img);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={<ImageIcon />}
|
icon={<ImageIcon />}
|
||||||
aria-label="Upload Image"
|
aria-label="Upload Image"
|
||||||
@@ -159,15 +148,6 @@ export const PostModal = ({ isOpen, onClose, initialDraft }: PostModalProps) =>
|
|||||||
onClick={() => imageUploadRef.current?.click()}
|
onClick={() => imageUploadRef.current?.click()}
|
||||||
isLoading={uploading}
|
isLoading={uploading}
|
||||||
/>
|
/>
|
||||||
{isMobile && (
|
|
||||||
<IconButton
|
|
||||||
icon={<CameraIcon />}
|
|
||||||
aria-label="Capture Image"
|
|
||||||
title="Capture Image"
|
|
||||||
onClick={() => imageUploadRef.current?.click()}
|
|
||||||
isLoading={uploading}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Flex>
|
</Flex>
|
||||||
{draft.content.length > 0 && <Button onClick={togglePreview}>Preview</Button>}
|
{draft.content.length > 0 && <Button onClick={togglePreview}>Preview</Button>}
|
||||||
<Button onClick={onClose}>Cancel</Button>
|
<Button onClick={onClose}>Cancel</Button>
|
||||||
|
Reference in New Issue
Block a user