|
|
|
|
@@ -168,8 +168,8 @@ export default function MobileDashboardPage() {
|
|
|
|
|
|
|
|
|
|
const activePackage =
|
|
|
|
|
packagesOverview?.activePackage ?? packagesOverview?.packages?.find((pkg) => pkg.active) ?? null;
|
|
|
|
|
const remainingEvents = activePackage?.remaining_events ?? null;
|
|
|
|
|
const isResellerPackage = activePackage?.package_type === 'reseller';
|
|
|
|
|
const remainingEvents = isResellerPackage ? (activePackage?.remaining_events ?? null) : null;
|
|
|
|
|
const summarySeenPackageId =
|
|
|
|
|
summarySeenOverride ?? onboardingStatus?.steps?.summary_seen_package_id ?? null;
|
|
|
|
|
const hasSummaryPackage =
|
|
|
|
|
@@ -586,10 +586,17 @@ function PackageSummarySheet({
|
|
|
|
|
</Text>
|
|
|
|
|
</YStack>
|
|
|
|
|
<YStack space="$2" marginTop="$2">
|
|
|
|
|
<SummaryRow
|
|
|
|
|
label={t('mobileDashboard.packageSummary.remaining', 'Remaining events')}
|
|
|
|
|
value={formatPackageLimit(remainingEvents, t)}
|
|
|
|
|
/>
|
|
|
|
|
{packageType === 'reseller' ? (
|
|
|
|
|
<SummaryRow
|
|
|
|
|
label={t('mobileDashboard.packageSummary.remaining', 'Remaining events')}
|
|
|
|
|
value={formatPackageLimit(remainingEvents, t)}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<SummaryRow
|
|
|
|
|
label={t('mobileDashboard.packageSummary.eventAllowance', 'Event allowance')}
|
|
|
|
|
value={t('mobileDashboard.packageSummary.eventPerPurchase', '1 event per purchase')}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
<SummaryRow label={t('mobileDashboard.packageSummary.purchased', 'Purchased')} value={formatDate(purchasedAt)} />
|
|
|
|
|
{expiresAt ? (
|
|
|
|
|
<SummaryRow label={t('mobileDashboard.packageSummary.expires', 'Expires')} value={formatDate(expiresAt)} />
|
|
|
|
|
@@ -672,19 +679,28 @@ function PackageSummaryBanner({
|
|
|
|
|
const { textStrong, muted, border, surface, accentSoft, primary, surfaceMuted, shadow } = useAdminTheme();
|
|
|
|
|
const text = textStrong;
|
|
|
|
|
const packageName = activePackage.package_name ?? t('mobileDashboard.packageSummary.fallbackTitle', 'Package summary');
|
|
|
|
|
const remainingEvents = typeof activePackage.remaining_events === 'number' ? activePackage.remaining_events : null;
|
|
|
|
|
const remainingEvents =
|
|
|
|
|
activePackage.package_type === 'reseller' && typeof activePackage.remaining_events === 'number'
|
|
|
|
|
? activePackage.remaining_events
|
|
|
|
|
: null;
|
|
|
|
|
const hasLimit = remainingEvents !== null;
|
|
|
|
|
const totalEvents = hasLimit ? activePackage.used_events + remainingEvents : null;
|
|
|
|
|
const showProgress = hasLimit && (totalEvents ?? 0) > 0;
|
|
|
|
|
const usageLabel = hasLimit
|
|
|
|
|
? t('mobileDashboard.packageSummary.bannerUsage', '{{used}} of {{total}} events used', {
|
|
|
|
|
used: activePackage.used_events,
|
|
|
|
|
total: totalEvents ?? 0,
|
|
|
|
|
})
|
|
|
|
|
: t('mobileDashboard.packageSummary.bannerUnlimited', 'Unlimited events');
|
|
|
|
|
const remainingLabel = hasLimit
|
|
|
|
|
? t('mobileDashboard.packageSummary.bannerRemaining', '{{count}} remaining', { count: remainingEvents })
|
|
|
|
|
: t('mobileDashboard.packageSummary.bannerRemainingUnlimited', 'No limit');
|
|
|
|
|
const usageLabel =
|
|
|
|
|
activePackage.package_type === 'reseller'
|
|
|
|
|
? hasLimit
|
|
|
|
|
? t('mobileDashboard.packageSummary.bannerUsage', '{{used}} of {{total}} events used', {
|
|
|
|
|
used: activePackage.used_events,
|
|
|
|
|
total: totalEvents ?? 0,
|
|
|
|
|
})
|
|
|
|
|
: t('mobileDashboard.packageSummary.bannerUnlimited', 'Unlimited events')
|
|
|
|
|
: t('mobileDashboard.packageSummary.eventPerPurchase', '1 event per purchase');
|
|
|
|
|
const remainingLabel =
|
|
|
|
|
activePackage.package_type === 'reseller'
|
|
|
|
|
? hasLimit
|
|
|
|
|
? t('mobileDashboard.packageSummary.bannerRemaining', '{{count}} remaining', { count: remainingEvents })
|
|
|
|
|
: t('mobileDashboard.packageSummary.bannerRemainingUnlimited', 'No limit')
|
|
|
|
|
: t('mobileDashboard.packageSummary.eventPerPurchaseShort', 'Per purchase');
|
|
|
|
|
const progressMax = totalEvents ?? 0;
|
|
|
|
|
const progressValue = Math.min(activePackage.used_events, progressMax);
|
|
|
|
|
|
|
|
|
|
|