Skip to content

Commit e36caa4

Browse files
Merge branch 'main' into fix/mobile-location-popup-bugs
2 parents 8b76714 + 606b0fb commit e36caa4

2 files changed

Lines changed: 48 additions & 20 deletions

File tree

app/src/ModalContent.tsx

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
66

77
import { useEffect, useState } from 'react'
8-
import { TextView } from 'utopia-ui'
8+
import { useNavigate } from 'react-router-dom'
9+
import { TextView, useAuth } from 'utopia-ui'
910

1011
import { config } from './config'
1112

@@ -15,20 +16,35 @@ interface ChapterProps {
1516
}
1617

1718
export function Welcome1({ clickAction1, map }: ChapterProps) {
19+
const { isAuthenticated } = useAuth()
20+
const navigate = useNavigate()
21+
1822
return (
1923
<>
2024
{map.custom_text ? (
2125
<>
2226
<TextView rawText={map.custom_text}></TextView>
23-
<div className='tw:grid'>
24-
<label
25-
className='tw:btn tw:btn-primary tw:place-self-end tw:mt-4'
26-
onClick={() => {
27-
clickAction1()
28-
}}
29-
>
30-
Close
31-
</label>
27+
<div className='tw:grid tw:mt-4'>
28+
{isAuthenticated ? (
29+
<label
30+
className='tw:btn tw:btn-primary tw:place-self-end'
31+
onClick={() => {
32+
clickAction1()
33+
}}
34+
>
35+
Close
36+
</label>
37+
) : (
38+
<label
39+
className='tw:btn tw:btn-primary tw:place-self-end'
40+
onClick={() => {
41+
clickAction1()
42+
void navigate('/login')
43+
}}
44+
>
45+
Login
46+
</label>
47+
)}
3248
</div>
3349
</>
3450
) : (
@@ -45,15 +61,27 @@ export function Welcome1({ clickAction1, map }: ChapterProps) {
4561
Join us and grow the network by adding projects and events to the map.
4662
</p>
4763
<p className='tw:py-1'>Create your personal profile and place it on the map.</p>
48-
<div className='tw:grid'>
49-
<label
50-
className='tw:btn tw:btn-primary tw:place-self-end tw:mt-4'
51-
onClick={() => {
52-
clickAction1()
53-
}}
54-
>
55-
Close
56-
</label>
64+
<div className='tw:grid tw:mt-4'>
65+
{isAuthenticated ? (
66+
<label
67+
className='tw:btn tw:btn-primary tw:place-self-end'
68+
onClick={() => {
69+
clickAction1()
70+
}}
71+
>
72+
Close
73+
</label>
74+
) : (
75+
<label
76+
className='tw:btn tw:btn-primary tw:place-self-end'
77+
onClick={() => {
78+
clickAction1()
79+
void navigate('/login')
80+
}}
81+
>
82+
Login
83+
</label>
84+
)}
5785
</div>
5886
</>
5987
)}

lib/src/Components/Auth/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { AuthProvider } from './useAuth'
1+
export { AuthProvider, useAuth } from './useAuth'
22
export { LoginPage } from './LoginPage'
33
export { SignupPage } from './SignupPage'
44
export { RequestPasswordPage } from './RequestPasswordPage'

0 commit comments

Comments
 (0)