Merge pull request 'fix: latest mods on landing. change: mods-inner url to mod' (#32) from staging into master
All checks were successful
Release to Staging / build_and_release (push) Successful in 45s

Reviewed-on: #32
This commit is contained in:
freakoverse 2024-09-03 10:32:20 +00:00
commit 8227de2d80
5 changed files with 20 additions and 18 deletions

View File

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

View File

@ -9,7 +9,7 @@ import { ModCard } from '../components/ModCard'
import { LANDING_PAGE_DATA } from '../constants'
import { RelayController } from '../controllers'
import { useDidMount } from '../hooks'
import { appRoutes, getModsInnerPageRoute } from '../routes'
import { appRoutes, getModPageRoute } from '../routes'
import { ModDetails } from '../types'
import {
extractModData,
@ -182,7 +182,7 @@ const SlideContent = ({ naddr }: SlideContentProps) => {
<a
className='btn btnMain IBMSMSliderContainerWrapperSliderActionbtn'
role='button'
onClick={() => navigate(getModsInnerPageRoute(naddr))}
onClick={() => navigate(getModPageRoute(naddr))}
>
Check it out
</a>
@ -230,7 +230,7 @@ const DisplayMod = ({ naddr }: DisplayModProps) => {
if (!mod) return <Spinner />
const route = getModsInnerPageRoute(naddr)
const route = getModPageRoute(naddr)
return (
<ModCard
@ -249,10 +249,12 @@ const DisplayLatestMods = () => {
const [latestMods, setLatestMods] = useState<ModDetails[]>([])
useDidMount(() => {
fetchMods({ source: window.location.host, limit: 4 })
fetchMods({ source: window.location.host })
.then((res) => {
res.sort((a, b) => b.published_at - a.published_at)
setLatestMods(res)
const mods = res
.sort((a, b) => b.published_at - a.published_at)
.slice(0, 4)
setLatestMods(mods)
})
.finally(() => {
setIsFetchingLatestMods(false)
@ -269,7 +271,7 @@ const DisplayLatestMods = () => {
<Spinner />
) : (
latestMods.map((mod) => {
const route = getModsInnerPageRoute(
const route = getModPageRoute(
nip19.naddrEncode({
identifier: mod.aTag,
pubkey: mod.author,

View File

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

View File

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

View File

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