From e5c2082bf23c2b04cff99fdd5977a30970937c92 Mon Sep 17 00:00:00 2001 From: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com> Date: Mon, 24 Oct 2022 22:00:48 +0800 Subject: [PATCH] [offers][feat] add landing page and fix comment bugs (#422) * [offers][fix] fix create commnet and update title * [offers][fix] update tab name * [offers][feat] add landing page --- .../src/components/offers/OffersNavigation.ts | 5 +- .../src/components/offers/OffersTitle.tsx | 4 +- .../offers/landing/LeftTextCard.tsx | 54 ++++ .../offers/landing/RightTextCard.tsx | 54 ++++ .../offers/profile/ProfileComments.tsx | 39 ++- .../offers/profile/comments/CommentCard.tsx | 6 +- apps/portal/src/pages/offers/home.tsx | 48 ++++ apps/portal/src/pages/offers/index.tsx | 272 +++++++++++++++--- .../pages/offers/profile/[offerProfileId].tsx | 4 +- apps/portal/src/utils/offers/time.tsx | 6 +- 10 files changed, 443 insertions(+), 49 deletions(-) create mode 100644 apps/portal/src/components/offers/landing/LeftTextCard.tsx create mode 100644 apps/portal/src/components/offers/landing/RightTextCard.tsx create mode 100644 apps/portal/src/pages/offers/home.tsx diff --git a/apps/portal/src/components/offers/OffersNavigation.ts b/apps/portal/src/components/offers/OffersNavigation.ts index cfa314dc..9b340cec 100644 --- a/apps/portal/src/components/offers/OffersNavigation.ts +++ b/apps/portal/src/components/offers/OffersNavigation.ts @@ -1,13 +1,14 @@ import type { ProductNavigationItems } from '~/components/global/ProductNavigation'; const navigation: ProductNavigationItems = [ - { href: '/offers/submit', name: 'Benchmark your offer' }, + { href: '/offers/home', name: 'Home' }, + { href: '/offers/submit', name: 'Analyse your offers' }, ]; const config = { navigation, showGlobalNav: false, - title: 'Tech Offers Repo', + title: 'Offer Profile Repository', titleHref: '/offers', }; diff --git a/apps/portal/src/components/offers/OffersTitle.tsx b/apps/portal/src/components/offers/OffersTitle.tsx index 2668ac4e..52798611 100644 --- a/apps/portal/src/components/offers/OffersTitle.tsx +++ b/apps/portal/src/components/offers/OffersTitle.tsx @@ -3,14 +3,14 @@ export default function OffersTitle() { <>

- Tech Handbook Offers Repo + Offer Profile Repository

Reveal profile stories behind offers
- Benchmark your offers and profiles, learn from other's offer profile, + Click into offers to view profiles, benchmark your offers and profiles, and discuss with the community
diff --git a/apps/portal/src/components/offers/landing/LeftTextCard.tsx b/apps/portal/src/components/offers/landing/LeftTextCard.tsx new file mode 100644 index 00000000..27886018 --- /dev/null +++ b/apps/portal/src/components/offers/landing/LeftTextCard.tsx @@ -0,0 +1,54 @@ +import type { ReactNode } from 'react'; + +type LeftTextCardProps = Readonly<{ + description: string; + icon: ReactNode; + imageAlt: string; + imageSrc: string; + title: string; +}>; + +const baseUrl = '/offers/home'; +export default function LeftTextCard({ + description, + icon, + imageAlt, + imageSrc, + title, +}: LeftTextCardProps) { + return ( +
+
+
+
+ + {icon} + +
+
+

+ {title} +

+

{description}

+
+ + Get started + +
+
+
+
+
+
+ {imageAlt} +
+
+
+ ); +} diff --git a/apps/portal/src/components/offers/landing/RightTextCard.tsx b/apps/portal/src/components/offers/landing/RightTextCard.tsx new file mode 100644 index 00000000..551c246a --- /dev/null +++ b/apps/portal/src/components/offers/landing/RightTextCard.tsx @@ -0,0 +1,54 @@ +import type { ReactNode } from 'react'; + +type RightTextCarddProps = Readonly<{ + description: string; + icon: ReactNode; + imageAlt: string; + imageSrc: string; + title: string; +}>; + +const baseUrl = '/offers/home'; +export default function RightTextCard({ + description, + icon, + imageAlt, + imageSrc, + title, +}: RightTextCarddProps) { + return ( +
+
+
+
+ + {icon} + +
+
+

+ {title} +

+

{description}

+
+ + Get started + +
+
+
+
+
+
+ {imageAlt} +
+
+
+ ); +} diff --git a/apps/portal/src/components/offers/profile/ProfileComments.tsx b/apps/portal/src/components/offers/profile/ProfileComments.tsx index 5a8ba614..ebed5bfd 100644 --- a/apps/portal/src/components/offers/profile/ProfileComments.tsx +++ b/apps/portal/src/components/offers/profile/ProfileComments.tsx @@ -142,6 +142,39 @@ export default function ProfileComments({ />

Discussions

+ {isEditable || session?.user?.name ? ( +
+