@@ -4,37 +4,71 @@ import { Field } from "../components/ui/field";
4
4
import { Button } from "../components/ui/button" ;
5
5
import "../styles/Homepage.css" ;
6
6
import { useNavigate } from "react-router-dom" ;
7
-
7
+ import { Toaster , toaster } from "../components/ui/toaster" ;
8
8
const HomePage = ( ) => {
9
+ const storedAuth = JSON . parse ( localStorage . getItem ( "auth" ) ) ;
9
10
const navigate = useNavigate ( ) ;
10
11
12
+ const handleAuthentificationCheck = ( ) => {
13
+ console . log ( "token: " , storedAuth ) ;
14
+ if ( ! storedAuth ) {
15
+ toaster . create ( {
16
+ title : "Sign In Required!" ,
17
+ description : "You must be signed in to proceed with this request." ,
18
+ type : "warning" ,
19
+ duration : 4000 ,
20
+ action : {
21
+ label : "x" ,
22
+ } ,
23
+ } ) ;
24
+ return ;
25
+ } else {
26
+ navigate ( "/share-project" ) ;
27
+ }
28
+ } ;
29
+
11
30
return (
12
31
< div className = "sections-container" >
13
- < div className = 'section1' >
14
-
15
- < div className = "content-area" >
16
- < div className = "content-area-responsive" >
17
- < div className = "title-responsive" >
18
- < div className = "build-title" >
32
+ < div className = "section1" >
33
+ < div className = "content-area" >
34
+ < div className = "content-area-responsive" >
35
+ < div className = "title-responsive" >
36
+ < div className = "build-title" >
19
37
< img className = "cycle" src = "./images/cycle.png" > </ img >
20
- < h1 > Build.< br /> Share.< br /> Review.< br /> Repeat.</ h1 >
21
- </ div >
22
- < p className = "top-text" > Showcase your work and connect with peers who can help you reach the next level.</ p >
23
- </ div >
24
- < div className = "button-area" >
25
- < button
26
- className = "share-button"
27
- onClick = { ( ) => navigate ( '/share-project' ) } >
28
- SHARE A PROJECT</ button >
29
- < button className = "explore-button"
30
- onClick = { ( ) => navigate ( '/explore-project' ) } >
31
- EXPLORE PROJECTS</ button >
32
- </ div >
33
- </ div >
38
+ < h1 >
39
+ Build.
40
+ < br /> Share.
41
+ < br /> Review.
42
+ < br /> Repeat.
43
+ </ h1 >
44
+ </ div >
45
+ < p className = "top-text" >
46
+ Showcase your work and connect with peers who can help you reach
47
+ the next level.
48
+ </ p >
49
+ </ div >
50
+ < div className = "button-area" >
51
+ < button
52
+ className = "share-button"
53
+ onClick = { ( ) => handleAuthentificationCheck ( ) }
54
+ >
55
+ SHARE A PROJECT
56
+ </ button >
57
+ < button
58
+ className = "explore-button"
59
+ onClick = { ( ) => navigate ( "/explore-project" ) }
60
+ >
61
+ EXPLORE PROJECTS
62
+ </ button >
34
63
</ div >
35
- < img className = "section-image" src = "./images/sectionimg-1.png" > </ img >
64
+ </ div >
36
65
</ div >
37
- < p className = "top-text-2" > Showcase your work and connect with peers who can help you reach the next level.</ p >
66
+ < img className = "section-image" src = "./images/sectionimg-1.png" > </ img >
67
+ </ div >
68
+ < p className = "top-text-2" >
69
+ Showcase your work and connect with peers who can help you reach the
70
+ next level.
71
+ </ p >
38
72
< div className = "home-data-rectangle" >
39
73
< p > PROJECTS SHARED: 1,024+</ p >
40
74
< p > REVIEWS GIVEN: 5,678+ </ p >
@@ -80,6 +114,7 @@ const HomePage = () => {
80
114
< Button className = "register-button" size = "md" >
81
115
Register NOW!
82
116
</ Button >
117
+ < Toaster />
83
118
</ div >
84
119
</ div >
85
120
< img className = "ctd-logo" src = "./images/ctd-logo.png" > </ img >
0 commit comments