diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json
index ebb906ea..d38a60c5 100644
--- a/public/locales/zh/common.json
+++ b/public/locales/zh/common.json
@@ -66,5 +66,7 @@
"What is Mira? Where can I get some?" : "Mira 是什么?我在哪里可以获得?",
"Tip": "赞赏",
"Tip the post: {{name}}": "赞赏文章:{{name}}",
- "Custom": "自定义"
+ "Custom": "自定义",
+ "Mintable": "可铸造",
+ "Comming soon": "即将推出"
}
\ No newline at end of file
diff --git a/src/components/common/AchievementItem.tsx b/src/components/common/AchievementItem.tsx
index e4fbbe36..178ad77d 100644
--- a/src/components/common/AchievementItem.tsx
+++ b/src/components/common/AchievementItem.tsx
@@ -1,4 +1,4 @@
-import type { AchievementSection } from "crossbell.js"
+import type { AchievementSection } from "~/models/site.model"
import { Image } from "~/components/ui/Image"
import { AchievementModal } from "~/components/common/AchievementModal"
import { useEffect, useState } from "react"
@@ -50,10 +50,14 @@ export const AchievementItem: React.FC<{
? group.items.filter((item) => item.status === "MINTABLE").pop()
: null
+ const achievementComming = isOwner
+ ? group.items.filter((item) => item.status === "COMMING").pop()
+ : null
+
const [opened, setOpened] = useState(false)
if (isOwner) {
- if (!achievement && !achievementMintable) {
+ if (!achievement && !achievementMintable && !achievementComming) {
return null
}
} else {
@@ -73,7 +77,10 @@ export const AchievementItem: React.FC<{
}}
>
@@ -110,7 +117,7 @@ export const AchievementItem: React.FC<{
)
.humanize(),
})
- : "Mintable"}
+ : t(achievementMintable ? "Mintable" : "Comming soon")}
diff --git a/src/components/common/AchievementModal.tsx b/src/components/common/AchievementModal.tsx
index 16f08bdc..341e8ae7 100644
--- a/src/components/common/AchievementModal.tsx
+++ b/src/components/common/AchievementModal.tsx
@@ -1,5 +1,5 @@
import { Modal, Stepper } from "@mantine/core"
-import type { AchievementSection } from "crossbell.js"
+import type { AchievementSection } from "~/models/site.model"
import { Image } from "~/components/ui/Image"
import Tilt from "react-parallax-tilt"
import { Badge } from "~/components/common/AchievementItem"
@@ -29,8 +29,11 @@ export const AchievementModal: React.FC<{
? group.items.filter((item) => item.status === "MINTABLE").pop()
: null
+ const achievementComming = isOwner
+ ? group.items.filter((item) => item.status === "COMMING").pop()
+ : null
+
const router = useRouter()
- const handle = router.query.handle as string
const mintAchievement = useMintAchievement()
const mint = async (tokenId: number) => {
@@ -69,7 +72,10 @@ export const AchievementModal: React.FC<{
>
- {(achievement || achievementMintable)!.info.description}
+ {
+ (achievement || achievementMintable || achievementComming)!.info
+ .description
+ }
{achievement ? (
@@ -126,7 +138,7 @@ export const AchievementModal: React.FC<{
>
) : (
- <>Mintable>
+ t(achievementMintable ? "Mintable" : "Comming soon")
)}
diff --git a/src/models/site.model.ts b/src/models/site.model.ts
index 65716b00..6a0e34ad 100644
--- a/src/models/site.model.ts
+++ b/src/models/site.model.ts
@@ -583,13 +583,116 @@ export async function getTips(
return tips
}
-export const getAchievements = (characterId: number) => {
- return indexer.getAchievements(characterId)
+export type AchievementSection = {
+ info: {
+ name: string
+ title: string
+ }
+ groups: {
+ info: {
+ name: string
+ title: string
+ }
+ items: {
+ tokenId: number
+ name: string
+ status: "INACTIVE" | "MINTABLE" | "MINTED" | "COMMING"
+ mintedAt: string | null
+ transactionHash: string | null
+ info: {
+ tokenId: number
+ name: string
+ description: string
+ media: string
+ attributes: [
+ {
+ trait_type: string
+ value: string
+ },
+ ]
+ }
+ }[]
+ }[]
}
-export const mintAchievement = async (input: {
+export async function getAchievements(characterId: number) {
+ const crossbellAchievements = (await indexer.getAchievements(characterId))
+ ?.list as AchievementSection[] | undefined
+ const xLogAchievements: AchievementSection[] = [
+ {
+ info: {
+ name: "xlog-journey",
+ title: "xLog Journey",
+ },
+ groups: [
+ {
+ info: {
+ name: "showcase-superstar",
+ title: "Showcase Superstar",
+ },
+ items: [
+ {
+ info: {
+ attributes: [
+ {
+ trait_type: "tier",
+ value: "base",
+ },
+ ],
+ description: "I am a superstar on xLog!",
+ media:
+ "ipfs://QmVnTtYC4yQ7D1eGb3Ke9NVDadovSPZeg2q2cYA6j275Um/influencer/influencer:special.png",
+ tokenId: 0,
+ name: "Showcase Superstar",
+ },
+ tokenId: 0,
+ name: "showcase-superstar",
+ status: "COMMING",
+ mintedAt: null,
+ transactionHash: null,
+ },
+ ],
+ },
+ {
+ info: {
+ name: "mirror-xyz-migrator",
+ title: "Mirror.xyz Migrator",
+ },
+ items: [
+ {
+ info: {
+ attributes: [
+ {
+ trait_type: "tier",
+ value: "base",
+ },
+ ],
+ description: "I migrated from Mirror.xyz to xLog!",
+ media:
+ "ipfs://bafybeicqfeaco6skylodk3cridjvntdxvbdaqhbtkky7exsxgdrzfp7gae",
+ tokenId: 0,
+ name: "Mirror.xyz Migrator",
+ },
+ tokenId: 0,
+ name: "mirror-xyz-migrator",
+ status: "COMMING",
+ mintedAt: null,
+ transactionHash: null,
+ },
+ ],
+ },
+ ],
+ },
+ ]
+
+ return {
+ list: [...xLogAchievements, ...(crossbellAchievements || [])],
+ }
+}
+
+export async function mintAchievement(input: {
characterId: number
achievementId: number
-}) => {
+}) {
return indexer.mintAchievement(input.characterId, input.achievementId)
}
diff --git a/src/pages/dashboard/[subdomain]/achievements.tsx b/src/pages/dashboard/[subdomain]/achievements.tsx
index acb820d0..14f1c6cc 100644
--- a/src/pages/dashboard/[subdomain]/achievements.tsx
+++ b/src/pages/dashboard/[subdomain]/achievements.tsx
@@ -42,10 +42,10 @@ export default function AchievementsPage() {
return (
-
+
<>
{achievement.data?.list?.map((series) => {
- let length = series.groups.length
+ let length = series.groups?.length
if (!length) {
return null
}