user profile btn in social nav now only is active for current logged in user, added NSFW tag for admin tagged ones, mod search under a specific game, search term and some filters added to url, filter state is saved locally in cache, user search now works #108
@ -1,13 +1,28 @@
|
|||||||
import { useAppSelector } from 'hooks'
|
import { useAppSelector } from 'hooks'
|
||||||
|
import { nip19 } from 'nostr-tools'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { NavLink, NavLinkProps } from 'react-router-dom'
|
import { NavLink, NavLinkProps } from 'react-router-dom'
|
||||||
import { appRoutes, getProfilePageRoute } from 'routes'
|
import { appRoutes, getProfilePageRoute } from 'routes'
|
||||||
import 'styles/socialNav.css'
|
import 'styles/socialNav.css'
|
||||||
|
import { npubToHex } from 'utils'
|
||||||
|
|
||||||
export const SocialNav = () => {
|
export const SocialNav = () => {
|
||||||
const [isCollapsed, setIsCollapsed] = useState<boolean>(false)
|
const [isCollapsed, setIsCollapsed] = useState<boolean>(false)
|
||||||
const userState = useAppSelector((state) => state.user)
|
const userState = useAppSelector((state) => state.user)
|
||||||
|
|
||||||
|
let profileRoute = ''
|
||||||
|
if (userState.auth && userState.user) {
|
||||||
|
// Redirect to user's profile is no profile is linked
|
||||||
|
const userHexKey = npubToHex(userState.user.npub as string)
|
||||||
|
|
||||||
|
if (userHexKey) {
|
||||||
|
profileRoute = getProfilePageRoute(
|
||||||
|
nip19.nprofileEncode({
|
||||||
|
pubkey: userHexKey
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
const toggleNav = () => {
|
const toggleNav = () => {
|
||||||
setIsCollapsed(!isCollapsed)
|
setIsCollapsed(!isCollapsed)
|
||||||
}
|
}
|
||||||
@ -42,7 +57,7 @@ export const SocialNav = () => {
|
|||||||
/>
|
/>
|
||||||
{!!userState.auth && (
|
{!!userState.auth && (
|
||||||
<NavButton
|
<NavButton
|
||||||
to={getProfilePageRoute('')}
|
to={profileRoute}
|
||||||
svgPath='M256 288c79.53 0 144-64.47 144-144s-64.47-144-144-144c-79.52 0-144 64.47-144 144S176.5 288 256 288zM351.1 320H160c-88.36 0-160 71.63-160 160c0 17.67 14.33 32 31.1 32H480c17.67 0 31.1-14.33 31.1-32C512 391.6 440.4 320 351.1 320z'
|
svgPath='M256 288c79.53 0 144-64.47 144-144s-64.47-144-144-144c-79.52 0-144 64.47-144 144S176.5 288 256 288zM351.1 320H160c-88.36 0-160 71.63-160 160c0 17.67 14.33 32 31.1 32H480c17.67 0 31.1-14.33 31.1-32C512 391.6 440.4 320 351.1 320z'
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
Loading…
Reference in New Issue
Block a user