diff --git a/frontend/apps/artcraft-webapp/src/components/generation-gallery/GenerationGalleryGrid.tsx b/frontend/apps/artcraft-webapp/src/components/generation-gallery/GenerationGalleryGrid.tsx index 57d89f60e9..c3cdb8b3e5 100644 --- a/frontend/apps/artcraft-webapp/src/components/generation-gallery/GenerationGalleryGrid.tsx +++ b/frontend/apps/artcraft-webapp/src/components/generation-gallery/GenerationGalleryGrid.tsx @@ -4,9 +4,9 @@ import { Tooltip } from "@storyteller/ui-tooltip"; import { GenerationGridView, type GalleryItem, - is3DMediaClass, type RecreateSlotContext, useGallerySelectionStore, + useLastViewedGenerationStore, } from "@storyteller/ui-generation-list"; import { useRecreateFromPromptToken } from "../../lib/recreate"; import { useGalleryItemActions } from "./useGalleryItemActions"; @@ -34,6 +34,7 @@ export function GenerationGalleryGrid({ }: GenerationGalleryProps) { const selectionActive = useGallerySelectionStore((s) => s.active); const selectedIds = useGallerySelectionStore((s) => s.ids); + const lastViewedId = useLastViewedGenerationStore((s) => s.id); return ( ); } @@ -70,14 +72,16 @@ function CardRecreateButton({ mediaClass, kind, }: RecreateSlotContext) { - // Recreate only targets the image/video create pages; 3D generations have no - // recreate flow, so map to a valid class for the hook and render nothing. + // Recreate only targets the image/video create pages; 3D and audio + // generations have no recreate flow, so map to a valid class for the hook + // (it must run unconditionally) and render nothing. + const hasRecreateFlow = mediaClass === "image" || mediaClass === "video"; const { isRecreating, handleRecreate } = useRecreateFromPromptToken( promptToken, - is3DMediaClass(mediaClass) ? "image" : mediaClass, + hasRecreateFlow ? mediaClass : "image", ); - if (is3DMediaClass(mediaClass)) return null; + if (!hasRecreateFlow) return null; if (kind === "failed") { return ( diff --git a/frontend/apps/artcraft-webapp/src/components/generation-gallery/GenerationGalleryList.tsx b/frontend/apps/artcraft-webapp/src/components/generation-gallery/GenerationGalleryList.tsx index 8dfc44a444..b90e0e8123 100644 --- a/frontend/apps/artcraft-webapp/src/components/generation-gallery/GenerationGalleryList.tsx +++ b/frontend/apps/artcraft-webapp/src/components/generation-gallery/GenerationGalleryList.tsx @@ -4,9 +4,9 @@ import { Tooltip } from "@storyteller/ui-tooltip"; import { GenerationListView, type GalleryItem, - is3DMediaClass, type RecreateSlotContext, useGallerySelectionStore, + useLastViewedGenerationStore, } from "@storyteller/ui-generation-list"; import { toast } from "../toast/toast"; import { useRecreateFromPromptToken } from "../../lib/recreate"; @@ -38,6 +38,7 @@ export function GenerationGalleryList({ }: GenerationGalleryProps) { const selectionActive = useGallerySelectionStore((s) => s.active); const selectedIds = useGallerySelectionStore((s) => s.ids); + const lastViewedId = useLastViewedGenerationStore((s) => s.id); return ( ); } @@ -86,14 +88,16 @@ function RowRecreateButton({ mediaClass, kind, }: RecreateSlotContext) { - // Recreate only targets the image/video create pages; 3D generations have no - // recreate flow, so map to a valid class for the hook and render nothing. + // Recreate only targets the image/video create pages; 3D and audio + // generations have no recreate flow, so map to a valid class for the hook + // (it must run unconditionally) and render nothing. + const hasRecreateFlow = mediaClass === "image" || mediaClass === "video"; const { isRecreating, handleRecreate } = useRecreateFromPromptToken( promptToken, - is3DMediaClass(mediaClass) ? "image" : mediaClass, + hasRecreateFlow ? mediaClass : "image", ); - if (is3DMediaClass(mediaClass)) return null; + if (!hasRecreateFlow) return null; return (