- Added new message `msg-subscribe-disabled` to inform users when their subscription is disabled. - Updated `msg-subscription-active-days` to ensure proper localization formatting. - Refactored subscription command in the bot to check for subscription status and respond accordingly. - Enhanced ProfilePage to conditionally render the SubscriptionInfoBar based on subscription status. - Updated GraphQL types and queries to include `proEnabled` for better subscription management.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { getCustomer } from '@/actions/api/customers';
|
|
import { getSubscriptionSettings } from '@/actions/api/subscriptions';
|
|
import { getSessionUser } from '@/actions/session';
|
|
import { Container } from '@/components/layout';
|
|
import { LinksCard, PersonCard, ProfileDataCard, SubscriptionInfoBar } from '@/components/profile';
|
|
import { dehydrate, HydrationBoundary, QueryClient } from '@tanstack/react-query';
|
|
|
|
export default async function ProfilePage() {
|
|
const queryClient = new QueryClient();
|
|
const { telegramId } = await getSessionUser();
|
|
|
|
await queryClient.prefetchQuery({
|
|
queryFn: () => getCustomer({ telegramId }),
|
|
queryKey: ['customer', telegramId],
|
|
});
|
|
|
|
const { subscriptionSetting } = await queryClient.fetchQuery({
|
|
queryFn: getSubscriptionSettings,
|
|
queryKey: ['customer', telegramId],
|
|
});
|
|
|
|
const proEnabled = subscriptionSetting?.proEnabled;
|
|
|
|
return (
|
|
<HydrationBoundary state={dehydrate(queryClient)}>
|
|
<Container className="px-0">
|
|
<PersonCard />
|
|
{proEnabled && <SubscriptionInfoBar />}
|
|
<ProfileDataCard />
|
|
<LinksCard />
|
|
</Container>
|
|
</HydrationBoundary>
|
|
);
|
|
}
|