mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-09 03:21:23 +00:00
New state colour/text when cannot drop New colour when okay to drop New bar in timeline grid when okay to drop Tracks that are okay to drop glow --------- Co-authored-by: Christopher Oliphant <RALifeCoach@users.noreply.github.com>
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { generateMovieId } from "~/pages/PageEnigma/store";
|
|
import { useContext, useEffect, useState } from "react";
|
|
import { MyMovies } from "~/pages/PageEnigma/comps/GenerateModals/MyMovies";
|
|
import { Sharing } from "~/pages/PageEnigma/comps/GenerateModals/Sharing";
|
|
import { useSignals } from "@preact/signals-react/runtime";
|
|
import { MediaFile } from "~/pages/PageEnigma/models";
|
|
import { GetMediaFileByToken } from "~/pages/PageEnigma/comps/SidePanelTabs/AudioTab/utilities";
|
|
import { ToasterContext, ToastTypes } from "~/contexts/ToasterContext";
|
|
|
|
export function GenerateModals() {
|
|
useSignals();
|
|
const [movieId, setMovieId] = useState(generateMovieId.value);
|
|
const [mediaFile, setMediaFile] = useState<MediaFile | null>(null);
|
|
const { addToast } = useContext(ToasterContext);
|
|
|
|
useEffect(() => {
|
|
if (!mediaFile) {
|
|
setMovieId("");
|
|
}
|
|
}, [mediaFile]);
|
|
|
|
useEffect(() => {
|
|
console.log(2, movieId);
|
|
if (movieId) {
|
|
GetMediaFileByToken(movieId).then((res) => {
|
|
if (!res.success) {
|
|
addToast(ToastTypes.ERROR, "Unable to read media file");
|
|
return;
|
|
}
|
|
setMediaFile(res.media_file ?? null);
|
|
});
|
|
}
|
|
}, [movieId, addToast]);
|
|
|
|
if (!mediaFile) {
|
|
return <MyMovies setMovieId={setMovieId} />;
|
|
}
|
|
return <Sharing mediaFile={mediaFile!} setMediaFile={setMediaFile} />;
|
|
}
|