From f50e33c9be4a6e23408c75105d3a8be306773d6a Mon Sep 17 00:00:00 2001 From: Mitch Chanza Date: Thu, 19 Sep 2024 16:25:33 +0200 Subject: [PATCH 1/3] Add user session management and update related components for user registration flow --- components/public/cards/logo/easyhq-w.svg | 43 ++++++++++ components/public/cards/logo/easyhq.svg | 55 +++++++++++++ components/public/cards/logo/eoh.svg | 48 +++++++++++ components/public/cards/logo/eohw.svg | 36 +++++++++ components/public/cards/logo/iocow.svg | 75 ++++++++++++++++++ components/public/cards/logo/opco.svg | 79 +++++++++++++++++++ components/src/app/public/page.tsx | 30 +++++++ .../CountDown/CountdownComponent.tsx | 13 +-- .../components/CountDown/RegisterAction.tsx | 7 +- components/src/lib/types/UserSession.ts | 11 +++ 10 files changed, 388 insertions(+), 9 deletions(-) create mode 100644 components/public/cards/logo/easyhq-w.svg create mode 100644 components/public/cards/logo/easyhq.svg create mode 100644 components/public/cards/logo/eoh.svg create mode 100644 components/public/cards/logo/eohw.svg create mode 100644 components/public/cards/logo/iocow.svg create mode 100644 components/public/cards/logo/opco.svg create mode 100644 components/src/app/public/page.tsx create mode 100644 components/src/lib/types/UserSession.ts diff --git a/components/public/cards/logo/easyhq-w.svg b/components/public/cards/logo/easyhq-w.svg new file mode 100644 index 0000000..907d324 --- /dev/null +++ b/components/public/cards/logo/easyhq-w.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/public/cards/logo/easyhq.svg b/components/public/cards/logo/easyhq.svg new file mode 100644 index 0000000..1589469 --- /dev/null +++ b/components/public/cards/logo/easyhq.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/public/cards/logo/eoh.svg b/components/public/cards/logo/eoh.svg new file mode 100644 index 0000000..391ae5d --- /dev/null +++ b/components/public/cards/logo/eoh.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/public/cards/logo/eohw.svg b/components/public/cards/logo/eohw.svg new file mode 100644 index 0000000..f5702b9 --- /dev/null +++ b/components/public/cards/logo/eohw.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/components/public/cards/logo/iocow.svg b/components/public/cards/logo/iocow.svg new file mode 100644 index 0000000..84dee4d --- /dev/null +++ b/components/public/cards/logo/iocow.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + diff --git a/components/public/cards/logo/opco.svg b/components/public/cards/logo/opco.svg new file mode 100644 index 0000000..91a3b59 --- /dev/null +++ b/components/public/cards/logo/opco.svg @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + diff --git a/components/src/app/public/page.tsx b/components/src/app/public/page.tsx new file mode 100644 index 0000000..994b1c3 --- /dev/null +++ b/components/src/app/public/page.tsx @@ -0,0 +1,30 @@ +'use client' + +import { IUserSession } from "@/lib/types/UserSession" +import { useSearchParams } from "next/navigation" + +const page = () => { + const mode = useSearchParams().get('mode') + const session: IUserSession = { + user: { + name: 'test', + email: 'test@test.com', + image: 'https://avatars.githubusercontent.com/u/10192985?v=4', + id: '1' + }, + expires: '2024-09-26T12:00:00', + status: 'authenticated' + + } + return ( +
page +
+      {
+        JSON.stringify({ mode, session }, null, 2)
+      }
+    
+
+ ) +} + +export default page \ No newline at end of file diff --git a/components/src/components/CountDown/CountdownComponent.tsx b/components/src/components/CountDown/CountdownComponent.tsx index 6c43a4b..1884271 100644 --- a/components/src/components/CountDown/CountdownComponent.tsx +++ b/components/src/components/CountDown/CountdownComponent.tsx @@ -4,8 +4,8 @@ import React, { useState, useEffect } from 'react'; import { AnimatedBackground } from './AnimatedBackground'; import { Clock, Users, Rocket } from 'lucide-react'; import { RegisterAction } from './RegisterAction'; - -export const CountdownComponent: React.FC<{ targetDate: string,url:string }> = ({ targetDate,url='/api/auth/signup' }) => { +import { IUserSession } from '@/lib/types/UserSession'; +export const CountdownComponent: React.FC<{ targetDate: string, url: string, session?: IUserSession }> = ({ targetDate, url = '/api/auth/signup', session }) => { const [timeLeft, setTimeLeft] = useState<{ [key: string]: number }>({}); const [isClient, setIsClient] = useState(false); @@ -60,8 +60,9 @@ export const CountdownComponent: React.FC<{ targetDate: string,url:string }> = (

Register by 23 September 2024 to secure your spot!

-
- +
+ +
@@ -81,8 +82,8 @@ export const CountdownComponent: React.FC<{ targetDate: string,url:string }> = (
- - + +
); }; diff --git a/components/src/components/CountDown/RegisterAction.tsx b/components/src/components/CountDown/RegisterAction.tsx index 971e091..8b6d0b2 100644 --- a/components/src/components/CountDown/RegisterAction.tsx +++ b/components/src/components/CountDown/RegisterAction.tsx @@ -1,11 +1,12 @@ +import { IUserSession } from '@/lib/types/UserSession' import Link from 'next/link' import React from 'react' -export const RegisterAction: React.FC<{url:string}> = ({url}) => { +export const RegisterAction: React.FC<{url:string, mode?: 'session'|'register', session?: IUserSession}> = ({url, mode="register", session}) => { return (
- - Register Now + + {mode === 'register' ? 'Register Now' : 'Test run'}
) diff --git a/components/src/lib/types/UserSession.ts b/components/src/lib/types/UserSession.ts new file mode 100644 index 0000000..2a0f9a2 --- /dev/null +++ b/components/src/lib/types/UserSession.ts @@ -0,0 +1,11 @@ + +export declare interface IUserSession { + user: { + id: string; + name: string; + email: string; + image: string; + }; + expires: string; + status: string|null; +} \ No newline at end of file From d5b1a349d23c0f2bfa72fbbb330404cff37693c5 Mon Sep 17 00:00:00 2001 From: Mitch Chanza Date: Thu, 19 Sep 2024 16:28:45 +0200 Subject: [PATCH 2/3] update RegisterAction.tsx --- components/src/components/CountDown/RegisterAction.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/components/src/components/CountDown/RegisterAction.tsx b/components/src/components/CountDown/RegisterAction.tsx index 8b6d0b2..e9d9f89 100644 --- a/components/src/components/CountDown/RegisterAction.tsx +++ b/components/src/components/CountDown/RegisterAction.tsx @@ -3,6 +3,7 @@ import Link from 'next/link' import React from 'react' export const RegisterAction: React.FC<{url:string, mode?: 'session'|'register', session?: IUserSession}> = ({url, mode="register", session}) => { + console.log(session) return (
From d69b52db0dff939e8245b3e5558a27abf94cd15f Mon Sep 17 00:00:00 2001 From: Mitch Chanza Date: Thu, 19 Sep 2024 16:31:55 +0200 Subject: [PATCH 3/3] update page.tsx --- components/src/app/public/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/src/app/public/page.tsx b/components/src/app/public/page.tsx index 994b1c3..0b5f41b 100644 --- a/components/src/app/public/page.tsx +++ b/components/src/app/public/page.tsx @@ -3,7 +3,7 @@ import { IUserSession } from "@/lib/types/UserSession" import { useSearchParams } from "next/navigation" -const page = () => { +const PublicPage = () => { const mode = useSearchParams().get('mode') const session: IUserSession = { user: { @@ -27,4 +27,4 @@ const page = () => { ) } -export default page \ No newline at end of file +export default PublicPage \ No newline at end of file