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

View File

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