fix: change the route for mod detail page from mods-inner to mod

This commit is contained in:
daniyal 2024-09-03 15:13:51 +05:00
parent 018536e11d
commit 4b51fa55f5
5 changed files with 15 additions and 15 deletions

View File

@ -26,7 +26,7 @@ import {
import { CheckboxField, InputError, InputField } from './Inputs' import { CheckboxField, InputError, InputField } from './Inputs'
import { RelayController } from '../controllers' import { RelayController } from '../controllers'
import { useLocation, useNavigate } from 'react-router-dom' import { useLocation, useNavigate } from 'react-router-dom'
import { appRoutes, getModsInnerPageRoute } from '../routes' import { appRoutes, getModPageRoute } from '../routes'
import { DownloadUrl, ModFormState, ModDetails } from '../types' import { DownloadUrl, ModFormState, ModDetails } from '../types'
import { LoadingSpinner } from './LoadingSpinner' import { LoadingSpinner } from './LoadingSpinner'
import { T_TAG_VALUE } from '../constants' import { T_TAG_VALUE } from '../constants'
@ -281,7 +281,7 @@ export const ModForm = ({ existingModData }: ModFormProps) => {
relays: publishedOnRelays relays: publishedOnRelays
}) })
navigate(getModsInnerPageRoute(naddr)) navigate(getModPageRoute(naddr))
} }
setIsPublishing(false) setIsPublishing(false)

View File

@ -9,7 +9,7 @@ import { ModCard } from '../components/ModCard'
import { LANDING_PAGE_DATA } from '../constants' import { LANDING_PAGE_DATA } from '../constants'
import { RelayController } from '../controllers' import { RelayController } from '../controllers'
import { useDidMount } from '../hooks' import { useDidMount } from '../hooks'
import { appRoutes, getModsInnerPageRoute } from '../routes' import { appRoutes, getModPageRoute } from '../routes'
import { ModDetails } from '../types' import { ModDetails } from '../types'
import { import {
extractModData, extractModData,
@ -182,7 +182,7 @@ const SlideContent = ({ naddr }: SlideContentProps) => {
<a <a
className='btn btnMain IBMSMSliderContainerWrapperSliderActionbtn' className='btn btnMain IBMSMSliderContainerWrapperSliderActionbtn'
role='button' role='button'
onClick={() => navigate(getModsInnerPageRoute(naddr))} onClick={() => navigate(getModPageRoute(naddr))}
> >
Check it out Check it out
</a> </a>
@ -230,7 +230,7 @@ const DisplayMod = ({ naddr }: DisplayModProps) => {
if (!mod) return <Spinner /> if (!mod) return <Spinner />
const route = getModsInnerPageRoute(naddr) const route = getModPageRoute(naddr)
return ( return (
<ModCard <ModCard
@ -269,7 +269,7 @@ const DisplayLatestMods = () => {
<Spinner /> <Spinner />
) : ( ) : (
latestMods.map((mod) => { latestMods.map((mod) => {
const route = getModsInnerPageRoute( const route = getModPageRoute(
nip19.naddrEncode({ nip19.naddrEncode({
identifier: mod.aTag, identifier: mod.aTag,
pubkey: mod.author, pubkey: mod.author,

View File

@ -53,7 +53,7 @@ import {
} from '../utils' } from '../utils'
import FsLightbox from 'fslightbox-react' import FsLightbox from 'fslightbox-react'
export const InnerModPage = () => { export const ModPage = () => {
const { naddr } = useParams() const { naddr } = useParams()
const [modData, setModData] = useState<ModDetails>() const [modData, setModData] = useState<ModDetails>()
const [isFetching, setIsFetching] = useState(true) const [isFetching, setIsFetching] = useState(true)

View File

@ -12,7 +12,7 @@ import { LoadingSpinner } from '../components/LoadingSpinner'
import { ModCard } from '../components/ModCard' import { ModCard } from '../components/ModCard'
import { MetadataController } from '../controllers' import { MetadataController } from '../controllers'
import { useAppSelector, useDidMount } from '../hooks' import { useAppSelector, useDidMount } from '../hooks'
import { getModsInnerPageRoute } from '../routes' import { getModPageRoute } from '../routes'
import '../styles/filters.css' import '../styles/filters.css'
import '../styles/pagination.css' import '../styles/pagination.css'
import '../styles/search.css' import '../styles/search.css'
@ -208,7 +208,7 @@ export const ModsPage = () => {
<div className='IBMSecMain IBMSMListWrapper'> <div className='IBMSecMain IBMSMListWrapper'>
<div className='IBMSMList'> <div className='IBMSMList'>
{filteredModList.map((mod) => { {filteredModList.map((mod) => {
const route = getModsInnerPageRoute( const route = getModPageRoute(
nip19.naddrEncode({ nip19.naddrEncode({
identifier: mod.aTag, identifier: mod.aTag,
pubkey: mod.author, pubkey: mod.author,

View File

@ -2,7 +2,7 @@ import { AboutPage } from '../pages/about'
import { BlogsPage } from '../pages/blogs' import { BlogsPage } from '../pages/blogs'
import { GamesPage } from '../pages/games' import { GamesPage } from '../pages/games'
import { HomePage } from '../pages/home' import { HomePage } from '../pages/home'
import { InnerModPage } from '../pages/innerMod' import { ModPage } from '../pages/mod'
import { ModsPage } from '../pages/mods' import { ModsPage } from '../pages/mods'
import { ProfilePage } from '../pages/profile' import { ProfilePage } from '../pages/profile'
import { SettingsPage } from '../pages/settings' import { SettingsPage } from '../pages/settings'
@ -14,7 +14,7 @@ export const appRoutes = {
home: '/home', home: '/home',
games: '/games', games: '/games',
mods: '/mods', mods: '/mods',
modsInner: '/mods-inner/:naddr', mod: '/mod/:naddr',
about: '/about', about: '/about',
blog: '/blog', blog: '/blog',
submitMod: '/submit-mod', submitMod: '/submit-mod',
@ -27,8 +27,8 @@ export const appRoutes = {
profile: '/profile/:nprofile' profile: '/profile/:nprofile'
} }
export const getModsInnerPageRoute = (eventId: string) => export const getModPageRoute = (eventId: string) =>
appRoutes.modsInner.replace(':naddr', eventId) appRoutes.mod.replace(':naddr', eventId)
export const getModsEditPageRoute = (eventId: string) => export const getModsEditPageRoute = (eventId: string) =>
appRoutes.editMod.replace(':naddr', eventId) appRoutes.editMod.replace(':naddr', eventId)
@ -54,8 +54,8 @@ export const routes = [
element: <ModsPage /> element: <ModsPage />
}, },
{ {
path: appRoutes.modsInner, path: appRoutes.mod,
element: <InnerModPage /> element: <ModPage />
}, },
{ {
path: appRoutes.about, path: appRoutes.about,