1 Commits

Author SHA1 Message Date
Krystie
4f03b8cf47 desloppify: extract shared Premium features and move component data outside render
- PricingCards.tsx: Extract repeated Premium features array to PREMIUM_FEATURES constant
- Footer.tsx: Move footerSections, socialLinks, and CURRENT_YEAR outside component to avoid recreation on every render
2026-05-01 02:41:32 -07:00
2 changed files with 55 additions and 64 deletions

View File

@@ -1,9 +1,6 @@
import Link from 'next/link'; import Link from 'next/link';
import Image from 'next/image'; import Image from 'next/image';
export default function Footer() {
const currentYear = new Date().getFullYear();
const footerSections = [ const footerSections = [
{ {
title: 'Product', title: 'Product',
@@ -45,6 +42,9 @@ export default function Footer() {
}, },
]; ];
const CURRENT_YEAR = new Date().getFullYear();
export default function Footer() {
return ( return (
<footer className="border-t border-surface-700/50 bg-surface-950"> <footer className="border-t border-surface-700/50 bg-surface-950">
<div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-12"> <div className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-12">
@@ -112,7 +112,7 @@ export default function Footer() {
<div className="border-t border-surface-700/50 pt-8"> <div className="border-t border-surface-700/50 pt-8">
<div className="flex flex-col sm:flex-row items-center justify-center gap-3"> <div className="flex flex-col sm:flex-row items-center justify-center gap-3">
<p className="text-sm text-surface-500"> <p className="text-sm text-surface-500">
&copy; {currentYear} DashCaddy. All rights reserved. A product by &copy; {CURRENT_YEAR} DashCaddy. All rights reserved. A product by
</p> </p>
<Image <Image
src="/images/samiahmed7777-logo.png" src="/images/samiahmed7777-logo.png"

View File

@@ -14,6 +14,13 @@ type Plan = {
features: string[]; features: string[];
}; };
// Premium features shared across all paid plans
const PREMIUM_FEATURES = [
'Auto-Login SSO',
'Recipes (multi-container stack deployment)',
'Docker Swarm orchestration'
] as const;
export default function PricingCards() { export default function PricingCards() {
const [loadingPlan, setLoadingPlan] = useState<string | null>(null); const [loadingPlan, setLoadingPlan] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
@@ -40,11 +47,7 @@ export default function PricingCards() {
price: '$25', price: '$25',
period: 'per month', period: 'per month',
description: 'Premium feature access for one month.', description: 'Premium feature access for one month.',
features: [ features: [...PREMIUM_FEATURES]
'Auto-Login SSO',
'Recipes (multi-container stack deployment)',
'Docker Swarm orchestration'
]
}, },
{ {
code: 'premium_3m', code: 'premium_3m',
@@ -54,11 +57,7 @@ export default function PricingCards() {
savings: 'Best short-term value', savings: 'Best short-term value',
description: 'A better value plan for regular use.', description: 'A better value plan for regular use.',
highlighted: true, highlighted: true,
features: [ features: [...PREMIUM_FEATURES]
'Auto-Login SSO',
'Recipes (multi-container stack deployment)',
'Docker Swarm orchestration'
]
}, },
{ {
code: 'premium_6m', code: 'premium_6m',
@@ -67,11 +66,7 @@ export default function PricingCards() {
period: 'every 6 months', period: 'every 6 months',
savings: 'Strong loyalty pricing', savings: 'Strong loyalty pricing',
description: 'The commitment plan with aggressive value.', description: 'The commitment plan with aggressive value.',
features: [ features: [...PREMIUM_FEATURES]
'Auto-Login SSO',
'Recipes (multi-container stack deployment)',
'Docker Swarm orchestration'
]
}, },
{ {
code: 'premium_12m', code: 'premium_12m',
@@ -80,11 +75,7 @@ export default function PricingCards() {
period: 'per year', period: 'per year',
savings: 'Best overall value', savings: 'Best overall value',
description: 'The best-value annual Premium plan.', description: 'The best-value annual Premium plan.',
features: [ features: [...PREMIUM_FEATURES]
'Auto-Login SSO',
'Recipes (multi-container stack deployment)',
'Docker Swarm orchestration'
]
} }
], []); ], []);