Skip to content

Commit b25327a

Browse files
committed
feat: Add auth modal ui and show it next to onboarding.
1 parent 37f406c commit b25327a

4 files changed

Lines changed: 71 additions & 0 deletions

File tree

src/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { DNDLayout } from 'src/components/Layout'
33
import { setupAnalytics, setupIdentification, trackPageView } from 'src/lib/analytics'
44
import { useUserPreferences } from 'src/stores/preferences'
55
import { AppContentLayout } from './components/Layout'
6+
import { AuthModal } from './features/auth'
67
import { isWebOrExtensionVersion } from './utils/Environment'
78
import { lazyImport } from './utils/lazyImport'
89
const { OnboardingModal } = lazyImport(() => import('src/features/onboarding'), 'OnboardingModal')
@@ -19,6 +20,7 @@ const intersectionCallback = (entries: IntersectionObserverEntry[]) => {
1920

2021
export const App = () => {
2122
const [showOnboarding, setShowOnboarding] = useState(true)
23+
const [showAuth, setshowAuth] = useState(true)
2224
const { onboardingCompleted, maxVisibleCards, isDNDModeActive, DNDDuration, setDNDDuration } =
2325
useUserPreferences()
2426

@@ -62,6 +64,8 @@ export const App = () => {
6264
<OnboardingModal showOnboarding={showOnboarding} setShowOnboarding={setShowOnboarding} />
6365
)}
6466

67+
{<AuthModal showAuth={showAuth} setShowAuth={setshowAuth} />}
68+
6569
<div className="layoutLayers hideScrollBar">
6670
{isDNDModeActive() && <DNDLayout />}
6771
<AppContentLayout />

src/assets/App.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,24 @@ a {
162162
color: var(--dark-mode-text-color);
163163
}
164164

165+
.extraTextWithIconBtn {
166+
background-color: var(--button-background-color);
167+
color: var(--button-text-color);
168+
height: 40px;
169+
width: auto;
170+
padding: 0 16px;
171+
min-width: 40px;
172+
font-weight: bold;
173+
font-size: 18px;
174+
text-align: center;
175+
border: 0;
176+
border-radius: 20px;
177+
display: inline-flex;
178+
align-items: center;
179+
justify-content: center;
180+
gap: 6px;
181+
}
182+
165183
.badgeCount {
166184
width: 20px;
167185
height: 20px;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { FaGithub, FaGoogle } from 'react-icons/fa'
2+
import ReactModal from 'react-modal'
3+
4+
type AuthModalProps = {
5+
showAuth: boolean
6+
setShowAuth: (show: boolean) => void
7+
}
8+
9+
export const AuthModal = ({ showAuth, setShowAuth }: AuthModalProps) => {
10+
return (
11+
<ReactModal
12+
isOpen={showAuth}
13+
ariaHideApp={false}
14+
shouldCloseOnEsc={true}
15+
shouldCloseOnOverlayClick={true}
16+
shouldFocusAfterRender={false}
17+
onRequestClose={() => setShowAuth(false)}
18+
contentLabel="Auth"
19+
className="Modal scrollable"
20+
style={{
21+
overlay: {
22+
zIndex: 3,
23+
},
24+
}}
25+
overlayClassName="Overlay">
26+
<div>
27+
<div>
28+
<h1>Welcome to Hackertab</h1>
29+
<p>
30+
To enhance your experience and unlock our new rewards system, we’ve introduced a simple
31+
and secure way to sign in. Connect your account with GitHub or Google to start earning
32+
rewards, save your progress, and enjoy personalized features.
33+
</p>
34+
</div>
35+
<div>
36+
<button type="button" className="extraTextWithIconBtn">
37+
<FaGithub />
38+
Sign in with Github
39+
</button>
40+
<button type="button" className="extraTextWithIconBtn" style={{ marginLeft: 10 }}>
41+
<FaGoogle />
42+
Sign in with Google
43+
</button>
44+
</div>
45+
</div>
46+
</ReactModal>
47+
)
48+
}

src/features/auth/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './components/AuthModal'

0 commit comments

Comments
 (0)