Skip to content

Commit

Permalink
Allow bookmark image field to be changed when in “edit” mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmartineau committed Nov 11, 2023
1 parent 550ca7f commit 3a3bc00
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/BookmarkForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { CONTENT, DEFAULT_BOOKMARK_FORM_URL_PLACEHOLDER } from '../constants';
import { useToggle } from '../hooks/useToggle';
import { MetadataResponse } from '../types/api';
import { type Bookmark, type BookmarkFormValues } from '../types/db';
import { Database } from '../types/supabase';
import { MetaTag, getDbMetadata } from '../utils/fetching/meta';
import { getScrapeData } from '../utils/fetching/scrape';
import { getErrorMessage } from '../utils/get-error-message';
Expand Down Expand Up @@ -251,7 +250,6 @@ export const BookmarkForm = ({
onSubmit={handleSubmit(handleSubmitForm)}
className={bookmarkformClass}
>
<input type="hidden" {...register('image')} />
<input type="hidden" {...register('feed')} />

{/* URL */}
Expand Down Expand Up @@ -372,6 +370,15 @@ export const BookmarkForm = ({
</Flex>
</FormGroup>

{/* IMAGE */}
{type === 'edit' ? (
<FormGroup label="Image" name="image">
<Input id="image" {...register('image')} />
</FormGroup>
) : (
<input type="hidden" {...register('image')} />
)}

{formError && <div className="my-m">Error: {formError}</div>}

<div>
Expand Down

0 comments on commit 3a3bc00

Please sign in to comment.