Skip to content

Commit

Permalink
Disclaimer modal fixes (#23)
Browse files Browse the repository at this point in the history
* Fix disclaimer modal title styles

* Remove disclaimer read check and display it every time the page loads
  • Loading branch information
M-Picco authored Mar 19, 2024
1 parent 09e4af5 commit 0017f17
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
2 changes: 1 addition & 1 deletion frontend/components/modal/Disclaimer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function Disclaimer({ onAgree, showModal }: DisclaimerProps) {
return showModal ? (
<ModalWrapper>
<div className="relative max-h-[80vh] w-full max-w-[588px] border border-light-35 bg-darkGray1">
<h3 className=" border-b border-light-35 p-10 font-header text-[36px] font-light">
<h3 className="disclaimer-title">
{'Supplemental Token Airdrop Terms'}
</h3>
<div className="scrollbar flex max-h-[300px] flex-col gap-3 overflow-auto border-b border-light-35 px-10 py-5 font-body text-base font-light leading-5 tracking-widest">
Expand Down
9 changes: 0 additions & 9 deletions frontend/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { Disclaimer } from '@components/modal/Disclaimer'
import Script from 'next/script'

import {
DisclaimerCheckStore,
PathnameStore,
resetOnVersionMismatch,
} from 'utils/store'
Expand Down Expand Up @@ -72,13 +71,6 @@ const App: FC<AppProps> = ({ Component, pageProps }: AppProps) => {
setIsVersionChecked(true)
}, [router])

useLayoutEffect(() => {
if (isVersionChecked) {
const wasRead = DisclaimerCheckStore.get()
if (wasRead === 'true') setDisclaimerWasRead(true)
}
}, [isVersionChecked])

useRedirect(isVersionChecked)

return (
Expand Down Expand Up @@ -125,7 +117,6 @@ const App: FC<AppProps> = ({ Component, pageProps }: AppProps) => {
<Disclaimer
showModal={!disclaimerWasRead}
onAgree={() => {
DisclaimerCheckStore.set('true')
setDisclaimerWasRead(true)
}}
/>
Expand Down
8 changes: 8 additions & 0 deletions frontend/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@
@apply mb-4 before:h-5 before:w-5;
}

.disclaimer-title {
@apply border-b border-light-35 p-10 font-header text-[36px] font-light;
text-align: center;
line-height: normal;
padding: 1rem 2.5rem;
font-size: 2em;
}

.disabled td:first-of-type {
opacity: 0.25;
pointer-events: none;
Expand Down
11 changes: 0 additions & 11 deletions frontend/utils/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,6 @@ class PathnameStore_ extends Store<string> {
}
}

class DisclaimerCheckStore_ extends Store<'true' | 'false'> {
readonly appVersion = '1'
get() {
if (typeof window === 'undefined') return null

return localStorage.getItem(this.key) as 'true' | 'false'
}
}

class VersionStore_ extends Store<string> {
readonly appVersion = '1'
get() {
Expand All @@ -121,15 +112,13 @@ export const ActivityStore = new ActivityStore_('activity-store')
export const EligibilityStore = new EligibilityStore_('eligibility-key')
export const SignatureStore = new SignatureStore_('signature-key')
export const PathnameStore = new PathnameStore_('last-step-status-key')
export const DisclaimerCheckStore = new DisclaimerCheckStore_('disclaimer-read')
export const VersionStore = new VersionStore_('version-store-key')

export function resetLocalState() {
ActivityStore.remove()
EligibilityStore.remove()
SignatureStore.remove()
PathnameStore.remove()
DisclaimerCheckStore.remove()

// NOTE: Do not clear version store. We are using it as a flag
// to safely update the website
Expand Down

0 comments on commit 0017f17

Please sign in to comment.