2023-01-29 16:44:02 +01:00
|
|
|
// Dependencies
|
2022-05-25 18:35:20 +02:00
|
|
|
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
|
2023-07-27 21:03:49 +02:00
|
|
|
import { nsMerge } from 'shared/utils.mjs'
|
|
|
|
// Hooks
|
|
|
|
import { useTranslation } from 'next-i18next'
|
2023-07-28 20:28:27 +02:00
|
|
|
import { useAccount } from 'shared/hooks/use-account.mjs'
|
2023-08-01 13:02:14 +02:00
|
|
|
import { useEffect, useState } from 'react'
|
2023-01-29 16:44:02 +01:00
|
|
|
// Components
|
2023-07-27 21:03:49 +02:00
|
|
|
import Head from 'next/head'
|
|
|
|
import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs'
|
2023-05-15 15:57:46 +02:00
|
|
|
import { BareLayout } from 'site/components/layouts/bare.mjs'
|
2023-07-25 19:38:22 +02:00
|
|
|
import { ForceAccountCheck } from 'shared/components/account/force-account-check.mjs'
|
2023-08-01 16:15:11 +02:00
|
|
|
import {
|
|
|
|
OkIcon,
|
2023-08-25 11:25:33 +02:00
|
|
|
NoIcon,
|
2023-08-01 16:15:11 +02:00
|
|
|
DesignIcon,
|
|
|
|
ShowcaseIcon,
|
|
|
|
DocsIcon,
|
|
|
|
HelpIcon,
|
|
|
|
ChatIcon,
|
|
|
|
} from 'shared/components/icons.mjs'
|
2023-07-28 20:28:27 +02:00
|
|
|
import { HowDoesItWorkAnimation } from 'shared/components/animations/how-does-it-work.mjs'
|
2023-08-28 14:28:07 +02:00
|
|
|
import { SignUp, ns as susiNs } from 'shared/components/susi/sign-up.mjs'
|
|
|
|
import { PleaseSubscribe, ns as subNs } from 'shared/components/patrons/please-subscribe.mjs'
|
2023-08-01 16:15:11 +02:00
|
|
|
import Link from 'next/link'
|
2023-07-27 21:03:49 +02:00
|
|
|
|
2023-08-28 14:28:07 +02:00
|
|
|
const ns = nsMerge(pageNs, subNs, susiNs, 'homepage')
|
2022-01-02 17:16:15 +01:00
|
|
|
|
2023-08-25 11:25:33 +02:00
|
|
|
const Card = ({ bg = 'bg-base-200', textColor = 'text-base-content', title, children, icon }) => (
|
|
|
|
<div className={`px-8 ${bg} py-10 rounded-lg block ${textColor} shadow-lg grow`}>
|
|
|
|
<h2 className="mb-4 text-inherit flex flex-row gap-4 justify-between items-center font-medium">
|
|
|
|
{title}
|
|
|
|
{icon}
|
|
|
|
</h2>
|
|
|
|
{children}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
const CardLink = ({
|
|
|
|
bg = 'bg-base-200',
|
|
|
|
textColor = 'text-base-content',
|
|
|
|
href,
|
|
|
|
title,
|
|
|
|
text,
|
|
|
|
icon,
|
|
|
|
}) => (
|
2023-08-01 16:15:11 +02:00
|
|
|
<Link
|
|
|
|
href={href}
|
2023-08-01 18:12:35 +02:00
|
|
|
className={`px-8 ${bg} py-10 rounded-lg block ${textColor}
|
2023-08-29 12:19:47 +02:00
|
|
|
hover:bg-secondary hover:bg-opacity-10 shadow-lg
|
2023-08-01 16:15:11 +02:00
|
|
|
transition-color duration-300 grow`}
|
|
|
|
>
|
2023-08-25 11:25:33 +02:00
|
|
|
<h2 className="mb-4 text-inherit flex flex-row gap-4 justify-between items-center font-medium">
|
2023-08-01 16:15:11 +02:00
|
|
|
{title}
|
2023-08-25 11:25:33 +02:00
|
|
|
{icon}
|
2023-08-01 16:15:11 +02:00
|
|
|
</h2>
|
2023-08-25 11:25:33 +02:00
|
|
|
<p className="font-medium text-inherit italic text-lg">{text}</p>
|
2023-08-01 16:15:11 +02:00
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
|
2023-04-28 21:23:06 +02:00
|
|
|
/*
|
|
|
|
* Each page MUST be wrapped in the PageWrapper component.
|
|
|
|
* You also MUST spread props.page into this wrapper component
|
|
|
|
* when path and locale come from static props (as here)
|
|
|
|
* or set them manually.
|
|
|
|
*/
|
2023-07-27 21:03:49 +02:00
|
|
|
const HomePage = ({ page }) => {
|
|
|
|
const { t } = useTranslation(ns)
|
2023-07-28 20:28:27 +02:00
|
|
|
const { account } = useAccount()
|
2023-08-01 13:02:14 +02:00
|
|
|
const [user, setUser] = useState(false)
|
2023-07-27 21:03:49 +02:00
|
|
|
|
2023-08-01 13:02:14 +02:00
|
|
|
useEffect(() => {
|
|
|
|
// Do this here to avoid hydration issues
|
|
|
|
if (account.username) setUser(account.username)
|
|
|
|
}, [account.username])
|
|
|
|
|
2023-07-27 21:03:49 +02:00
|
|
|
return (
|
|
|
|
<PageWrapper {...page} layout={BareLayout}>
|
|
|
|
<ForceAccountCheck />
|
|
|
|
<Head>
|
2023-07-28 20:28:27 +02:00
|
|
|
<title>FreeSewing.org</title>
|
2023-07-27 21:03:49 +02:00
|
|
|
</Head>
|
|
|
|
|
2023-07-29 21:06:08 +02:00
|
|
|
<div className="max-w-7xl m-auto px-0 -mt-12 mb-24 md:my-24">
|
2023-08-29 12:19:47 +02:00
|
|
|
<div className="text-center mt-20 md:mt-20">
|
|
|
|
<HowDoesItWorkAnimation t={t} />
|
2023-07-29 21:01:26 +02:00
|
|
|
</div>
|
|
|
|
|
2023-07-30 15:55:11 +02:00
|
|
|
<div className="flex flex-col gap-8 md:grid md:grid-cols-2 md:gap-4 mt-12 md:mt-20 md:px-4">
|
2023-08-25 11:25:33 +02:00
|
|
|
<Card
|
|
|
|
title={t('whatIsFreeSewing')}
|
|
|
|
icon={<OkIcon className="w-12 h-12 text-success" stroke={4} />}
|
|
|
|
>
|
|
|
|
<p className="font-medium text-lg">{t('homepage:what1')}</p>
|
|
|
|
<p className="font-medium text-lg">{t('homepage:what3')}</p>
|
|
|
|
</Card>
|
|
|
|
<Card
|
|
|
|
title={t('whatIsFreeSewingNot')}
|
|
|
|
icon={<NoIcon className="w-12 h-12 text-error" stroke={3} />}
|
|
|
|
>
|
|
|
|
<p className="font-medium text-lg">{t('homepage:whatNot1')}</p>
|
|
|
|
<p className="font-medium text-lg">{t('homepage:whatNot2')}</p>
|
|
|
|
</Card>
|
2023-07-28 20:28:27 +02:00
|
|
|
</div>
|
2023-07-27 21:03:49 +02:00
|
|
|
|
2023-08-29 12:19:47 +02:00
|
|
|
<div className="p-1 bg-primary bg-opacity-10 mt-12 rounded-none md:rounded-lg lg:rounded-xl md:shadow-lg md:mx-4 p-8 lg:px-12 md:py-0">
|
|
|
|
<div className="flex flex-col md:gap-8 lg:gap-12 md:flex md:flex-row m-auto">
|
|
|
|
<div className="-mx-4 md:mx-0 md:pt-8 pb-8 lg:py-12 grow m-auto max-w-prose">
|
|
|
|
<SignUp />
|
|
|
|
</div>
|
|
|
|
<div className="-mx-4 md:mx-0 md:mt-0 pt-0 md:pt-8 pb-8 lg:py-12 max-w-prose m-auto m-auto">
|
|
|
|
<h2 className="text-inherit mb-4 hidden md:block">{t('homepage:whyBother')}</h2>
|
|
|
|
<ul>
|
|
|
|
{[1, 2, 3, 4].map((i) => (
|
|
|
|
<li className="flex flex-row gap-2 my-2" key={i}>
|
|
|
|
<OkIcon stroke={4} /> {t(`homepage:why${i}`)}
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-07-27 21:03:49 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-07-30 14:21:39 +02:00
|
|
|
|
2023-08-01 16:15:11 +02:00
|
|
|
<div className="flex flex-col md:grid md:grid-cols-2 gap-4 max-w-7xl m-auto mb-24 px-4">
|
|
|
|
<CardLink
|
2023-08-01 16:17:08 +02:00
|
|
|
href="/designs"
|
2023-08-01 16:15:11 +02:00
|
|
|
title="Designs"
|
2023-08-01 18:16:47 +02:00
|
|
|
icon={<DesignIcon className="w-10 h-10 shrink-0" />}
|
2023-08-01 16:15:11 +02:00
|
|
|
text="Browse our collection of designs, and turn them into sewing patterns that are made-to-measure just for you."
|
|
|
|
/>
|
|
|
|
<CardLink
|
2023-08-01 16:17:08 +02:00
|
|
|
href="/showcase"
|
2023-08-01 16:15:11 +02:00
|
|
|
title="Showcase"
|
2023-08-01 18:16:47 +02:00
|
|
|
icon={<ShowcaseIcon className="w-10 h-10 shrink-0" />}
|
2023-08-01 16:15:11 +02:00
|
|
|
text="Get inspiration from the FreeSewing community, and see how others have applied their creativity to our designs."
|
|
|
|
/>
|
|
|
|
<CardLink
|
2023-08-01 16:17:08 +02:00
|
|
|
href="/docs/guide"
|
2023-08-01 16:15:11 +02:00
|
|
|
title="Getting Started"
|
2023-08-01 18:16:47 +02:00
|
|
|
icon={<DocsIcon className="w-10 h-10 shrink-0" />}
|
2023-08-01 16:15:11 +02:00
|
|
|
text="FreeSewing.org is unlike any sewing pattern website you know. Read this short guide to get the most our of our platform."
|
|
|
|
/>
|
|
|
|
<CardLink
|
2023-08-01 16:17:08 +02:00
|
|
|
href="/docs/faq"
|
2023-08-01 16:15:11 +02:00
|
|
|
title="Frequently Asked Questions"
|
2023-08-01 18:16:47 +02:00
|
|
|
icon={<HelpIcon className="w-10 h-10 shrink-0" />}
|
2023-08-01 16:15:11 +02:00
|
|
|
text="Some of the questions that come up often when people discover our platform are answered here."
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
2023-08-29 12:19:47 +02:00
|
|
|
<div className="lg:px-4 max-w-7xl mx-auto">
|
|
|
|
<PleaseSubscribe />
|
|
|
|
</div>
|
|
|
|
|
2023-08-01 16:15:11 +02:00
|
|
|
<div className="max-w-7xl m-auto mb-24 px-4">
|
|
|
|
<div className="w-full lg:w-1/2 m-auto">
|
|
|
|
<CardLink
|
2023-08-01 16:17:08 +02:00
|
|
|
href="/support"
|
2023-08-01 16:15:11 +02:00
|
|
|
title="Need Help?"
|
2023-08-01 18:16:47 +02:00
|
|
|
icon={<ChatIcon className="w-10 h-10 shrink-0" />}
|
2023-08-01 16:15:11 +02:00
|
|
|
text="While we are all volunteers, we have a good track record of helping people. So don't be shy to reach out."
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-07-27 21:03:49 +02:00
|
|
|
</PageWrapper>
|
|
|
|
)
|
|
|
|
}
|
2022-01-02 17:16:15 +01:00
|
|
|
|
|
|
|
export default HomePage
|
2022-05-25 18:35:20 +02:00
|
|
|
|
|
|
|
export async function getStaticProps({ locale }) {
|
|
|
|
return {
|
|
|
|
props: {
|
2023-07-28 20:28:27 +02:00
|
|
|
...(await serverSideTranslations(locale, ns)),
|
2023-03-26 16:50:46 +02:00
|
|
|
page: {
|
2023-04-28 21:23:06 +02:00
|
|
|
locale,
|
2023-03-26 16:50:46 +02:00
|
|
|
path: [],
|
|
|
|
},
|
2022-12-03 11:25:02 -06:00
|
|
|
},
|
2022-05-25 18:35:20 +02:00
|
|
|
}
|
|
|
|
}
|