From b0fcf640577d02cc293b46dfcd14884dc6760531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=8E=D1=82=D0=BA=D0=B8=D0=BD=D0=B0=20=D0=94=D0=B0?= =?UTF-8?q?=D1=80=D1=8C=D1=8F=20=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD?= =?UTF-8?q?=D0=B4=D1=80=D0=BE=D0=B2=D0=BD=D0=B0=20=284047910=29?= Date: Wed, 3 Jan 2024 17:56:57 +0400 Subject: [PATCH] feat: add account pages, add static export --- .gitignore | 2 +- messages/de.json | 9 + messages/en.json | 9 + messages/es.json | 9 + messages/fr.json | 9 + messages/it.json | 9 + messages/ru.json | 9 + next.config.js | 5 +- src/app/[locale]/(main)/layout.tsx | 22 +- src/app/[locale]/[userId]/layout.tsx | 71 +++++- .../[userId]/messages/[textId]/page.tsx | 69 ++++++ src/app/[locale]/[userId]/messages/page.tsx | 83 +++++++ .../[locale]/[userId]/notifications/page.tsx | 15 ++ src/app/[locale]/[userId]/page.tsx | 5 + src/app/[locale]/[userId]/sessions/page.tsx | 15 ++ src/app/[locale]/[userId]/settings/page.tsx | 15 ++ src/app/[locale]/[userId]/support/page.tsx | 15 ++ .../[locale]/[userId]/work-with-us/page.tsx | 29 +++ src/app/[locale]/experts/[expertId]/page.tsx | 191 ++++++++++++++++- src/app/[locale]/experts/page.tsx | 175 ++++++++++++++- src/app/[locale]/layout.tsx | 9 +- src/app/[locale]/news/[newsId]/page.tsx | 150 +++++++++++++ src/app/[locale]/news/page.tsx | 202 +++++++++++++++++- src/components/Account/AccountMenu.tsx | 28 ++- src/navigation.ts | 12 +- src/styles/_pages.scss | 2 + tsconfig.json | 18 +- 27 files changed, 1129 insertions(+), 58 deletions(-) create mode 100644 src/app/[locale]/[userId]/messages/[textId]/page.tsx create mode 100644 src/app/[locale]/[userId]/messages/page.tsx create mode 100644 src/app/[locale]/[userId]/notifications/page.tsx create mode 100644 src/app/[locale]/[userId]/page.tsx create mode 100644 src/app/[locale]/[userId]/sessions/page.tsx create mode 100644 src/app/[locale]/[userId]/settings/page.tsx create mode 100644 src/app/[locale]/[userId]/support/page.tsx create mode 100644 src/app/[locale]/[userId]/work-with-us/page.tsx create mode 100644 src/app/[locale]/news/[newsId]/page.tsx diff --git a/.gitignore b/.gitignore index 2a4890b..22c6c12 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ /out/ # production -/build +/dist # ide /.idea diff --git a/messages/de.json b/messages/de.json index 0d993c5..4c3ff5b 100644 --- a/messages/de.json +++ b/messages/de.json @@ -21,6 +21,15 @@ "settings": "Profile Settings", "messages": "Messages", "work-with-us": "Work With Us" + }, + "WorkWithUs": { + "title": "Become a BBuddy Expert", + "insert-info": "Insert your personal information to start your journey as a BBuddy Expert", + "start": "Get Started", + "base-text": "Your info can either be added or amended at anytime" + }, + "Messages": { + "title": "Messages" } }, "Footer": { diff --git a/messages/en.json b/messages/en.json index 9455027..d49cd05 100644 --- a/messages/en.json +++ b/messages/en.json @@ -22,6 +22,15 @@ "settings": "Profile Settings", "messages": "Messages", "work-with-us": "Work With Us" + }, + "WorkWithUs": { + "title": "Become a BBuddy Expert", + "insert-info": "Insert your personal information to start your journey as a BBuddy Expert", + "start": "Get Started", + "base-text": "Your info can either be added or amended at anytime" + }, + "Messages": { + "title": "Messages" } }, "Footer": { diff --git a/messages/es.json b/messages/es.json index 0d993c5..4c3ff5b 100644 --- a/messages/es.json +++ b/messages/es.json @@ -21,6 +21,15 @@ "settings": "Profile Settings", "messages": "Messages", "work-with-us": "Work With Us" + }, + "WorkWithUs": { + "title": "Become a BBuddy Expert", + "insert-info": "Insert your personal information to start your journey as a BBuddy Expert", + "start": "Get Started", + "base-text": "Your info can either be added or amended at anytime" + }, + "Messages": { + "title": "Messages" } }, "Footer": { diff --git a/messages/fr.json b/messages/fr.json index 0d993c5..4c3ff5b 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -21,6 +21,15 @@ "settings": "Profile Settings", "messages": "Messages", "work-with-us": "Work With Us" + }, + "WorkWithUs": { + "title": "Become a BBuddy Expert", + "insert-info": "Insert your personal information to start your journey as a BBuddy Expert", + "start": "Get Started", + "base-text": "Your info can either be added or amended at anytime" + }, + "Messages": { + "title": "Messages" } }, "Footer": { diff --git a/messages/it.json b/messages/it.json index 0d993c5..4c3ff5b 100644 --- a/messages/it.json +++ b/messages/it.json @@ -21,6 +21,15 @@ "settings": "Profile Settings", "messages": "Messages", "work-with-us": "Work With Us" + }, + "WorkWithUs": { + "title": "Become a BBuddy Expert", + "insert-info": "Insert your personal information to start your journey as a BBuddy Expert", + "start": "Get Started", + "base-text": "Your info can either be added or amended at anytime" + }, + "Messages": { + "title": "Messages" } }, "Footer": { diff --git a/messages/ru.json b/messages/ru.json index f7cc538..6cde3f8 100644 --- a/messages/ru.json +++ b/messages/ru.json @@ -21,6 +21,15 @@ "settings": "Настройки профиля", "messages": "Сообщения", "work-with-us": "Работать с нами" + }, + "WorkWithUs": { + "title": "Become a BBuddy Expert", + "insert-info": "Insert your personal information to start your journey as a BBuddy Expert", + "start": "Get Started", + "base-text": "Your info can either be added or amended at anytime" + }, + "Messages": { + "title": "Сообщения" } }, "Footer": { diff --git a/next.config.js b/next.config.js index deff1b7..94984d6 100644 --- a/next.config.js +++ b/next.config.js @@ -13,7 +13,10 @@ const nextConfig = { }, sassOptions: { includePaths: [path.join(__dirname, 'styles')], - } + }, + output: 'export', + cleanDistDir: true, + distDir: 'dist' }; module.exports = withNextIntl(nextConfig); diff --git a/src/app/[locale]/(main)/layout.tsx b/src/app/[locale]/(main)/layout.tsx index 0f3f494..5d60658 100644 --- a/src/app/[locale]/(main)/layout.tsx +++ b/src/app/[locale]/(main)/layout.tsx @@ -1,6 +1,5 @@ import React, { ReactNode } from 'react'; import { getTranslations } from 'next-intl/server'; -import { Header, Footer } from '../../../components/Page'; export async function generateMetadata({ params: { locale } @@ -13,23 +12,18 @@ export async function generateMetadata({ }; } -export default function MainLayout({ children, news, directions, experts, params: { locale } }: { +export default function MainLayout({ children, news, directions, experts }: { children: ReactNode, news: ReactNode, directions: ReactNode, - experts: ReactNode, - params: { locale: string } + experts: ReactNode }) { return ( -
-
-
- {children} - {news} - {directions} - {experts} -
-
-
+ <> + {children} + {news} + {directions} + {experts} + ); }; diff --git a/src/app/[locale]/[userId]/layout.tsx b/src/app/[locale]/[userId]/layout.tsx index dbe0587..107c290 100644 --- a/src/app/[locale]/[userId]/layout.tsx +++ b/src/app/[locale]/[userId]/layout.tsx @@ -1,15 +1,64 @@ -import React from 'react'; +import React, { ReactNode } from 'react'; +import { Metadata } from 'next'; +import { notFound } from 'next/navigation'; +import { useTranslations } from 'next-intl'; import { AccountMenu } from '../../../components/Account'; -export default function Layout({ children }: { children: React.ReactNode }) { +type AccountLayoutProps = { + children: ReactNode; + params: Record; +}; + +export const metadata: Metadata = { + title: 'Bbuddy User Account' +}; + +export function generateStaticParams({ + params: { locale }, +}: { params: { locale: string } }) { + const result: { locale: string, userId: string }[] = []; + const users = [{ userId: '1' }, { userId: '2' }]; + + users.forEach(({ userId }) => { + result.push({ locale, userId }); + }); + + return result; +} + +const ROUTES = ['sessions', 'notifications', 'support', 'information', 'settings', 'messages', 'work-with-us']; +const COUNTS: Record = { + sessions: 12, + notifications: 5, + messages: 113 +}; + + +export default function AccountLayout({ children, params }: AccountLayoutProps) { + if (!params?.userId || isNaN(Number(params?.userId))) notFound(); + + const t = useTranslations('Account'); + + const getMenuConfig = () => ROUTES.map((path) => ({ + path, + title: t(`menu.${path}`), + count: COUNTS[path] || undefined + })); return ( -
- -
{children}
-
- ) -} +
+
+
+
+ +
+
+
+ {children} +
+
+
+
+
+ ); +}; diff --git a/src/app/[locale]/[userId]/messages/[textId]/page.tsx b/src/app/[locale]/[userId]/messages/[textId]/page.tsx new file mode 100644 index 0000000..3eee46f --- /dev/null +++ b/src/app/[locale]/[userId]/messages/[textId]/page.tsx @@ -0,0 +1,69 @@ +import React from 'react'; +import { useTranslations } from 'next-intl'; +import { Link } from '../../../../../navigation'; + +export function generateStaticParams({ + params: { locale, userId }, +}: { params: { locale: string, userId: string } }) { + const result: { locale: string, userId: string, textId: string }[] = []; + const chats = [{ textId: '1' }, { textId: '2' }, { textId: '3' }]; + + chats.forEach(({ textId }) => { + result.push({ locale, userId, textId }); + }); + + return result; +} + +export default function Message({ params }: { params: { userId: string, textId: string } }) { + const t = useTranslations('Account.Messages'); + + return ( + <> +
    +
  1. + + {t('title')} + +
  2. +
  3. {`Person ${params.textId}`}
  4. +
+ +
+
+
+
+
+ +
+
+ 🤩 It all for you! + + 07.09.2022 +
+
+
+
+
+
+ +
+
+ 🤩 It all for you! + 07.09.2022 +
+
+
+
+
+