feat: portfolio in archives page
This commit is contained in:
parent
5c0c842518
commit
57446671b7
|
|
@ -39,7 +39,7 @@ export default async function SiteArchivesPage({
|
|||
await prefetchGetPagesBySite(
|
||||
{
|
||||
characterId: site?.characterId,
|
||||
type: "post",
|
||||
type: ["post", "portfolio"],
|
||||
visibility: PageVisibilityEnum.Published,
|
||||
limit: 100,
|
||||
skipExpansion: true,
|
||||
|
|
|
|||
|
|
@ -118,19 +118,16 @@ const Card = ({
|
|||
label={`${platform?.name || platform}`}
|
||||
className="text-sm"
|
||||
>
|
||||
<span className="inline-flex items-center">
|
||||
{platform?.icon ? (
|
||||
<span className="inline-flex items-center space-x-1">
|
||||
{platform?.icon && (
|
||||
<Image
|
||||
src={platform?.icon}
|
||||
alt={platform?.name}
|
||||
width={20}
|
||||
height={20}
|
||||
/>
|
||||
) : (
|
||||
<span className="rounded-md inline-flex text-white justify-center items-center bg-zinc-300">
|
||||
<i className="icon-[mingcute--planet-line] text-xl" />
|
||||
</span>
|
||||
)}
|
||||
<span>{t("Portfolio")}</span>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"use client"
|
||||
|
||||
import Link from "next/link"
|
||||
import { useParams, usePathname } from "next/navigation"
|
||||
import { useMemo } from "react"
|
||||
|
||||
|
|
@ -30,7 +29,7 @@ export const SiteArchives = () => {
|
|||
const site = useGetSite(params?.site as string)
|
||||
const posts = useGetPagesBySiteLite({
|
||||
characterId: site.data?.characterId,
|
||||
type: "post",
|
||||
type: ["post", "portfolio"],
|
||||
visibility: PageVisibilityEnum.Published,
|
||||
limit: 100,
|
||||
skipExpansion: true,
|
||||
|
|
@ -63,7 +62,7 @@ export const SiteArchives = () => {
|
|||
if (posts.data?.pages?.length) {
|
||||
for (const page of posts.data.pages) {
|
||||
for (const post of page.list) {
|
||||
post.metadata?.content?.tags?.forEach((tag) => {
|
||||
post.metadata?.content?.tags?.forEach((tag: string) => {
|
||||
if (!RESERVED_TAGS.includes(tag)) {
|
||||
if (result.has(tag)) {
|
||||
result.set(tag, result.get(tag) + 1)
|
||||
|
|
@ -124,12 +123,18 @@ export const SiteArchives = () => {
|
|||
</h3>
|
||||
{posts.map((post) => {
|
||||
currentLength++
|
||||
const isPortfolio =
|
||||
post.metadata?.content?.tags?.[0] === "portfolio"
|
||||
const externalLink =
|
||||
post.metadata?.content?.external_urls?.[0] || ""
|
||||
return (
|
||||
<Link
|
||||
<UniLink
|
||||
key={post.transactionHash}
|
||||
href={getSiteRelativeUrl(
|
||||
pathname,
|
||||
`/${post.metadata?.content?.slug}`,
|
||||
isPortfolio
|
||||
? externalLink
|
||||
: `/${post.metadata?.content?.slug}`,
|
||||
)}
|
||||
className="flex justify-between items-center p-2 rounded-lg -mx-2 hover:bg-hover"
|
||||
>
|
||||
|
|
@ -149,7 +154,7 @@ export const SiteArchives = () => {
|
|||
},
|
||||
})}
|
||||
</span>
|
||||
</Link>
|
||||
</UniLink>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -100,5 +100,6 @@
|
|||
"Pinned": "置顶",
|
||||
"Blockchain ID": "区块链标识",
|
||||
"Confirmed by {{blockNumber}} blocks": "已被 {{blockNumber}} 个区块确认",
|
||||
"Current Block Height": "当前区块高度"
|
||||
"Current Block Height": "当前区块高度",
|
||||
"Portfolio": "作品"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue