Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Follow up for success drop notification #6256

Merged
merged 14 commits into from
Jun 23, 2023
1 change: 1 addition & 0 deletions components/collection/unlockable/UnlockableContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const resultList = ref<any[]>([])
const selectedImage = ref('')
const MAX_PER_WINDOW = 10
const { urlPrefix } = usePrefix()

const isLoading = ref(false)
const { accountId, isLogIn } = useAuth()
const { hours, minutes, seconds } = useCountDown(countDownTime)
Expand Down
51 changes: 45 additions & 6 deletions components/collection/unlockable/UnlockableLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,30 @@
<div class="loading-container py-2">
<NeoIcon class="close-icon" icon="close" @click.native="closeLoading" />
<img :src="unloackableLoaderImg" />
<div class="is-flex is-flex-direction-column is-align-items-center px-7">
<div class="has-text-weight-bold my-2">Congratulations</div>
<div
class="is-flex is-flex-direction-column is-align-items-center px-5 has-text-centered is-capitalized">
<div class="has-text-weight-bold mb-2">{{ $t('mint.success') }}</div>
<div>
Get ready for the big reveal! Your NFT will be visible in just
<span class="has-text-weight-bold">30 seconds</span> on your profile.
{{ $t('mint.unlockable.loader.viewNFT1') }}
<span v-if="minted">
{{ $t('mint.unlockable.loader.viewNFTNow2') }}
<span class="has-text-weight-bold">
{{ $t('mint.unlockable.loader.viewNFTNow3') }}</span
>
</span>
<span v-else>
{{ $t('mint.unlockable.loader.viewNFTLater2') }}
<span class="has-text-weight-bold">
{{ displaySeconds }}
{{ $t('mint.unlockable.loader.viewNFTLater3') }}
</span>
</span>
</div>
<div class="mt-4">
{{ $t('mint.unlockable.loader.shareSuccess') }}
<a :href="postTwitterUrl" target="_blank" class="has-text-link"
>{{ $t('mint.unlockable.loader.onTwitter') }}
</a>
</div>
<NeoButton
class="mb-2 mt-4 loading-button is-size-6"
Expand Down Expand Up @@ -39,8 +58,28 @@ const props = withDefaults(
)
const { urlPrefix } = usePrefix()
const { $i18n } = useNuxtApp()

const isLoading = useVModel(props, 'value')
import { useCountDown } from './utils/useCountDown'

const COUNT_DOWN_SECONDS = 31
const { seconds } = useCountDown(
new Date().getTime() + COUNT_DOWN_SECONDS * 1000
)

const displaySeconds = computed(() => {
return seconds.value >= 0 ? seconds.value : 'few'
})

const twitterText = computed(
() =>
'Just minted an exclusive NFT with unlockable items on @Kodadot! 🎉 So excited to add this unique collectible to my collection. Don\'t miss your chance! \n\n https://kodadot.xyz/stmn/unlockable'
)
const postTwitterUrl = computed(
() =>
`https://twitter.com/intent/tweet?text=${encodeURIComponent(
twitterText.value
)}`
)
const emit = defineEmits(['input'])

const closeLoading = () => {
Expand All @@ -61,7 +100,7 @@ const buttonLabel = computed(() =>
backdrop-filter: $frosted-glass-backdrop-filter;
margin: 0rem 1rem;
width: 385px;
min-height: 336px;
min-height: 356px;

@include ktheme() {
box-shadow: theme('primary-shadow');
Expand Down
1 change: 1 addition & 0 deletions components/collection/unlockable/utils/useCountDown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const useCountDown = (countDownTime: number) => {
seconds.value = Math.floor((distance % (1000 * 60)) / 1000)
}

countdown()
onMounted(() => {
timer.value = setInterval(countdown, 1000)
})
Expand Down
11 changes: 10 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,16 @@
"takeMe": "Take Me There!",
"viewItem": "View Item",
"preparing": "Preparing Your Item...",
"alreadyMinted": "🎉 You already have this NFT, check it here"
"alreadyMinted": "🎉 You already have this NFT, check it here",
"loader": {
"shareSuccess": "Share your success",
"onTwitter": "on Twitter",
"viewNFT1": "Get ready for the big reveal! Your NFT",
"viewNFTNow2": "is",
"viewNFTNow3": "visible now.",
"viewNFTLater2": " will be visible in",
"viewNFTLater3": "seconds."
}
}
},
"tooltip": {
Expand Down