mirror of https://github.com/kortix-ai/suna.git
fix frontend build
This commit is contained in:
parent
d2606a5474
commit
621a606a5a
|
@ -137,8 +137,8 @@ export default function TeamBillingPage({
|
|||
Agent Usage This Month
|
||||
</span>
|
||||
<span className="text-sm font-medium">
|
||||
${subscriptionData.current_usage?.toFixed(2) || '0'} /{' '}
|
||||
${subscriptionData.cost_limit || '0'}
|
||||
{subscriptionData.credits?.lifetime_used?.toFixed(2) || '0'} /{' '}
|
||||
{subscriptionData.credits?.tier_credits || '0'}
|
||||
</span>
|
||||
<Button variant='outline' asChild className='text-sm'>
|
||||
<Link href="/settings/usage-logs">
|
||||
|
|
|
@ -91,19 +91,16 @@ export function useSharedSubscription() {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook for backward compatibility - maps new credit-based data to old format
|
||||
* This hook works both inside and outside the provider
|
||||
*/
|
||||
export function useSubscriptionData() {
|
||||
const context = useContext(SubscriptionContext);
|
||||
|
||||
// If context is available, use it and map to old format
|
||||
const directSubscription = useSubscription();
|
||||
const directCreditBalance = useCreditBalance();
|
||||
|
||||
if (context) {
|
||||
return {
|
||||
data: context.subscriptionData ? {
|
||||
...context.subscriptionData,
|
||||
// Map new credit fields to old format for compatibility
|
||||
current_usage: context.creditBalance?.lifetime_used || 0,
|
||||
cost_limit: context.subscriptionData.tier.credits,
|
||||
credit_balance: context.creditBalance?.balance || 0,
|
||||
|
@ -119,9 +116,9 @@ export function useSubscriptionData() {
|
|||
};
|
||||
}
|
||||
|
||||
// If no context, use the hook directly (for use outside provider)
|
||||
const { data, isLoading, error, refetch } = useSubscription();
|
||||
const { data: creditBalance } = useCreditBalance();
|
||||
// If no context, use the hooks directly (for use outside provider)
|
||||
const { data, isLoading, error, refetch } = directSubscription;
|
||||
const { data: creditBalance } = directCreditBalance;
|
||||
|
||||
return {
|
||||
data: data ? {
|
||||
|
|
Loading…
Reference in New Issue