import React from 'react';
import { View, StyleSheet, ScrollView } from 'react-native';
import { useTheme } from '~/features/theme/ThemeProvider';
import colors from '~/tailwind.config.js';
/**
* Skeleton loader for SubscriptionPage component
* Shows loading state for subscription cards and usage statistics
*/
const SubscriptionPageSkeleton = () => {
const { isDark, themeVariant } = useTheme();
// Get theme colors
const borderColor = isDark
? (colors as any).theme?.extend?.colors?.dark?.[themeVariant]?.border || '#424242'
: (colors as any).theme?.extend?.colors?.[themeVariant]?.border || '#e6e6e6';
const backgroundColor = isDark
? (colors as any).theme?.extend?.colors?.dark?.[themeVariant]?.contentBackground
: (colors as any).theme?.extend?.colors?.[themeVariant]?.contentBackground;
const skeletonColor = isDark ? '#3a3a3a' : '#e0e0e0';
const shimmerColor = isDark ? '#4a4a4a' : '#f0f0f0';
// Skeleton for a card component
const CardSkeleton = ({ height = 200 }: { height?: number }) => (
{/* Title skeleton */}
{/* Content lines */}
{/* Button skeleton */}
);
// Skeleton for usage/cost cards
const InfoCardSkeleton = () => (
);
// Skeleton for billing toggle
const BillingToggleSkeleton = () => (
);
return (
{/* Usage and Cost cards section */}
{/* Billing toggle */}
{/* Section title skeleton */}
{/* Subscription cards */}
{/* Section title skeleton for packages */}
{/* Package cards */}
);
};
const styles = StyleSheet.create({
container: {
paddingHorizontal: 16,
paddingTop: 0,
paddingBottom: 64,
maxWidth: 1200,
width: '100%',
alignSelf: 'center',
},
section: {
marginBottom: 16,
},
toggleSection: {
marginBottom: 24,
},
cardsGrid: {
flexDirection: 'row',
flexWrap: 'wrap',
marginBottom: 16,
},
cardWrapper: {
width: '100%',
marginBottom: 16,
paddingRight: 0,
},
card: {
borderRadius: 16,
padding: 20,
borderWidth: 1,
},
infoCard: {
borderRadius: 16,
padding: 16,
marginBottom: 12,
borderWidth: 1,
},
titleSkeleton: {
height: 24,
width: 150,
borderRadius: 4,
opacity: 0.7,
marginBottom: 16,
},
infoTitleSkeleton: {
height: 20,
width: 120,
borderRadius: 4,
opacity: 0.7,
marginBottom: 12,
},
sectionTitleSkeleton: {
height: 28,
width: 200,
borderRadius: 4,
opacity: 0.7,
marginBottom: 16,
},
contentContainer: {
marginBottom: 20,
},
contentLine: {
height: 14,
borderRadius: 3,
marginBottom: 8,
opacity: 0.5,
},
infoContent: {
marginTop: 8,
},
infoLine: {
height: 12,
borderRadius: 3,
marginBottom: 6,
opacity: 0.5,
},
buttonSkeleton: {
height: 44,
borderRadius: 12,
opacity: 0.6,
marginTop: 'auto',
},
billingToggle: {
height: 56,
borderRadius: 28,
opacity: 0.6,
},
});
// Responsive styles for tablets and larger screens
const responsiveStyles = StyleSheet.create({
cardWrapper: {
'@media (min-width: 768px)': {
width: 'calc(50% - 8px)',
marginRight: 16,
},
'@media (min-width: 1024px)': {
width: 'calc(33.33% - 12px)',
},
},
});
export default SubscriptionPageSkeleton;