Multiple image URLs (#4000)

* Backend changes - ported from scene impl
* Front end changes
* Refactor URL mutation code
This commit is contained in:
WithoutPants
2023-09-12 13:31:53 +10:00
committed by GitHub
parent 9f4d0af886
commit a25286bdcb
29 changed files with 457 additions and 173 deletions

View File

@@ -50,8 +50,8 @@ export const URLField: React.FC<IProps> = (props: IProps) => {
};
interface IURLListProps extends IStringListInputProps {
onScrapeClick(url: string): void;
urlScrapable(url: string): boolean;
onScrapeClick?: (url: string) => void;
urlScrapable?: (url: string) => boolean;
}
export const URLListInput: React.FC<IURLListProps> = (
@@ -64,17 +64,23 @@ export const URLListInput: React.FC<IURLListProps> = (
{...listProps}
placeholder={intl.formatMessage({ id: "url" })}
inputComponent={StringInput}
appendComponent={(props) => (
<Button
className="scrape-url-button text-input"
variant="secondary"
onClick={() => onScrapeClick(props.value)}
disabled={!props.value || !urlScrapable(props.value)}
title={intl.formatMessage({ id: "actions.scrape" })}
>
<Icon icon={faFileDownload} />
</Button>
)}
appendComponent={(props) => {
if (!onScrapeClick || !urlScrapable) {
return <></>;
}
return (
<Button
className="scrape-url-button text-input"
variant="secondary"
onClick={() => onScrapeClick(props.value)}
disabled={!props.value || !urlScrapable(props.value)}
title={intl.formatMessage({ id: "actions.scrape" })}
>
<Icon icon={faFileDownload} />
</Button>
);
}}
/>
);
};