Skip to content

Commit

Permalink
🚸 Enable copy iscnId on new page
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 authored and williamchong committed Dec 29, 2023
1 parent 92cf94f commit 33592e5
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions components/IscnUploadedInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,18 @@
'text-shade-gray',
]"
/>
<FormField
v-if="iscnId"
:label="$t('iscn.meta.id')"
:class="[
'mb-[12px]',
'text-[14px]',
]"
>
<Link
:to="localeLocation({
name: 'view-iscnId',
params: { iscnId: iscnId },
})"
class="text-[14px]"
>
{{ iscnId }}
</Link>
<FormField v-if="iscnId" :label="$t('iscn.meta.id.copy')" class="mb-[12px]">
<Button
size="mini"
preset="tertiary"
tag="div"
text-preset="h6"
type="button"
content-class="font-medium ml-[-4px]"
prepend-class="font-bold"
:text="iscnId"
@click="handleCopyIscnId"
/>
</FormField>
<FormField
v-if="contentFingerprints"
Expand Down Expand Up @@ -181,6 +176,16 @@
/>
</FormField>
<slot name="footer" />
<Snackbar
v-model="isOpenCopiedAlert"
:text="$t('iscn.meta.stakeholders.wallet.copied')"
preset="success"
:timeout="2000"
>
<template #prepend>
<IconDone />
</template>
</Snackbar>
</Card>
</template>

Expand All @@ -190,6 +195,9 @@ import { Vue, Component, Prop } from 'vue-property-decorator'
import { ISCNRecordWithID } from '~/utils/cosmos/iscn/iscn.type'
import { downloadJSON } from '~/utils/misc'
import { BIG_DIPPER_TX_BASE_URL } from '~/constant'
import { logTrackerEvent } from '~/utils/logger'
import { copyToClipboard, extractIscnIdPrefix } from '~/utils/ui'
@Component({
components: { IscnCard: () => import('~/components/IscnCard.vue') },
Expand All @@ -202,6 +210,8 @@ export default class IscnUploadedInfo extends Vue {
@Prop({ default: null }) readonly exifInfo: any | null | undefined
@Prop(Number) readonly step: number | undefined
isOpenCopiedAlert: boolean = false
get recordData() {
return this.record?.data
}
Expand Down Expand Up @@ -252,5 +262,14 @@ export default class IscnUploadedInfo extends Vue {
downloadJSON(generateData, 'iscn.json')
}
handleCopyIscnId() {
logTrackerEvent(this, 'ISCNView', 'CopyISCNID', this.iscnId, 1)
const iscnIdPrefix = extractIscnIdPrefix(this.iscnId)
if (iscnIdPrefix) {
copyToClipboard(iscnIdPrefix)
this.isOpenCopiedAlert = true
}
}
}
</script>

0 comments on commit 33592e5

Please sign in to comment.