Skip to content

Commit

Permalink
💄 Implement drm info UI to <SpecTableValue/>
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 committed Dec 18, 2024
1 parent 75778f6 commit ae69651
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 2 deletions.
21 changes: 21 additions & 0 deletions src/components/Icon/Info.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<g clip-path="url(#clip0_2791_3213)">
<path
d="M7.33334 11.3333H8.66667V7.33334H7.33334V11.3333ZM8 1.33334C4.32 1.33334 1.33334 4.32001 1.33334 8.00001C1.33334 11.68 4.32 14.6667 8 14.6667C11.68 14.6667 14.6667 11.68 14.6667 8.00001C14.6667 4.32001 11.68 1.33334 8 1.33334ZM8 13.3333C5.06 13.3333 2.66667 10.94 2.66667 8.00001C2.66667 5.06001 5.06 2.66668 8 2.66668C10.94 2.66668 13.3333 5.06001 13.3333 8.00001C13.3333 10.94 10.94 13.3333 8 13.3333ZM7.33334 6.00001H8.66667V4.66668H7.33334V6.00001Z"
fill="currentColor"
/>
</g>
<defs>
<clipPath id="clip0_2791_3213">
<rect width="16" height="16" fill="white" />
</clipPath>
</defs>
</svg>
</template>
26 changes: 25 additions & 1 deletion src/components/NFTBook/SpecTableItemAccessMethod.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
<NFTBookSpecTableLabel
:text="$t('nft_details_page_label_access_methods')"
/>
<NFTBookSpecTableValue :text="value" :preset="preset" />
<NFTBookSpecTableValue
:text="value"
:preset="preset"
:tooltip-title="tooltipsContent.title"
:tooltip-text="tooltipsContent.text"
/>
</component>
</template>

Expand All @@ -29,6 +34,25 @@ export default {
? this.$t('nft_details_page_label_access_methods_downloadable')
: this.$t('nft_details_page_label_access_methods_web_only');
},
tooltipsContent() {
return this.isDownloadable
? {
title: this.$t(
'nft_details_page_label_access_methods_tooltips_title_drm_free'
),
text: this.$t(
'nft_details_page_label_access_methods_tooltips_text_drm_free'
),
}
: {
title: this.$t(
'nft_details_page_label_access_methods_tooltips_title_drm'
),
text: this.$t(
'nft_details_page_label_access_methods_tooltips_text_drm'
),
};
},
},
};
</script>
59 changes: 58 additions & 1 deletion src/components/NFTBook/SpecTableValue.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
<template>
<div :class="['font-[600]', textStyle]" v-text="text" />
<div class="flex gap-[8px] items-center">
<div :class="['font-[600]', textStyle]" v-text="text" />
<div
v-if="tooltipText"
class="relative hidden group laptop:block"
@mouseenter="hoverTooltips"
>
<IconInfo />
<NFTBookTooltips
class="hidden group-hover:block"
:tooltip-text="tooltipText"
:tooltip-title="tooltipTitle"
/>
</div>

<div
v-if="tooltipText"
class="cursor-pointer laptop:hidden"
@click="onclickShowTooltips"
>
<IconInfo />
</div>
<BottomDialog
v-if="showTooltips"
:title="tooltipTitle"
@close="closeTooltips"
>
<template #content>
{{ tooltipText }}
</template>
</BottomDialog>
</div>
</template>

<script>
import { PRESET_TYPE } from '~/components/NFTBook/ItemCard';
import { logTrackerEvent } from '~/util/EventLogger';
export default {
props: {
Expand All @@ -15,12 +47,37 @@ export default {
type: String,
default: PRESET_TYPE.DEFAULT,
},
tooltipText: {
type: String,
default: undefined,
},
tooltipTitle: {
type: String,
default: undefined,
},
},
data() {
return {
showTooltips: false,
};
},
computed: {
textStyle() {
if (this.preset === PRESET_TYPE.CAMPAIGN) return 'text-white';
return 'text-dark-gray';
},
},
methods: {
hoverTooltips() {
logTrackerEvent(this, 'NFTBook', 'TooltipsHover', '', 1);
},
onclickShowTooltips() {
this.showTooltips = true;
logTrackerEvent(this, 'NFTBook', 'TooltipsClicked', '', 1);
},
closeTooltips() {
this.showTooltips = false;
},
},
};
</script>
4 changes: 4 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,10 @@
"nft_details_page_errormessage_transfer_self": "You cannot send Writing NFT to yourself.",
"nft_details_page_label_access_methods": "Access Method",
"nft_details_page_label_access_methods_downloadable": "Read online / Download",
"nft_details_page_label_access_methods_tooltips_text_drm": "Refers to eBooks that have digital rights management technology, allowing readers to open and read the content on our site.",
"nft_details_page_label_access_methods_tooltips_title_drm": "DRM Content",
"nft_details_page_label_access_methods_tooltips_text_drm_free": "Refers to eBooks without digital rights management technology, allowing readers to freely download and transfer the eBook to different devices.",
"nft_details_page_label_access_methods_tooltips_title_drm_free": "DRM-Free Content",
"nft_details_page_label_access_methods_web_only": "Read Online",
"nft_details_page_label_ar_view_in_mobile": "Experience your NFT live",
"nft_details_page_label_class_page": "View all events from this content",
Expand Down
4 changes: 4 additions & 0 deletions src/locales/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,10 @@
"nft_details_page_errormessage_transfer_self": "不能發送給自己",
"nft_details_page_label_access_methods": "閱讀方式",
"nft_details_page_label_access_methods_downloadable": "站內閱讀 / 檔案下載",
"nft_details_page_label_access_methods_tooltips_text_drm": "指設有數位版權管理技術的電子書,讀者可以於我們的站內開啟及閱讀內容。",
"nft_details_page_label_access_methods_tooltips_title_drm": "DRM 內容",
"nft_details_page_label_access_methods_tooltips_text_drm_free": "指沒有數位版權管理技術的電子書,讀者可以自由下載和傳輸電子書到不同裝置。",
"nft_details_page_label_access_methods_tooltips_title_drm_free": "不設 DRM 內容",
"nft_details_page_label_access_methods_web_only": "站內閱讀",
"nft_details_page_label_ar_view_in_mobile": "將你的 NFT 帶到現實",
"nft_details_page_label_class_page": "檢視此系列的其他事件",
Expand Down

0 comments on commit ae69651

Please sign in to comment.