Game name now visible on game mod cards and sliders. Mod post reactions now functional. Zap refactored. #33

Merged
freakoverse merged 13 commits from staging into master 2024-09-05 10:39:45 +00:00
Showing only changes of commit 822d5110a8 - Show all commits

View File

@ -14,6 +14,8 @@ import '../styles/settings.css'
import '../styles/styles.css'
import '../styles/write.css'
import { copyTextToClipboard } from '../utils'
import { MetadataController } from '../controllers'
import { useEffect, useState } from 'react'
export const SettingsPage = () => {
const location = useLocation()
@ -47,8 +49,21 @@ export const SettingsPage = () => {
const SettingTabs = () => {
const location = useLocation()
const [isAdmin, setIsAdmin] = useState(false)
const userState = useAppSelector((state) => state.user)
useEffect(() => {
MetadataController.getInstance().then((controller) => {
if (userState.auth && userState.user?.npub) {
setIsAdmin(
controller.adminNpubs.includes(userState.user.npub as string)
)
} else {
setIsAdmin(false)
}
})
}, [userState])
const handleSignOut = () => {
logout()
}
@ -120,6 +135,7 @@ const SettingTabs = () => {
</svg>
Preference
</Link>
{isAdmin && (
<Link
className={`btn btnMain btnMainAltText btnMainClear ${
location.pathname === appRoutes.settingsAdmin
@ -140,6 +156,7 @@ const SettingTabs = () => {
</svg>
Admin
</Link>
)}
</div>
{userState.auth &&