From e934c7a3baf8205a4021494f744b24abe0c052f8 Mon Sep 17 00:00:00 2001 From: javayhu Date: Tue, 18 Mar 2025 12:17:46 +0800 Subject: [PATCH] refactor: streamline legal page structure and improve layout - Removed unnecessary hostname entry from `next.config.ts`. - Introduced `LegalLayout` component for consistent layout across legal pages. - Added `CookiePolicyPage`, `PrivacyPolicyPage`, and `TermsOfServicePage` components to handle respective legal content with metadata generation. - Updated `PageLayout` component for better naming consistency. - Simplified `AboutPage`, `ContactPage`, and `WaitlistPage` layouts by removing redundant padding. - Cleaned up `PricingPage` by removing unused pricing components. --- next.config.ts | 6 +- .../cookie-policy/page.tsx | 0 .../[locale]/(marketing)/(legal)/layout.tsx | 10 + .../privacy-policy/page.tsx | 0 .../terms-of-service/page.tsx | 0 .../(marketing)/(pages)/about/page.tsx | 246 +----------------- .../(marketing)/(pages)/contact/page.tsx | 2 +- .../[locale]/(marketing)/(pages)/layout.tsx | 2 +- .../(marketing)/(pages)/waitlist/page.tsx | 2 +- src/app/[locale]/(marketing)/pricing/page.tsx | 12 +- 10 files changed, 23 insertions(+), 257 deletions(-) rename src/app/[locale]/(marketing)/{(pages) => (legal)}/cookie-policy/page.tsx (100%) create mode 100644 src/app/[locale]/(marketing)/(legal)/layout.tsx rename src/app/[locale]/(marketing)/{(pages) => (legal)}/privacy-policy/page.tsx (100%) rename src/app/[locale]/(marketing)/{(pages) => (legal)}/terms-of-service/page.tsx (100%) diff --git a/next.config.ts b/next.config.ts index b5e90d2..8e13349 100644 --- a/next.config.ts +++ b/next.config.ts @@ -27,11 +27,7 @@ const nextConfig: NextConfig = { { protocol: "https", hostname: "randomuser.me", - }, - { - protocol: "https", - hostname: "images.pexels.com", - }, + } ], }, }; diff --git a/src/app/[locale]/(marketing)/(pages)/cookie-policy/page.tsx b/src/app/[locale]/(marketing)/(legal)/cookie-policy/page.tsx similarity index 100% rename from src/app/[locale]/(marketing)/(pages)/cookie-policy/page.tsx rename to src/app/[locale]/(marketing)/(legal)/cookie-policy/page.tsx diff --git a/src/app/[locale]/(marketing)/(legal)/layout.tsx b/src/app/[locale]/(marketing)/(legal)/layout.tsx new file mode 100644 index 0000000..68b45c9 --- /dev/null +++ b/src/app/[locale]/(marketing)/(legal)/layout.tsx @@ -0,0 +1,10 @@ +import Container from '@/components/container'; +import { PropsWithChildren } from 'react'; + +export default function LegalLayout({ children }: PropsWithChildren) { + return ( + +
{children}
+
+ ); +} diff --git a/src/app/[locale]/(marketing)/(pages)/privacy-policy/page.tsx b/src/app/[locale]/(marketing)/(legal)/privacy-policy/page.tsx similarity index 100% rename from src/app/[locale]/(marketing)/(pages)/privacy-policy/page.tsx rename to src/app/[locale]/(marketing)/(legal)/privacy-policy/page.tsx diff --git a/src/app/[locale]/(marketing)/(pages)/terms-of-service/page.tsx b/src/app/[locale]/(marketing)/(legal)/terms-of-service/page.tsx similarity index 100% rename from src/app/[locale]/(marketing)/(pages)/terms-of-service/page.tsx rename to src/app/[locale]/(marketing)/(legal)/terms-of-service/page.tsx diff --git a/src/app/[locale]/(marketing)/(pages)/about/page.tsx b/src/app/[locale]/(marketing)/(pages)/about/page.tsx index 03f45ba..b427134 100644 --- a/src/app/[locale]/(marketing)/(pages)/about/page.tsx +++ b/src/app/[locale]/(marketing)/(pages)/about/page.tsx @@ -7,16 +7,15 @@ import { MailIcon } from 'lucide-react'; import { Metadata } from 'next'; import { Locale } from 'next-intl'; import { getTranslations } from 'next-intl/server'; -import Image from 'next/image'; export async function generateMetadata({ params, }: { params: Promise<{ locale: Locale }>; }): Promise { - const {locale} = await params; - const t = await getTranslations({locale, namespace: 'Metadata'}); - const pt = await getTranslations({locale, namespace: 'AboutPage'}); + const { locale } = await params; + const t = await getTranslations({ locale, namespace: 'Metadata' }); + const pt = await getTranslations({ locale, namespace: 'AboutPage' }); return constructMetadata({ title: pt('title') + ' | ' + t('title'), @@ -32,7 +31,7 @@ export default async function AboutPage() { const t = await getTranslations('AboutPage'); return ( -
+
{/* about section */}
@@ -42,7 +41,7 @@ export default async function AboutPage() { @@ -75,239 +74,6 @@ export default async function AboutPage() {
- - {/* images section */} -
-
-
- {/* Mobile view (1 column) */} -
- {images.map((image, index) => ( -
- {image.alt} -
- ))} -
- - {/* Tablet view (2 columns) */} -
-
- {images.slice(0, 4).map((image, index) => ( -
- {image.alt} -
- ))} -
-
- {images.slice(4, 8).map((image, index) => ( -
- {image.alt} -
- ))} -
-
- - {/* Desktop view (4 columns) */} -
- {/* First Column */} -
-
- {images[0].alt} -
-
- {images[1].alt} -
-
- - {/* Second Column */} -
-
- {images[2].alt} -
-
- {images[3].alt} -
-
- {images[4].alt} -
-
- - {/* Third Column */} -
-
- {images[5].alt} -
-
- {images[6].alt} -
-
- - {/* Fourth Column */} -
-
- {images[7].alt} -
-
- {images[8].alt} -
-
-
-
-
-
-
+ ); } - -interface ImagesProps { - image: string; - alt: string; -} - -const images: ImagesProps[] = [ - // first column - { - image: - 'https://images.pexels.com/photos/15372903/pexels-photo-15372903/free-photo-of-computer-setup-with-big-monitor-screen.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - alt: 'setup desktop', - }, - { - image: - 'https://images.pexels.com/photos/1049317/pexels-photo-1049317.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - alt: 'friends smiles', - }, - // second column - { - image: - 'https://images.pexels.com/photos/3712095/pexels-photo-3712095.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - alt: 'grey cat', - }, - { - image: - 'https://images.pexels.com/photos/9293249/pexels-photo-9293249.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - alt: 'home building', - }, - { - image: - 'https://images.pexels.com/photos/375467/pexels-photo-375467.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - alt: 'pizza laptop', - }, - // third column - { - image: - 'https://images.pexels.com/photos/1230302/pexels-photo-1230302.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - alt: 'hike and sunset', - }, - { - image: - 'https://images.pexels.com/photos/5500779/pexels-photo-5500779.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - alt: 'chinese lantern', - }, - // fourth column - { - image: - 'https://images.pexels.com/photos/2090644/pexels-photo-2090644.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - alt: 'the great wheel', - }, - { - image: - 'https://images.pexels.com/photos/7418632/pexels-photo-7418632.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - alt: 'dalmatian', - }, -]; diff --git a/src/app/[locale]/(marketing)/(pages)/contact/page.tsx b/src/app/[locale]/(marketing)/(pages)/contact/page.tsx index 7e170d3..14ada40 100644 --- a/src/app/[locale]/(marketing)/(pages)/contact/page.tsx +++ b/src/app/[locale]/(marketing)/(pages)/contact/page.tsx @@ -28,7 +28,7 @@ export default async function ContactPage() { const t = await getTranslations('ContactPage'); return ( -
+
{/* Header */}

diff --git a/src/app/[locale]/(marketing)/(pages)/layout.tsx b/src/app/[locale]/(marketing)/(pages)/layout.tsx index 68b45c9..daceee6 100644 --- a/src/app/[locale]/(marketing)/(pages)/layout.tsx +++ b/src/app/[locale]/(marketing)/(pages)/layout.tsx @@ -1,7 +1,7 @@ import Container from '@/components/container'; import { PropsWithChildren } from 'react'; -export default function LegalLayout({ children }: PropsWithChildren) { +export default function PageLayout({ children }: PropsWithChildren) { return (
{children}
diff --git a/src/app/[locale]/(marketing)/(pages)/waitlist/page.tsx b/src/app/[locale]/(marketing)/(pages)/waitlist/page.tsx index 72b9a80..67fc6dd 100644 --- a/src/app/[locale]/(marketing)/(pages)/waitlist/page.tsx +++ b/src/app/[locale]/(marketing)/(pages)/waitlist/page.tsx @@ -24,7 +24,7 @@ export default async function WaitlistPage() { const t = await getTranslations('WaitlistPage'); return ( -
+
{/* Header */}

diff --git a/src/app/[locale]/(marketing)/pricing/page.tsx b/src/app/[locale]/(marketing)/pricing/page.tsx index 265d160..322d8ff 100644 --- a/src/app/[locale]/(marketing)/pricing/page.tsx +++ b/src/app/[locale]/(marketing)/pricing/page.tsx @@ -1,6 +1,4 @@ import Pricing3 from '@/components/blocks/pricing/pricing-3'; -import Pricing4 from '@/components/blocks/pricing/pricing-4'; -import Pricing5 from '@/components/blocks/pricing/pricing-5'; import PricingComparator from '@/components/blocks/pricing/pricing-comparator'; import { constructMetadata } from '@/lib/metadata'; import { getBaseUrlWithLocale } from '@/lib/urls/get-base-url'; @@ -13,9 +11,9 @@ export async function generateMetadata({ }: { params: Promise<{ locale: Locale }>; }): Promise { - const {locale} = await params; - const t = await getTranslations({locale, namespace: 'Metadata'}); - const pt = await getTranslations({locale, namespace: 'PricingPage'}); + const { locale } = await params; + const t = await getTranslations({ locale, namespace: 'Metadata' }); + const pt = await getTranslations({ locale, namespace: 'PricingPage' }); return constructMetadata({ title: pt('title') + ' | ' + t('title'), description: pt('description'), @@ -35,10 +33,6 @@ export default async function PricingPage(props: PricingPageProps) { return ( <>
- - - -