Skip to content

Commit

Permalink
👔 List 蜀山劍俠傳 & 庭刊創刊號 (#1401)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt committed Nov 16, 2023
1 parent f6b6e9d commit 447ed95
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 8 deletions.
44 changes: 44 additions & 0 deletions src/constant/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,57 @@ export const LIKECOIN_NFT_BOOK_FEATURED_ITEMS = IS_TESTNET
},
]
: [
// 蜀山劍俠傳-全集
{
classId:
'likenft172trlle2ts4t4lppkc0vksflzsd898wk8u5dwgl5ph3zr4lw9e3qa24c56',
date: '2023-11-15T05:27:37',
locale: 'zh',
isHighlight: true,
},
// 庭刊 - 創刊號
{
classId:
'likenft1m6tr4ezzt4tw9ukmhe7s0zcuch95hu4kp5md702r7k4t0z5pf3qqemdev0',
date: '2023-11-03T07:58:22',
locale: 'zh',
isHighlight: true,
},
// 角醒1-15期合訂本
{
classId:
'likenft1cwd2h4xsj5paa57z4yfan5ycreaskzq55ww4z0q9hkp2sdyy7jps67a2kq',
date: '2023-11-03T07:58:22',
locale: 'zh',
},
// 蜀山劍俠傳 - 卷一
{
classId:
'likenft1w6y57g420f32pdln5mqj2wlwjm9d0upfd6fzeg0xcvg4hurpneqqu8cfa4',
date: '2023-11-15T05:10:13',
locale: 'zh',
},
// 蜀山劍俠傳 - 卷二
{
classId:
'likenft1qqexezvq74x7g930gkz3w29h43pdaf7t4yvvk6q5n55xl8jgnces5aellp',
date: '2023-11-15T05:10:13',
locale: 'zh',
},
// 蜀山劍俠傳 - 卷三
{
classId:
'likenft1fae3f7w40056636p4r0cmnawcj0fw2ajesctz02cvms3h0qkzrxstq3n79',
date: '2023-11-15T05:10:13',
locale: 'zh',
},
// 蜀山劍俠傳 - 卷四
{
classId:
'likenft1v6y9xxx5jea7t7y8darasnwd338lqp33477q9887q8mem3cvu30svtvrp0',
date: '2023-11-15T05:10:13',
locale: 'zh',
},
// 棄床記
{
classId:
Expand Down
45 changes: 37 additions & 8 deletions src/pages/store/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@
<section>
<h2 class="text-[#3AB7A2] text-[48px] font-proxima font-[600]">{{ $t('home_section_book_title') }}</h2>
<div class="flex flex-col items-stretch w-full max-w-[840px] mx-auto mt-[48px]">
<NFTBookItemCard
v-if="nftBooks.length > 0"
:class-id="nftBooks[0].classId"
preset="campaign"
@click.native="() => onClickCampaignItem(nftBooks[0].classId)"
@click-avatar="() => onClickCampaignItemAvatar(nftBooks[0].classId)"
/>
<ul class="space-y-[1rem]">
<li
v-for="nftBook in nftBooksHighlight"
:key="nftBook.classId"
>
<NFTBookItemCard
:class-id="nftBook.classId"
preset="campaign"
@click.native="() => onClickCampaignItem(nftBook.classId)"
@click-avatar="() => onClickCampaignItemAvatar(nftBook.classId)"
/>
</li>
</ul>
<NFTBookShelf
class="mt-[48px]"
:items="nftBooksOnShelf"
Expand Down Expand Up @@ -115,8 +121,31 @@ export default {
nftBooks() {
return LIKECOIN_NFT_BOOK_FEATURED_ITEMS;
},
nftBooksHighlight() {
return this.nftBooks.filter(nft => nft.isHighlight);
},
nftBooksOnShelf() {
return this.nftBooks.slice(1);
const { locale } = this.$i18n;
const isChinese = locale === 'zh-Hant';
const books = this.nftBooks.filter(
// List only Chinese books if the locale is Chinese
nft => !nft.isHighlight && (locale.includes(nft.locale) || !isChinese)
);
if (!isChinese) {
// Display books of the current locale first unless it is Chinese
books.sort((a, b) => {
const aMatchedLocale = locale.includes(a.locale);
const bMatchedLocale = locale.includes(b.locale);
if (aMatchedLocale && !bMatchedLocale) {
return -1;
}
if (!aMatchedLocale && bMatchedLocale) {
return 1;
}
return 0;
});
}
return books;
},
},
mounted() {
Expand Down

0 comments on commit 447ed95

Please sign in to comment.