fix: ability to right-click on a mod post to open in new tab or copy link
Some checks failed
Release to Staging / build_and_release (push) Failing after 22s

This commit is contained in:
daniyal 2024-08-29 13:24:15 +05:00
parent 1e98b16c14
commit 8a232c7d91
2 changed files with 30 additions and 20 deletions

View File

@ -4,6 +4,7 @@ type ModCardProps = {
title: string title: string
summary: string summary: string
backgroundLink: string backgroundLink: string
link: string
handleClick: () => void handleClick: () => void
} }
@ -11,10 +12,18 @@ export const ModCard = ({
title, title,
summary, summary,
backgroundLink, backgroundLink,
link,
handleClick handleClick
}: ModCardProps) => { }: ModCardProps) => {
return ( return (
<a className='cardModMainWrapperLink' onClick={handleClick}> <a
className='cardModMainWrapperLink'
href={link}
onClick={(e) => {
e.preventDefault()
handleClick()
}}
>
<div className='cardModMain'> <div className='cardModMain'>
<div <div
className='cMMPicture' className='cMMPicture'

View File

@ -177,25 +177,26 @@ export const ModsPage = () => {
<div className='IBMSecMain IBMSMListWrapper'> <div className='IBMSecMain IBMSMListWrapper'>
<div className='IBMSMList'> <div className='IBMSMList'>
{filteredModList.map((mod) => ( {filteredModList.map((mod) => {
<ModCard const route = getModsInnerPageRoute(
key={mod.id}
title={mod.title}
summary={mod.summary}
backgroundLink={mod.featuredImageUrl}
handleClick={() =>
navigate(
getModsInnerPageRoute(
nip19.naddrEncode({ nip19.naddrEncode({
identifier: mod.aTag, identifier: mod.aTag,
pubkey: mod.author, pubkey: mod.author,
kind: kinds.ClassifiedListing kind: kinds.ClassifiedListing
}) })
) )
)
} return (
<ModCard
key={mod.id}
title={mod.title}
summary={mod.summary}
backgroundLink={mod.featuredImageUrl}
link={`#${route}`}
handleClick={() => navigate(route)}
/> />
))} )
})}
</div> </div>
</div> </div>