This commit is contained in:
ingawei 2022-07-30 00:13:59 -07:00
parent a505ae31c4
commit 8fe9d08b2d
3 changed files with 8 additions and 10 deletions

View File

@ -40,7 +40,7 @@ export type User = {
referredByContractId?: string
referredByGroupId?: string
lastPingTime?: number
showWelcome: boolean
shouldShowWelcome?: boolean
}
export const STARTING_BALANCE = ENV_CONFIG.startingBalance ?? 1000

View File

@ -22,7 +22,7 @@ service cloud.firestore {
allow read;
allow update: if resource.data.id == request.auth.uid
&& request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['bio', 'bannerUrl', 'website', 'twitterHandle', 'discordHandle', 'followedCategories', 'lastPingTime','showWelcome']);
.hasOnly(['bio', 'bannerUrl', 'website', 'twitterHandle', 'discordHandle', 'followedCategories', 'lastPingTime','shouldShowWelcome']);
// User referral rules
allow update: if resource.data.id == request.auth.uid
&& request.resource.data.diff(resource.data).affectedKeys()

View File

@ -12,10 +12,10 @@ export default function Welcome() {
const user = useUser()
const [open, setOpen] = useState(true)
const [page, setPage] = useState(0)
const totalpages = 4
const TOTAL_PAGES = 4
function increasePage() {
if (page < totalpages - 1) {
if (page < TOTAL_PAGES - 1) {
setPage(page + 1)
}
}
@ -27,14 +27,12 @@ export default function Welcome() {
}
async function setUserHasSeenWelcome() {
// await changeUserInfo({ showWelcome: false })
if (user) {
console.log('setuserwelcome called')
await updateUser(user.id, { ['showWelcome']: false })
await updateUser(user.id, { ['shouldShowWelcome']: false })
}
}
if (!user || !user.showWelcome) {
if (!user || !user.shouldShowWelcome) {
return <></>
} else
return (
@ -60,11 +58,11 @@ export default function Welcome() {
)}
onClick={decreasePage}
/>
<PageIndicator page={page} totalpages={totalpages} />
<PageIndicator page={page} totalpages={TOTAL_PAGES} />
<ChevronRightIcon
className={clsx(
'h-10 w-10 text-indigo-500 hover:text-indigo-600',
page === totalpages - 1 ? 'disabled invisible' : ''
page === TOTAL_PAGES - 1 ? 'disabled invisible' : ''
)}
onClick={increasePage}
/>