-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert confirmation page after training settings validation
- Loading branch information
Showing
44 changed files
with
588 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,49 @@ | ||
import { useModelsContext } from "@/app/providers/models-provider"; | ||
import ModelFormConfirmation from "@/assets/images/model_creation_success.png"; | ||
import { Button } from "@/components/ui/button"; | ||
import { Image } from "@/components/ui/image"; | ||
import { Link } from "@/components/ui/link"; | ||
import ModelEnhancementDialog from "@/features/models/components/dialogs/model-enhancement-dialog"; | ||
import { useDialog } from "@/hooks/use-dialog"; | ||
import { APPLICATION_ROUTES, MODEL_CREATION_CONTENT } from "@/utils"; | ||
import ConfettiExplosion from "react-confetti-explosion"; | ||
import { useNavigate, useSearchParams } from "react-router-dom"; | ||
import { useSearchParams } from "react-router-dom"; | ||
|
||
export const ModelConfirmationPage = () => { | ||
const [searchParams] = useSearchParams(); | ||
const modelId = searchParams.get("id"); | ||
const { formData } = useModelsContext(); | ||
const { isOpened, openDialog, closeDialog } = useDialog(); | ||
const navigate = useNavigate(); | ||
|
||
const handleClick = () => { | ||
if (formData.trainingRequestIsSuccessful) { | ||
navigate(`${APPLICATION_ROUTES.MODELS}/${modelId}`) | ||
} else { | ||
openDialog() | ||
} | ||
} | ||
const modelId = searchParams.get("id"); | ||
return ( | ||
<> | ||
<ModelEnhancementDialog isOpened={isOpened} closeDialog={closeDialog} modelId={modelId as string} /> | ||
<div className={"col-start-3 col-span-8 flex flex-col gap-y-10"}> | ||
<div className="flex items-center justify-center w-full h-full flex-col gap-y-10 text-center"> | ||
<ConfettiExplosion | ||
force={0.2} | ||
duration={5000} | ||
particleCount={250} | ||
height={10000} | ||
/> | ||
<Image src={ModelFormConfirmation} alt="Model Creation Success Icon" /> | ||
<p className="text-title-2">Model {modelId} is Created!</p> | ||
<p className="text-gray"> | ||
{formData.trainingRequestMessage} | ||
</p> | ||
<div className="flex items-center justify-between gap-x-4"> | ||
<Button onClick={handleClick}> | ||
{formData.trainingRequestIsSuccessful ? MODEL_CREATION_CONTENT.confirmation.buttons.goToModel : MODEL_CREATION_CONTENT.confirmation.buttons.enhanceModel} | ||
<div className={"col-start-3 col-span-8 flex flex-col gap-y-10"}> | ||
<div className="flex items-center justify-center w-full h-full flex-col gap-y-10 text-center"> | ||
<ConfettiExplosion | ||
force={0.2} | ||
duration={5000} | ||
particleCount={250} | ||
height={10000} | ||
/> | ||
<Image src={ModelFormConfirmation} alt="Model Creation Success Icon" /> | ||
<p className="text-title-2">Model {modelId} is Created!</p> | ||
<p className="text-gray"> | ||
{MODEL_CREATION_CONTENT.confirmation.description} | ||
</p> | ||
<div className="flex items-center justify-between gap-x-4"> | ||
<Link | ||
href={`${APPLICATION_ROUTES.MODELS}/${modelId}`} | ||
title={MODEL_CREATION_CONTENT.confirmation.buttons.goToModel} | ||
nativeAnchor={false} | ||
> | ||
<Button> | ||
{MODEL_CREATION_CONTENT.confirmation.buttons.goToModel} | ||
</Button> | ||
</Link> | ||
<Link | ||
href={`${APPLICATION_ROUTES.MODELS}`} | ||
title={MODEL_CREATION_CONTENT.confirmation.buttons.exploreModels} | ||
> | ||
<Button variant="dark"> | ||
{MODEL_CREATION_CONTENT.confirmation.buttons.exploreModels} | ||
</Button> | ||
<Link | ||
href={!formData.trainingRequestIsSuccessful ? `${APPLICATION_ROUTES.MODELS}/${modelId}` : `${APPLICATION_ROUTES.MODELS}`} | ||
title={!formData.trainingRequestIsSuccessful ? MODEL_CREATION_CONTENT.confirmation.buttons.goToModel : MODEL_CREATION_CONTENT.confirmation.buttons.exploreModels} | ||
> | ||
<Button variant="dark"> | ||
{!formData.trainingRequestIsSuccessful ? MODEL_CREATION_CONTENT.confirmation.buttons.goToModel : MODEL_CREATION_CONTENT.confirmation.buttons.exploreModels} | ||
</Button> | ||
</Link> | ||
</div> | ||
</Link> | ||
</div> | ||
</div> | ||
</> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.