Fix tag selector in scrape dialogs (#4526)

This commit is contained in:
WithoutPants
2024-02-06 10:26:16 +11:00
committed by GitHub
parent 3ea31aeb76
commit 217c02f181
8 changed files with 93 additions and 98 deletions

View File

@@ -28,10 +28,12 @@ import {
useCreateScrapedStudio,
useCreateScrapedTag,
} from "src/components/Shared/ScrapeDialog/createObjects";
import { Tag } from "src/components/Tags/TagSelect";
interface ISceneScrapeDialogProps {
scene: Partial<GQL.SceneUpdateInput>;
scenePerformers: Performer[];
sceneTags: Tag[];
scraped: GQL.ScrapedScene;
endpoint?: string;
@@ -41,6 +43,7 @@ interface ISceneScrapeDialogProps {
export const SceneScrapeDialog: React.FC<ISceneScrapeDialogProps> = ({
scene,
scenePerformers,
sceneTags,
scraped,
onClose,
endpoint,
@@ -146,10 +149,15 @@ export const SceneScrapeDialog: React.FC<ISceneScrapeDialogProps> = ({
scraped.movies?.filter((t) => !t.stored_id) ?? []
);
const [tags, setTags] = useState<ScrapeResult<string[]>>(
new ScrapeResult<string[]>(
sortIdList(scene.tag_ids),
mapStoredIdObjects(scraped.tags ?? undefined)
const [tags, setTags] = useState<ObjectListScrapeResult<GQL.ScrapedTag>>(
new ObjectListScrapeResult<GQL.ScrapedTag>(
sortStoredIdObjects(
sceneTags.map((t) => ({
stored_id: t.id,
name: t.name,
}))
),
sortStoredIdObjects(scraped.tags ?? undefined)
)
);
const [newTags, setNewTags] = useState<GQL.ScrapedTag[]>(
@@ -240,12 +248,7 @@ export const SceneScrapeDialog: React.FC<ISceneScrapeDialogProps> = ({
name: "",
};
}),
tags: tags.getNewValue()?.map((m) => {
return {
stored_id: m,
name: "",
};
}),
tags: tags.getNewValue(),
details: details.getNewValue(),
image: image.getNewValue(),
remote_site_id: stashID.getNewValue(),