don't show submit to plus for non-objects and if plus is disabled

This commit is contained in:
Josh Hawkins 2025-11-06 16:25:50 -06:00
parent f2e3579030
commit 9f73145d63

View File

@ -1242,106 +1242,110 @@ function ObjectDetailsTab({
</div> </div>
</div> </div>
<div {search.data.type === "object" &&
className={cn( !search.plus_id &&
"my-2 flex w-full flex-col justify-between gap-1.5", config?.plus?.enabled && (
state == "submitted" && "flex-row", <div
)} className={cn(
> "my-2 flex w-full flex-col justify-between gap-1.5",
<div className="text-sm text-primary/40"> state == "submitted" && "flex-row",
<div className="flex flex-row items-center gap-1"> )}
{t("explore.plus.submitToPlus.label", { >
ns: "components/dialog", <div className="text-sm text-primary/40">
})} <div className="flex flex-row items-center gap-1">
<Popover> {t("explore.plus.submitToPlus.label", {
<PopoverTrigger asChild>
<div className="cursor-pointer p-0">
<LuInfo className="size-4" />
<span className="sr-only">Info</span>
</div>
</PopoverTrigger>
<PopoverContent
container={popoverContainerRef.current}
className="w-80 text-xs"
>
{t("explore.plus.submitToPlus.desc", {
ns: "components/dialog", ns: "components/dialog",
})} })}
</PopoverContent> <Popover>
</Popover> <PopoverTrigger asChild>
</div> <div className="cursor-pointer p-0">
</div> <LuInfo className="size-4" />
<span className="sr-only">Info</span>
</div>
</PopoverTrigger>
<PopoverContent
container={popoverContainerRef.current}
className="w-80 text-xs"
>
{t("explore.plus.submitToPlus.desc", {
ns: "components/dialog",
})}
</PopoverContent>
</Popover>
</div>
</div>
<div className="flex flex-row items-center justify-between gap-2 text-sm"> <div className="flex flex-row items-center justify-between gap-2 text-sm">
{state == "reviewing" && ( {state == "reviewing" && (
<> <>
<div> <div>
{i18n.language === "en" ? ( {i18n.language === "en" ? (
// English with a/an logic plus label // English with a/an logic plus label
<> <>
{/^[aeiou]/i.test(search?.label || "") ? ( {/^[aeiou]/i.test(search?.label || "") ? (
<Trans <Trans
ns="components/dialog" ns="components/dialog"
values={{ label: search?.label }} values={{ label: search?.label }}
> >
explore.plus.review.question.ask_an explore.plus.review.question.ask_an
</Trans> </Trans>
) : (
<Trans
ns="components/dialog"
values={{ label: search?.label }}
>
explore.plus.review.question.ask_a
</Trans>
)}
</>
) : ( ) : (
// For other languages
<Trans <Trans
ns="components/dialog" ns="components/dialog"
values={{ label: search?.label }} values={{
untranslatedLabel: search?.label,
translatedLabel: getTranslatedLabel(search?.label),
}}
> >
explore.plus.review.question.ask_a explore.plus.review.question.ask_full
</Trans> </Trans>
)} )}
</> </div>
) : ( <div className="flex max-w-xl flex-row gap-2">
// For other languages <Button
<Trans className="flex-1 bg-success"
ns="components/dialog" aria-label={t("button.yes", { ns: "common" })}
values={{ onClick={() => {
untranslatedLabel: search?.label, setState("uploading");
translatedLabel: getTranslatedLabel(search?.label), onSubmitToPlus(false);
}} }}
> >
explore.plus.review.question.ask_full {t("button.yes", { ns: "common" })}
</Trans> </Button>
)} <Button
</div> className="flex-1 text-white"
<div className="flex max-w-xl flex-row gap-2"> aria-label={t("button.no", { ns: "common" })}
<Button variant="destructive"
className="flex-1 bg-success" onClick={() => {
aria-label={t("button.yes", { ns: "common" })} setState("uploading");
onClick={() => { onSubmitToPlus(true);
setState("uploading"); }}
onSubmitToPlus(false); >
}} {t("button.no", { ns: "common" })}
> </Button>
{t("button.yes", { ns: "common" })} </div>
</Button> </>
<Button )}
className="flex-1 text-white" {state == "uploading" && <ActivityIndicator />}
aria-label={t("button.no", { ns: "common" })} {state == "submitted" && (
variant="destructive" <div className="flex flex-row items-center justify-center gap-2">
onClick={() => { <FaCheckCircle className="size-4 text-success" />
setState("uploading"); {t("explore.plus.review.state.submitted")}
onSubmitToPlus(true); </div>
}} )}
>
{t("button.no", { ns: "common" })}
</Button>
</div>
</>
)}
{state == "uploading" && <ActivityIndicator />}
{state == "submitted" && (
<div className="flex flex-row items-center justify-center gap-2">
<FaCheckCircle className="size-4 text-success" />
{t("explore.plus.review.state.submitted")}
</div> </div>
)} </div>
</div> )}
</div>
<div className="flex flex-col gap-1.5"> <div className="flex flex-col gap-1.5">
{config?.cameras[search.camera].objects.genai.enabled && {config?.cameras[search.camera].objects.genai.enabled &&
!search.end_time && !search.end_time &&