feat(subscription-ui): redesign with glass morphism and responsive layout

- Update all subscription components with glass morphism styling
- Add backdrop blur, subtle borders, and proper dark mode support
- Fix responsive layout issues with proper min-width and overflow handling
- Position badges inside cards to prevent clipping
- Add responsive font sizes for mobile displays
- Simplify mana page wrapper in chat app

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Till-JS 2025-11-29 16:04:04 +01:00
parent f2c7950875
commit a3247086eb
8 changed files with 848 additions and 134 deletions

View file

@ -16,17 +16,24 @@
<title>Mana - ManaChat</title>
</svelte:head>
<div class="min-h-screen p-4 md:p-8" style="background-color: hsl(var(--color-background));">
<div class="mx-auto max-w-6xl">
<SubscriptionPage
appName="ManaChat"
onSubscribe={handleSubscribe}
onBuyPackage={handleBuyPackage}
currentPlanId="free"
pageTitle="Wähle dein Abo"
subscriptionsTitle="Abonnements"
packagesTitle="Einmal-Pakete"
yearlyDiscount="2 Monate gratis"
/>
</div>
<div class="mana-page">
<SubscriptionPage
appName="ManaChat"
onSubscribe={handleSubscribe}
onBuyPackage={handleBuyPackage}
currentPlanId="free"
pageTitle="Wähle dein Abo"
subscriptionsTitle="Abonnements"
packagesTitle="Einmal-Pakete"
yearlyDiscount="2 Monate gratis"
/>
</div>
<style>
.mana-page {
min-height: 100%;
width: 100%;
overflow-x: hidden;
background-color: hsl(var(--background));
}
</style>

View file

@ -18,35 +18,99 @@
}: Props = $props();
</script>
<div class="mx-auto mb-2 flex max-w-lg rounded-lg p-1 bg-menu">
<div class="billing-toggle">
<button
onclick={() => onChange('monthly')}
class="flex flex-1 items-center justify-center rounded-md py-3 transition-colors"
class:bg-content={billingCycle === 'monthly'}
class:text-mana={billingCycle === 'monthly'}
class:font-bold={billingCycle === 'monthly'}
class:text-theme={billingCycle !== 'monthly'}
class="billing-toggle__button"
class:billing-toggle__button--active={billingCycle === 'monthly'}
>
<span class="text-sm">
<span class="billing-toggle__label">
{monthlyLabel}
</span>
</button>
<button
onclick={() => onChange('yearly')}
class="flex flex-1 items-center justify-center gap-2 rounded-md py-3 transition-colors"
class:bg-content={billingCycle === 'yearly'}
class:text-mana={billingCycle === 'yearly'}
class:font-bold={billingCycle === 'yearly'}
class:text-theme={billingCycle !== 'yearly'}
class="billing-toggle__button billing-toggle__button--yearly"
class:billing-toggle__button--active={billingCycle === 'yearly'}
>
<span class="text-sm">
<span class="billing-toggle__label">
{yearlyLabel}
</span>
{#if yearlyDiscount}
<span class="rounded-xl bg-mana px-2 py-1 text-xs font-bold text-white">
<span class="billing-toggle__discount">
-{yearlyDiscount}
</span>
{/if}
</button>
</div>
<style>
.billing-toggle {
display: flex;
max-width: 32rem;
margin: 0 auto 0.5rem;
padding: 0.25rem;
border-radius: 0.75rem;
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
:global(.dark) .billing-toggle {
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.billing-toggle__button {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 0.75rem;
border-radius: 0.5rem;
border: none;
background: transparent;
cursor: pointer;
transition: all 0.2s ease;
color: hsl(var(--muted-foreground));
}
.billing-toggle__button--yearly {
gap: 0.5rem;
}
.billing-toggle__button--active {
background: rgba(255, 255, 255, 0.9);
color: hsl(var(--primary, 221 83% 53%));
font-weight: 600;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
:global(.dark) .billing-toggle__button--active {
background: rgba(255, 255, 255, 0.15);
}
.billing-toggle__button:hover:not(.billing-toggle__button--active) {
background: rgba(0, 0, 0, 0.03);
}
:global(.dark) .billing-toggle__button:hover:not(.billing-toggle__button--active) {
background: rgba(255, 255, 255, 0.05);
}
.billing-toggle__label {
font-size: 0.875rem;
}
.billing-toggle__discount {
padding: 0.25rem 0.5rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 600;
color: white;
background: hsl(var(--primary, 221 83% 53%));
}
</style>

View file

@ -21,17 +21,17 @@
};
</script>
<div class="rounded-xl p-4 bg-content border border-theme">
<h3 class="mb-4 text-xl font-bold text-theme">{title}</h3>
<div class="cost-card">
<h3 class="cost-card__title">{title}</h3>
<div class="space-y-3">
<div class="cost-card__list">
{#each costs as item}
<div class="flex items-center justify-between">
<div class="flex items-center">
<div class="cost-card__item">
<div class="cost-card__item-left">
<svg
class="mr-2 h-[18px] w-[18px]"
class="cost-card__icon"
fill="none"
stroke="#4287f5"
stroke="currentColor"
viewBox="0 0 24 24"
stroke-width="2"
stroke-linecap="round"
@ -39,11 +39,11 @@
>
<path d={iconPaths[item.icon] || iconPaths['mic-outline']} />
</svg>
<p class="text-sm text-theme-secondary">
<p class="cost-card__action">
{item.action}
</p>
</div>
<p class="text-base font-semibold text-theme">
<p class="cost-card__cost">
{item.cost}
{manaLabel}
</p>
@ -51,3 +51,65 @@
{/each}
</div>
</div>
<style>
.cost-card {
position: relative;
padding: 1rem;
border-radius: 0.75rem;
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
:global(.dark) .cost-card {
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.cost-card__title {
margin: 0 0 1rem 0;
font-size: 1.25rem;
font-weight: 700;
color: hsl(var(--foreground));
}
.cost-card__list {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.cost-card__item {
display: flex;
align-items: center;
justify-content: space-between;
}
.cost-card__item-left {
display: flex;
align-items: center;
}
.cost-card__icon {
width: 1.125rem;
height: 1.125rem;
margin-right: 0.5rem;
color: hsl(var(--primary, 221 83% 53%));
}
.cost-card__action {
margin: 0;
font-size: 0.875rem;
color: hsl(var(--muted-foreground));
}
.cost-card__cost {
margin: 0;
font-size: 1rem;
font-weight: 600;
color: hsl(var(--foreground));
}
</style>

View file

@ -44,32 +44,28 @@
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="relative rounded-xl p-4 transition-all duration-200 bg-content border hover:-translate-y-0.5 hover:shadow-lg"
class:border-mana={pkg.popular}
class:border-theme={!pkg.popular}
class="package-card"
class:package-card--popular={pkg.popular}
onmouseenter={() => (isHovered = true)}
onmouseleave={() => (isHovered = false)}
>
{#if pkg.popular}
<div class="absolute -top-3 right-4 rounded-xl bg-mana px-3 py-1 text-xs font-bold text-white">
<div class="package-card__badge">
{popularLabel}
</div>
{/if}
<!-- Package Name -->
<h3 class="mb-4 text-center text-lg font-bold text-theme">
<h3 class="package-card__title">
{pkg.name}
</h3>
<!-- Three column layout -->
<div class="mb-5 flex justify-between gap-2">
<div class="package-card__grid">
<!-- Mana Icon with background -->
<div
class="flex aspect-square flex-1 items-center justify-center rounded-xl bg-menu"
style="min-height: 80px;"
>
<div class="package-card__cell">
<div
class="flex items-center justify-center rounded-lg"
class="package-card__icon-wrapper"
style="width: {packageStyles.bgSize}; height: {packageStyles.bgSize}; background-color: {packageStyles.bg};"
>
<ManaIcon size={32} color={packageStyles.icon} />
@ -77,25 +73,19 @@
</div>
<!-- Mana Amount -->
<div
class="flex aspect-square flex-1 flex-col items-center justify-center rounded-xl bg-menu"
style="min-height: 80px;"
>
<p class="mb-0.5 text-2xl font-bold text-theme">
<div class="package-card__cell">
<p class="package-card__value">
{pkg.manaAmount}
</p>
<p class="text-center text-xs text-theme-secondary">{manaLabel}</p>
<p class="package-card__label">{manaLabel}</p>
</div>
<!-- Price -->
<div
class="flex aspect-square flex-1 flex-col items-center justify-center rounded-xl bg-menu"
style="min-height: 80px;"
>
<p class="text-xl font-bold text-theme">
<div class="package-card__cell">
<p class="package-card__price">
{formatPrice(pkg)}
</p>
<p class="mt-0.5 text-[10px] text-theme-secondary">{oneTimeLabel}</p>
<p class="package-card__sublabel">{oneTimeLabel}</p>
</div>
</div>
@ -107,3 +97,136 @@
variant={pkg.popular ? 'accent' : 'primary'}
/>
</div>
<style>
.package-card {
position: relative;
padding: 1rem;
border-radius: 0.75rem;
transition: all 0.2s ease;
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
min-width: 0;
overflow: hidden;
}
:global(.dark) .package-card {
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.package-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
:global(.dark) .package-card:hover {
background: rgba(255, 255, 255, 0.12);
}
.package-card--popular {
border: 2px solid hsl(var(--primary, 221 83% 53%));
}
.package-card__badge {
position: absolute;
top: 0.75rem;
right: 0.75rem;
padding: 0.25rem 0.75rem;
border-radius: 9999px;
font-size: 0.625rem;
font-weight: 600;
color: white;
background: hsl(var(--primary, 221 83% 53%));
z-index: 1;
}
.package-card__title {
margin: 1.5rem 0 1rem 0;
text-align: center;
font-size: 1.125rem;
font-weight: 600;
color: hsl(var(--foreground));
}
.package-card__grid {
display: flex;
justify-content: space-between;
gap: 0.375rem;
margin-bottom: 1.25rem;
}
.package-card__cell {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0.5rem;
min-height: 70px;
min-width: 0;
border-radius: 0.75rem;
background: rgba(0, 0, 0, 0.03);
}
:global(.dark) .package-card__cell {
background: rgba(255, 255, 255, 0.05);
}
.package-card__icon-wrapper {
display: flex;
align-items: center;
justify-content: center;
border-radius: 0.5rem;
}
.package-card__value {
margin: 0 0 0.125rem 0;
font-size: 1.25rem;
font-weight: 700;
color: hsl(var(--foreground));
white-space: nowrap;
}
.package-card__price {
margin: 0;
font-size: 1rem;
font-weight: 700;
color: hsl(var(--foreground));
white-space: nowrap;
}
.package-card__label {
margin: 0;
font-size: 0.625rem;
color: hsl(var(--muted-foreground));
text-align: center;
}
.package-card__sublabel {
margin: 0.125rem 0 0 0;
font-size: 0.5rem;
color: hsl(var(--muted-foreground));
}
@media (min-width: 640px) {
.package-card__value {
font-size: 1.5rem;
}
.package-card__price {
font-size: 1.25rem;
}
.package-card__label {
font-size: 0.75rem;
}
.package-card__sublabel {
font-size: 0.625rem;
}
}
</style>

View file

@ -29,21 +29,15 @@
<button
{disabled}
onclick={disabled ? undefined : onclick}
class="flex w-full h-12 items-center justify-between rounded-lg border px-4 font-medium transition-all duration-200"
class:bg-mana={variant === 'accent' && !disabled}
class:border-mana={variant === 'accent' && !disabled}
class:text-white={variant === 'accent' && !disabled}
class:bg-menu={variant === 'primary' && !disabled}
class:border-theme={variant === 'primary' && !disabled}
class:text-theme={variant === 'primary' && !disabled}
class:bg-content={variant === 'secondary' && !disabled}
class:hover:bg-menu-hover={!disabled}
class:opacity-50={disabled}
class:cursor-not-allowed={disabled}
class="subscription-button"
class:subscription-button--primary={variant === 'primary'}
class:subscription-button--secondary={variant === 'secondary'}
class:subscription-button--accent={variant === 'accent'}
class:subscription-button--disabled={disabled}
>
<div class="flex items-center justify-center">
<div class="subscription-button__content">
<svg
class="mr-2 h-4 w-4"
class="subscription-button__icon subscription-button__icon--left"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
@ -57,7 +51,7 @@
</div>
<svg
class="ml-2 h-4 w-4"
class="subscription-button__icon subscription-button__icon--right"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
@ -68,3 +62,90 @@
<path d={iconPaths[iconName] || iconPaths['arrow-forward-outline']} />
</svg>
</button>
<style>
.subscription-button {
display: flex;
width: 100%;
height: 3rem;
align-items: center;
justify-content: space-between;
padding: 0 1rem;
border-radius: 0.5rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.subscription-button--primary {
background: rgba(0, 0, 0, 0.05);
border: 1px solid rgba(0, 0, 0, 0.1);
color: hsl(var(--foreground));
}
:global(.dark) .subscription-button--primary {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.15);
}
.subscription-button--primary:hover:not(.subscription-button--disabled) {
background: rgba(0, 0, 0, 0.08);
}
:global(.dark) .subscription-button--primary:hover:not(.subscription-button--disabled) {
background: rgba(255, 255, 255, 0.15);
}
.subscription-button--secondary {
background: rgba(255, 255, 255, 0.8);
border: 1px solid rgba(0, 0, 0, 0.1);
color: hsl(var(--foreground));
}
:global(.dark) .subscription-button--secondary {
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.subscription-button--secondary:hover:not(.subscription-button--disabled) {
background: rgba(255, 255, 255, 0.9);
}
:global(.dark) .subscription-button--secondary:hover:not(.subscription-button--disabled) {
background: rgba(255, 255, 255, 0.12);
}
.subscription-button--accent {
background: hsl(var(--primary, 221 83% 53%));
border: 1px solid hsl(var(--primary, 221 83% 53%));
color: white;
}
.subscription-button--accent:hover:not(.subscription-button--disabled) {
filter: brightness(1.1);
}
.subscription-button--disabled {
opacity: 0.5;
cursor: not-allowed;
}
.subscription-button__content {
display: flex;
align-items: center;
justify-content: center;
}
.subscription-button__icon {
width: 1rem;
height: 1rem;
}
.subscription-button__icon--left {
margin-right: 0.5rem;
}
.subscription-button__icon--right {
margin-left: 0.5rem;
}
</style>

View file

@ -59,38 +59,34 @@
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="relative rounded-xl p-4 transition-all duration-200 bg-content border hover:-translate-y-0.5 hover:shadow-lg"
class:border-2={isCurrentPlan}
class:border-mana={isCurrentPlan || plan.popular}
class:border-theme={!isCurrentPlan && !plan.popular}
class="subscription-card"
class:subscription-card--current={isCurrentPlan}
class:subscription-card--popular={plan.popular && !isCurrentPlan}
onmouseenter={() => (isHovered = true)}
onmouseleave={() => (isHovered = false)}
>
{#if isCurrentPlan}
<div class="absolute -top-3 left-4 rounded-xl bg-mana px-3 py-1 text-xs font-bold text-white">
<div class="subscription-card__badge subscription-card__badge--current">
{isLegacy ? legacyPlanLabel : currentPlanLabel}
</div>
{/if}
{#if plan.popular && !isCurrentPlan}
<div class="absolute -top-3 right-4 rounded-xl bg-mana px-3 py-1 text-xs font-bold text-white">
<div class="subscription-card__badge subscription-card__badge--popular">
{popularLabel}
</div>
{/if}
<!-- Tier Name -->
<h3 class="mb-4 text-center text-lg font-bold text-theme">
<h3 class="subscription-card__title">
{plan.name}
</h3>
<!-- Three column layout -->
<div class="mb-5 flex justify-between gap-2">
<div class="subscription-card__grid">
<!-- Mana Icon with background -->
<div
class="flex aspect-square flex-1 items-center justify-center rounded-xl bg-menu"
style="min-height: 80px;"
>
<div class="subscription-card__cell">
<div
class="flex items-center justify-center rounded-lg"
class="subscription-card__icon-wrapper"
style="width: {tierStyles.bgSize}; height: {tierStyles.bgSize}; background-color: {tierStyles.bg};"
>
<ManaIcon size={32} color={tierStyles.icon} />
@ -98,29 +94,23 @@
</div>
<!-- Mana Amount -->
<div
class="flex aspect-square flex-1 flex-col items-center justify-center rounded-xl bg-menu"
style="min-height: 80px;"
>
<p class="mb-0.5 text-2xl font-bold text-theme">
<div class="subscription-card__cell">
<p class="subscription-card__value">
{plan.monthlyMana}
</p>
<p class="text-center text-xs text-theme-secondary">{perMonthLabel}</p>
<p class="subscription-card__label">{perMonthLabel}</p>
</div>
<!-- Price -->
<div
class="flex aspect-square flex-1 flex-col items-center justify-center rounded-xl bg-menu"
style="min-height: 80px;"
>
<p class="text-xl font-bold text-theme">
<div class="subscription-card__cell">
<p class="subscription-card__price">
{formatPrice(plan)}
</p>
<p class="mt-0.5 text-xs text-theme-secondary">
<p class="subscription-card__label">
{plan.billingCycle === 'yearly' ? perYearLabel : perMonthLabel}
</p>
{#if plan.billingCycle === 'yearly' && plan.monthlyEquivalent}
<p class="mt-0 text-[9px] text-theme-secondary">
<p class="subscription-card__sublabel">
({plan.monthlyEquivalent.toFixed(2).replace('.', ',')}{monthlyEquivalentLabel})
</p>
{/if}
@ -138,3 +128,147 @@
/>
{/if}
</div>
<style>
.subscription-card {
position: relative;
padding: 1.25rem;
border-radius: 1rem;
transition: all 0.2s ease;
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
min-width: 0;
overflow: hidden;
}
:global(.dark) .subscription-card {
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.subscription-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
:global(.dark) .subscription-card:hover {
background: rgba(255, 255, 255, 0.12);
}
.subscription-card--current {
border: 2px solid hsl(var(--primary, 221 83% 53%));
}
.subscription-card--popular {
border: 2px solid hsl(var(--primary, 221 83% 53%));
}
.subscription-card__badge {
position: absolute;
top: 0.75rem;
padding: 0.25rem 0.75rem;
border-radius: 9999px;
font-size: 0.625rem;
font-weight: 600;
color: white;
background: hsl(var(--primary, 221 83% 53%));
z-index: 1;
}
.subscription-card__badge--current {
left: 0.75rem;
}
.subscription-card__badge--popular {
right: 0.75rem;
}
.subscription-card__title {
margin: 1.5rem 0 1rem 0;
text-align: center;
font-size: 1.125rem;
font-weight: 600;
color: hsl(var(--foreground));
}
.subscription-card__grid {
display: flex;
justify-content: space-between;
gap: 0.375rem;
margin-bottom: 1.25rem;
}
.subscription-card__cell {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0.5rem;
min-height: 70px;
min-width: 0;
border-radius: 0.75rem;
background: rgba(0, 0, 0, 0.03);
}
:global(.dark) .subscription-card__cell {
background: rgba(255, 255, 255, 0.05);
}
.subscription-card__icon-wrapper {
display: flex;
align-items: center;
justify-content: center;
border-radius: 0.5rem;
}
.subscription-card__value {
margin: 0 0 0.25rem 0;
font-size: 1.25rem;
font-weight: 700;
color: hsl(var(--foreground));
white-space: nowrap;
}
.subscription-card__price {
margin: 0;
font-size: 1rem;
font-weight: 700;
color: hsl(var(--foreground));
white-space: nowrap;
}
.subscription-card__label {
margin: 0;
font-size: 0.625rem;
color: hsl(var(--muted-foreground));
text-align: center;
}
.subscription-card__sublabel {
margin: 0.125rem 0 0 0;
font-size: 0.5rem;
color: hsl(var(--muted-foreground));
}
@media (min-width: 640px) {
.subscription-card__value {
font-size: 1.5rem;
}
.subscription-card__price {
font-size: 1.25rem;
}
.subscription-card__label {
font-size: 0.75rem;
}
.subscription-card__sublabel {
font-size: 0.625rem;
}
}
</style>

View file

@ -35,16 +35,16 @@
currentMana <= 5 && currentMana > 0 ? Math.max(1, calculatedPercentage) : calculatedPercentage;
</script>
<div class="rounded-2xl p-5 bg-content border border-theme shadow-lg">
<div class="usage-card">
<!-- Mana Progress Bar -->
<div>
<div class="mb-4 flex items-start justify-between">
<div class="flex-1">
<h2 class="text-xl font-bold text-theme">{title || yourManaLabel}</h2>
<div class="usage-card__header">
<div class="usage-card__title-wrapper">
<h2 class="usage-card__title">{title || yourManaLabel}</h2>
</div>
<div class="flex items-end">
<div class="self-start rounded-xl px-4 py-1.5 bg-menu">
<p class="text-xl font-bold text-theme">
<div class="usage-card__value-wrapper">
<div class="usage-card__value-badge">
<p class="usage-card__value">
{formattedCurrentMana}
</p>
</div>
@ -52,19 +52,19 @@
</div>
<!-- Progress Bar -->
<div class="relative mb-2 h-4 overflow-hidden rounded-lg bg-menu">
<div class="usage-card__progress-track">
<div
class="h-full rounded-lg"
style="width: {availablePercentage}%; background: linear-gradient(90deg, #4287f5 0%, #66B2FF 100%); box-shadow: 0 0 4px #4287f580;"
class="usage-card__progress-fill"
style="width: {availablePercentage}%;"
></div>
</div>
<!-- Percentage -->
<div class="flex justify-between">
<p class="text-sm font-medium text-theme-secondary">
<div class="usage-card__stats">
<p class="usage-card__stat">
{availablePercentage}% {availableLabel}
</p>
<p class="text-sm font-medium text-theme-secondary">
<p class="usage-card__stat">
{formattedUsedMana}
{consumedLabel}
</p>
@ -72,11 +72,121 @@
<!-- Current Plan -->
{#if currentPlan}
<div class="mt-3 border-t border-theme pt-3">
<p class="text-center text-sm font-medium text-theme-secondary">
<div class="usage-card__plan">
<p class="usage-card__plan-text">
{currentPlanLabel}: {currentPlan}
</p>
</div>
{/if}
</div>
</div>
<style>
.usage-card {
position: relative;
padding: 1.25rem;
border-radius: 1rem;
transition: all 0.2s ease;
background: rgba(255, 255, 255, 0.85);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
:global(.dark) .usage-card {
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.usage-card__header {
margin-bottom: 1rem;
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.usage-card__title-wrapper {
flex: 1;
}
.usage-card__title {
margin: 0;
font-size: 1.25rem;
font-weight: 700;
color: hsl(var(--foreground));
}
.usage-card__value-wrapper {
display: flex;
align-items: flex-end;
}
.usage-card__value-badge {
align-self: flex-start;
border-radius: 0.75rem;
padding: 0.375rem 1rem;
background: rgba(0, 0, 0, 0.05);
}
:global(.dark) .usage-card__value-badge {
background: rgba(255, 255, 255, 0.1);
}
.usage-card__value {
margin: 0;
font-size: 1.25rem;
font-weight: 700;
color: hsl(var(--foreground));
}
.usage-card__progress-track {
position: relative;
margin-bottom: 0.5rem;
height: 1rem;
overflow: hidden;
border-radius: 0.5rem;
background: rgba(0, 0, 0, 0.05);
}
:global(.dark) .usage-card__progress-track {
background: rgba(255, 255, 255, 0.1);
}
.usage-card__progress-fill {
height: 100%;
border-radius: 0.5rem;
background: linear-gradient(90deg, #4287f5 0%, #66B2FF 100%);
box-shadow: 0 0 4px rgba(66, 135, 245, 0.5);
}
.usage-card__stats {
display: flex;
justify-content: space-between;
}
.usage-card__stat {
margin: 0;
font-size: 0.875rem;
font-weight: 500;
color: hsl(var(--muted-foreground));
}
.usage-card__plan {
margin-top: 0.75rem;
border-top: 1px solid rgba(0, 0, 0, 0.1);
padding-top: 0.75rem;
}
:global(.dark) .usage-card__plan {
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.usage-card__plan-text {
margin: 0;
text-align: center;
font-size: 0.875rem;
font-weight: 500;
color: hsl(var(--muted-foreground));
}
</style>

View file

@ -84,35 +84,43 @@
<title>Mana - {appName}</title>
</svelte:head>
<div class="flex h-full flex-col">
<div class="subscription-page">
<!-- Content Area -->
<div class="flex-1 overflow-y-auto">
<div class="mx-auto max-w-5xl pb-12">
<h1 class="mb-8 text-3xl font-bold text-theme">{pageTitle}</h1>
<div class="subscription-page__content">
<div class="subscription-page__container">
<!-- Header -->
<div class="subscription-page__header">
<div class="subscription-page__icon">
<svg viewBox="0 0 24 24" fill="currentColor" class="w-10 h-10">
<path d="M12.3 1c.03.05 7.3 9.67 7.3 13.7 0 4.03-3.27 7.3-7.3 7.3S5 18.73 5 14.7C5 10.66 12.3 1 12.3 1zm0 6.4c-.02.03-3.65 4.83-3.65 6.84 0 2.02 1.64 3.65 3.65 3.65s3.65-1.64 3.65-3.65c0-2.01-3.62-6.81-3.65-6.84z" />
</svg>
</div>
<h1 class="subscription-page__title">{pageTitle}</h1>
<p class="subscription-page__subtitle">Wähle das passende Paket für deine Bedürfnisse</p>
</div>
<!-- Active Section (Usage & Costs) -->
<section class="mb-8">
<div class="mb-4">
<section class="subscription-page__section">
<div class="subscription-page__usage-grid">
<UsageCard {usageData} currentPlan={currentPlanName()} />
</div>
<div class="mb-4">
<CostCard {costs} />
</div>
</section>
<!-- Billing Toggle -->
<BillingToggle
{billingCycle}
onChange={(cycle: BillingCycle) => (billingCycle = cycle)}
{yearlyDiscount}
/>
<div class="subscription-page__toggle">
<BillingToggle
{billingCycle}
onChange={(cycle: BillingCycle) => (billingCycle = cycle)}
{yearlyDiscount}
/>
</div>
<!-- Subscriptions Section -->
<section class="mb-12 pt-2">
<h2 class="mb-6 text-2xl font-bold text-theme">{subscriptionsTitle}</h2>
<section class="subscription-page__section">
<h2 class="subscription-page__section-title">{subscriptionsTitle}</h2>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3">
<div class="subscription-page__cards-grid">
<!-- Free Tier -->
<SubscriptionCard
plan={subscriptions.find((plan) => plan.id === 'free')!}
@ -132,10 +140,10 @@
</section>
<!-- One-time Purchases Section -->
<section class="mb-12">
<h2 class="mb-6 text-2xl font-bold text-theme">{packagesTitle}</h2>
<section class="subscription-page__section">
<h2 class="subscription-page__section-title">{packagesTitle}</h2>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
<div class="subscription-page__cards-grid">
{#each packages as pkg}
<PackageCard package={pkg} onSelect={onBuyPackage} />
{/each}
@ -144,3 +152,128 @@
</div>
</div>
</div>
<style>
.subscription-page {
display: flex;
flex-direction: column;
min-height: 100%;
width: 100%;
}
.subscription-page__content {
flex: 1;
overflow-x: hidden;
overflow-y: auto;
padding: 1rem;
width: 100%;
box-sizing: border-box;
}
.subscription-page__container {
max-width: 72rem;
margin: 0 auto;
padding-bottom: 3rem;
width: 100%;
box-sizing: border-box;
}
.subscription-page__header {
text-align: center;
margin-bottom: 2.5rem;
}
.subscription-page__icon {
width: 5rem;
height: 5rem;
margin: 0 auto 1.5rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: 1rem;
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
color: hsl(var(--primary, 221 83% 53%));
}
:global(.dark) .subscription-page__icon {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.subscription-page__title {
font-size: 1.875rem;
font-weight: 600;
color: hsl(var(--foreground));
margin: 0 0 0.75rem 0;
}
.subscription-page__subtitle {
font-size: 1rem;
color: hsl(var(--muted-foreground));
margin: 0;
}
.subscription-page__section {
margin-bottom: 2.5rem;
}
.subscription-page__section-title {
font-size: 1.25rem;
font-weight: 600;
color: hsl(var(--foreground));
margin: 0 0 1.5rem 0;
}
.subscription-page__usage-grid {
display: grid;
grid-template-columns: 1fr;
gap: 1rem;
}
@media (min-width: 768px) {
.subscription-page__usage-grid {
grid-template-columns: 1fr 1fr;
}
}
.subscription-page__toggle {
display: flex;
justify-content: center;
margin-bottom: 2rem;
}
.subscription-page__cards-grid {
display: grid;
grid-template-columns: 1fr;
gap: 1.5rem;
}
@media (min-width: 480px) {
.subscription-page__cards-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (min-width: 768px) {
.subscription-page__cards-grid {
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem;
}
}
@media (min-width: 1024px) {
.subscription-page__cards-grid {
grid-template-columns: repeat(3, 1fr);
}
}
@media (min-width: 1280px) {
.subscription-page__cards-grid {
grid-template-columns: repeat(4, 1fr);
}
}
</style>