refactor(billing): update billing modal state management in MessageInput and ModelSelector components

This commit is contained in:
sharath 2025-06-26 20:40:04 +00:00
parent 7b10ca6478
commit f22433332b
No known key found for this signature in database
2 changed files with 6 additions and 8 deletions

View File

@ -183,7 +183,8 @@ export const MessageInput = forwardRef<HTMLTextAreaElement, MessageInputProps>(
subscriptionStatus={subscriptionStatus}
canAccessModel={canAccessModel}
refreshCustomModels={refreshCustomModels}
billingModalOpenParent={billingModalOpen}
billingModalOpen={billingModalOpen}
setBillingModalOpen={setBillingModalOpen}
/>
) : (
<ChatSettingsDropdown

View File

@ -46,7 +46,8 @@ interface ModelSelectorProps {
canAccessModel: (modelId: string) => boolean;
subscriptionStatus: SubscriptionStatus;
refreshCustomModels?: () => void;
billingModalOpenParent: boolean;
billingModalOpen: boolean;
setBillingModalOpen: (open: boolean) => void;
hasBorder?: boolean;
}
@ -57,11 +58,11 @@ export const ModelSelector: React.FC<ModelSelectorProps> = ({
canAccessModel,
subscriptionStatus,
refreshCustomModels,
billingModalOpenParent,
billingModalOpen,
setBillingModalOpen,
hasBorder = false,
}) => {
const [paywallOpen, setPaywallOpen] = useState(false);
const [billingModalOpen, setBillingModalOpen] = useState(billingModalOpenParent);
const [lockedModel, setLockedModel] = useState<string | null>(null);
const [isOpen, setIsOpen] = useState(false);
const [searchQuery, setSearchQuery] = useState('');
@ -83,10 +84,6 @@ export const ModelSelector: React.FC<ModelSelectorProps> = ({
}
}, []);
useEffect(() => {
setBillingModalOpen(billingModalOpenParent);
}, [billingModalOpenParent]);
// Save custom models to localStorage whenever they change
useEffect(() => {
if (isLocalMode() && customModels.length > 0) {