mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 08:57:54 +00:00
removed generation count blocker (image)
This commit is contained in:
1 parent
9b4ffa7986
commit
2fb1eb957b
4 files changed
+18
-61
No files matched your search
@@ -25,7 +25,6 @@ import { twMerge } from "tailwind-merge";
|
||||
import { GenerationProvider } from "@storyteller/api-enums";
|
||||
import { GenerationCountPicker } from "./common/GenerationCountPicker";
|
||||
import { StoreApi, UseBoundStore } from "zustand";
|
||||
import { useSubscriptionState } from "@storyteller/subscription";
|
||||
|
||||
export type AspectRatio = "wide" | "tall" | "square";
|
||||
|
||||
@@ -68,10 +67,6 @@ export const PromptBox2D = ({
|
||||
}: PromptBox2DProps) => {
|
||||
useSignals();
|
||||
|
||||
// Check subscription status to determine if user is on free plan
|
||||
const hasPaidPlan = useSubscriptionState((s) => s.hasPaidPlan);
|
||||
const isFreeUser = !hasPaidPlan();
|
||||
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const [content, setContent] = useState<React.ReactNode>("");
|
||||
|
||||
@@ -493,7 +488,6 @@ export const PromptBox2D = ({
|
||||
handleCountChange={(count) => {
|
||||
onGenerationCountChange?.(count);
|
||||
}}
|
||||
isFreeUser={isFreeUser}
|
||||
/>
|
||||
<GenerateButton
|
||||
className="flex items-center border-none bg-primary px-3 text-sm text-white disabled:cursor-not-allowed disabled:opacity-50"
|
||||
|
||||
@@ -29,7 +29,6 @@ import { RefImage, usePromptEditStore } from "./promptStore";
|
||||
import { GenerationProvider } from "@storyteller/api-enums";
|
||||
import { AspectRatioPicker } from "./common/AspectRatioPicker";
|
||||
import { GenerationCountPicker } from "./common/GenerationCountPicker";
|
||||
import { useSubscriptionState } from "@storyteller/subscription";
|
||||
|
||||
export interface PromptBoxEditProps {
|
||||
onModeChange?: (mode: string) => void;
|
||||
@@ -80,10 +79,6 @@ export const PromptBoxEdit = ({
|
||||
onRedo,
|
||||
credits,
|
||||
}: PromptBoxEditProps) => {
|
||||
// Check subscription status to determine if user is on free plan
|
||||
const hasPaidPlan = useSubscriptionState((s) => s.hasPaidPlan);
|
||||
const isFreeUser = !hasPaidPlan();
|
||||
|
||||
const [prompt, setPrompt] = useState("");
|
||||
const [useSystemPrompt, setUseSystemPrompt] = useState(true);
|
||||
const [isFocused, setIsFocused] = useState(false);
|
||||
@@ -509,7 +504,6 @@ export const PromptBoxEdit = ({
|
||||
handleCountChange={(count) => {
|
||||
onGenerationCountChange?.(count);
|
||||
}}
|
||||
isFreeUser={isFreeUser}
|
||||
/>
|
||||
<GenerateButton
|
||||
className="flex items-center border-none bg-primary px-3 text-sm text-white disabled:cursor-not-allowed disabled:opacity-50"
|
||||
|
||||
@@ -29,7 +29,6 @@ import { AspectRatioIcon } from "./common/AspectRatioIcon";
|
||||
import { GenerationCountPicker } from "./common/GenerationCountPicker";
|
||||
import { ResolutionPicker } from "./common/ResolutionPicker";
|
||||
import { CommonResolution } from "@storyteller/model-list";
|
||||
import { useSubscriptionState } from "@storyteller/subscription";
|
||||
|
||||
interface PromptBoxImageProps {
|
||||
useJobContext: () => JobContextType;
|
||||
@@ -68,10 +67,6 @@ export const PromptBoxImage = ({
|
||||
}: PromptBoxImageProps) => {
|
||||
useSignals();
|
||||
|
||||
// Check subscription status to determine if user is on free plan
|
||||
const hasPaidPlan = useSubscriptionState((s) => s.hasPaidPlan);
|
||||
const isFreeUser = !hasPaidPlan();
|
||||
|
||||
console.debug("Selected model:", selectedModel);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -535,7 +530,6 @@ export const PromptBoxImage = ({
|
||||
handleCountChange={(count) => {
|
||||
setGenerationCount(count);
|
||||
}}
|
||||
isFreeUser={isFreeUser}
|
||||
/>
|
||||
<GenerateButton
|
||||
className="flex items-center border-none bg-primary px-3 text-sm text-white disabled:cursor-not-allowed disabled:opacity-50"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { faCopy, faCrown } from "@fortawesome/pro-solid-svg-icons";
|
||||
import { faCopy } from "@fortawesome/pro-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { PopoverMenu, PopoverItem } from "@storyteller/ui-popover";
|
||||
import { Tooltip } from "@storyteller/ui-tooltip";
|
||||
@@ -10,27 +10,20 @@ interface GenerationCountPickerProps {
|
||||
currentModel?: ImageModel;
|
||||
currentCount: number;
|
||||
handleCountChange: (count: number) => void;
|
||||
isFreeUser?: boolean;
|
||||
}
|
||||
|
||||
export const GenerationCountPicker = ({
|
||||
currentModel,
|
||||
currentCount,
|
||||
handleCountChange,
|
||||
isFreeUser = false,
|
||||
}: GenerationCountPickerProps) => {
|
||||
const maxGenerationCount =
|
||||
currentModel?.maxGenerationCount || DEFAULT_GENERATION_COUNT;
|
||||
const hasPredefinedOptions = !!currentModel?.predefinedGenerationCounts;
|
||||
const isNanoBananaPro = currentModel?.id === "nano_banana_pro";
|
||||
const shouldLimitGenerations = isFreeUser && isNanoBananaPro;
|
||||
|
||||
let generationCountOptions: PopoverItem[];
|
||||
|
||||
// Free users on Nano Banana Pro are limited to 1 generation at a time
|
||||
if (shouldLimitGenerations) {
|
||||
generationCountOptions = [{ label: "1", selected: true }];
|
||||
} else if (hasPredefinedOptions) {
|
||||
if (hasPredefinedOptions) {
|
||||
// Count pickers either have a "[1,2, ... max]" set of options, or a pre-defined list of options.
|
||||
generationCountOptions = buildPredefinedCountOptions(
|
||||
currentModel?.predefinedGenerationCounts || [],
|
||||
@@ -49,46 +42,28 @@ export const GenerationCountPicker = ({
|
||||
return;
|
||||
}
|
||||
if (count < 1 || count > maxGenerationCount) {
|
||||
// Clamp to valid range
|
||||
count = Math.min(Math.max(1, count), maxGenerationCount);
|
||||
}
|
||||
handleCountChange(count);
|
||||
};
|
||||
|
||||
// Tooltip content changes based on subscription status (only for Nano Banana Pro)
|
||||
const tooltipContent = shouldLimitGenerations ? (
|
||||
<div className="flex flex-col gap-1 max-w-[200px]">
|
||||
<div className="flex items-center gap-1.5 font-medium">
|
||||
<FontAwesomeIcon icon={faCrown} className="h-3 w-3 text-yellow-400" />
|
||||
<span>Generate more images</span>
|
||||
</div>
|
||||
<p className="text-xs text-base-fg/70">
|
||||
Subscribe to ArtCraft to generate multiple images at once.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
"Number of generations"
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tooltip
|
||||
content={tooltipContent}
|
||||
position="top"
|
||||
className="z-50"
|
||||
closeOnClick={true}
|
||||
delay={0}
|
||||
>
|
||||
<PopoverMenu
|
||||
items={generationCountOptions}
|
||||
onSelect={onSelect}
|
||||
mode="toggle"
|
||||
panelTitle="No. of images"
|
||||
triggerIcon={<FontAwesomeIcon icon={faCopy} className="h-4 w-4" />}
|
||||
buttonClassName="h-9"
|
||||
/>
|
||||
</Tooltip>
|
||||
</>
|
||||
<Tooltip
|
||||
content="Number of generations"
|
||||
position="top"
|
||||
className="z-50"
|
||||
closeOnClick={true}
|
||||
delay={0}
|
||||
>
|
||||
<PopoverMenu
|
||||
items={generationCountOptions}
|
||||
onSelect={onSelect}
|
||||
mode="toggle"
|
||||
panelTitle="No. of images"
|
||||
triggerIcon={<FontAwesomeIcon icon={faCopy} className="h-4 w-4" />}
|
||||
buttonClassName="h-9"
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user