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
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
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 footerSections = [
|
||||||
const currentYear = new Date().getFullYear();
|
|
||||||
|
|
||||||
const footerSections = [
|
|
||||||
{
|
{
|
||||||
title: 'Product',
|
title: 'Product',
|
||||||
links: [
|
links: [
|
||||||
@@ -31,9 +28,9 @@ export default function Footer() {
|
|||||||
{ label: 'Terms of Service', href: '#' },
|
{ label: 'Terms of Service', href: '#' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const socialLinks = [
|
const socialLinks = [
|
||||||
{
|
{
|
||||||
icon: (
|
icon: (
|
||||||
<svg className="h-5 w-5" fill="currentColor" viewBox="0 0 24 24">
|
<svg className="h-5 w-5" fill="currentColor" viewBox="0 0 24 24">
|
||||||
@@ -43,8 +40,11 @@ export default function Footer() {
|
|||||||
label: 'Discord',
|
label: 'Discord',
|
||||||
href: '#',
|
href: '#',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
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">
|
||||||
© {currentYear} DashCaddy. All rights reserved. A product by
|
© {CURRENT_YEAR} DashCaddy. All rights reserved. A product by
|
||||||
</p>
|
</p>
|
||||||
<Image
|
<Image
|
||||||
src="/images/samiahmed7777-logo.png"
|
src="/images/samiahmed7777-logo.png"
|
||||||
|
|||||||
@@ -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'
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
], []);
|
], []);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user