Skip to content

Commit 0dc824a

Browse files
authored
Merge pull request #10263 from kodadot/main
beta update
2 parents bbdfdec + 365ae7a commit 0dc824a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2637
-3092
lines changed

STYLE_GUIDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ With a few exceptions, code and comments should be written in **English** only.
1717
- **Typescript**, **Javascript** and **GraphQL** files use **camelCase** (`globalVariables.ts`, `getKey.js`, `collectionById.graphql`)
1818
- **SCSS** files use **kebab-case** (`initial-variables.scss`)
1919
- **JSON** files use **snake_case** (`all_lang.json`) while **Markdown** files use **SCREAMING_SNAKE_CASE** (`CONTRIBUTING.md`)
20-
- **Image** files use **kebab-case** (`my-image.webp`) and **.webp** is the preffered image format
20+
- **Image** files use **kebab-case** (`my-image.webp`) and **.webp** is the preferred image format
2121

2222
## SFC Conventions
2323
### Skeleton

components/CookieBanner.vue

Lines changed: 91 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,103 @@
11
<template>
2-
<transition name="slide">
3-
<div v-if="!hasDisplayedCookieBanner" class="cookie-banner">
4-
<div
5-
class="notices flex overflow-hidden pointer-events-none fixed p-[2em] inset-0 is-bottom items-center w-full z-[1000]">
6-
<div
7-
role="alertdialog"
8-
class="snackbar is-success is-bottom-left !py-4 md:!py-2 px-4 mb-3 flex-col md:flex-row">
9-
<div class="md:flex md:gap-1">
10-
{{ $t('cookies.notice') }}, see
11-
<nuxt-link to="/cookie-notice" target="_blank" class="is-underlined"
12-
>Cookie Policy</nuxt-link
13-
>
14-
for details.
15-
</div>
16-
<div
17-
class="bg-separator-line-color m-4 md:!my-0 !w-full !h-[1px] md:!w-[1px] md:!h-[13px]" />
18-
<div
19-
class="flex items-center justify-between md:!my-0 w-full md:w-fit">
20-
<NeoButton variant="text" no-shadow @click="declineCookies">
21-
{{ $t('cookies.decline') }}
22-
</NeoButton>
23-
<NeoButton
24-
variant="secondary-rounded"
25-
no-shadow
26-
class="ml-3 h-8"
27-
data-testid="cookie-banner-button-accept"
28-
@click="acceptCookies">
29-
{{ $t('cookies.accept') }}
30-
</NeoButton>
31-
</div>
32-
</div>
33-
</div>
34-
</div>
35-
</transition>
2+
<CookieControl class="cookie-banner">
3+
<template #bar>
4+
<p>
5+
{{ $t('cookies.notice') }}
6+
<nuxt-link to="/cookie-notice" target="_blank" class="is-underlined"
7+
>Cookie Policy</nuxt-link
8+
>
9+
<span class="invisible md:visible mx-2">|</span>
10+
</p>
11+
</template>
12+
</CookieControl>
3613
</template>
3714

3815
<script lang="ts" setup>
39-
import { NeoButton } from '@kodadot1/brick'
40-
// import { useState } from 'vue-gtag-next'
16+
const cookieControl = useCookieControl()
17+
const { grantConsent, revokeConsent } = useGtag()
4118
42-
// const { isEnabled } = useState()
43-
const hasDisplayedCookieBanner = ref(
44-
localStorage.getItem('cookies_enabled') !== null || false,
19+
const cookieConsentGiven = computed(() =>
20+
cookieControl.cookiesEnabledIds.value?.includes('ga'),
4521
)
46-
const acceptCookies = () => {
47-
// if (isEnabled) {
48-
// isEnabled.value = true
49-
// }
50-
localStorage.setItem('cookies_enabled', '1')
51-
hasDisplayedCookieBanner.value = true
52-
}
53-
const declineCookies = () => {
54-
localStorage.setItem('cookies_enabled', '0')
55-
hasDisplayedCookieBanner.value = true
56-
}
22+
23+
watch(
24+
() => cookieControl.cookiesEnabledIds.value,
25+
() => {
26+
if (!cookieConsentGiven.value) {
27+
window.location.reload()
28+
}
29+
},
30+
{ deep: true },
31+
)
32+
33+
onMounted(() => {
34+
if (cookieConsentGiven.value || cookieConsentGiven.value === undefined) {
35+
grantConsent()
36+
} else {
37+
revokeConsent()
38+
}
39+
})
5740
</script>
5841

5942
<style lang="scss">
60-
.cookie-banner {
61-
.snackbar {
62-
align-self: flex-start;
63-
max-width: 720px;
43+
/* Custom Cookie #Bar */
44+
.cookieControl__BarContainer {
45+
@apply fixed p-4 mx-auto max-w-3xl self-start left-6 bottom-5 text-text-color bg-background-color border border-border-color shadow-primary;
46+
}
47+
.cookieControl__BarContainer p {
48+
@apply text-text-color text-base;
49+
}
50+
.cookieControl__BarButtons button {
51+
@apply text-sm bg-inherit text-text-color px-2 py-1;
52+
}
53+
54+
/* Custom Cookie #Modal */
55+
.cookieControl__ModalContent {
56+
@apply text-text-color bg-background-color border border-border-color shadow-primary items-center overflow-y-clip;
57+
}
58+
.cookieControl__ModalContent :not(button) {
59+
@apply text-text-color;
60+
}
61+
button.cookieControl__ModalClose {
62+
@apply invisible absolute top-3 right-0 h-0 w-0;
63+
}
64+
button.cookieControl__ModalClose:after {
65+
@apply absolute top-1 right-5 text-xs text-text-color font-medium bg-background-color hover:bg-gray-100 hover:text-gray-800 rounded-lg px-4 py-2.5 duration-300 transition-colors focus:outline-none visible;
66+
content: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2216%22%20height%3D%2216%22%20fill%3D%22currentColor%22%20class%3D%22bi%20bi-x-lg%22%20viewBox%3D%220%200%2016%2016%22%3E%0A%20%20%3Cpath%20d%3D%22M2.146%202.854a.5.5%200%201%201%20.708-.708L8%207.293l5.146-5.147a.5.5%200%200%201%20.708.708L8.707%208l5.147%205.146a.5.5%200%200%201-.708.708L8%208.707l-5.146%205.147a.5.5%200%200%201-.708-.708L7.293%208z%22%2F%3E%0A%3C%2Fsvg%3E');
67+
}
68+
.cookieControl__ModalButtons {
69+
@apply grid grid-cols-3 gap-4 mt-4 shrink-0 w-full;
70+
}
71+
.cookieControl__ModalButtons button {
72+
@apply text-sm bg-inherit text-text-color px-1 py-2;
73+
}
74+
.cookieControl__ModalContent .cookieControl__ModalInputWrapper input + button {
75+
@apply bg-gray-400;
76+
}
77+
.cookieControl__ModalContent input:checked + button::before {
78+
@apply bg-text-color;
79+
}
80+
.cookieControl__ModalContent
81+
.cookieControl__ModalInputWrapper
82+
input:checked
83+
+ button {
84+
@apply border border-solid border-border-color bg-background-color;
85+
}
86+
.cookieControl__ModalContent
87+
.cookieControl__ModalInputWrapper
88+
input:disabled
89+
+ button {
90+
@apply bg-gray-300;
91+
}
92+
@media screen and (max-width: 768px) {
93+
.cookieControl__BarButtons button + button {
94+
margin: 0;
95+
}
96+
.cookieControl__BarButtons {
97+
flex-direction: row-reverse;
98+
}
99+
.cookieControl__BarContainer {
100+
right: 1.5rem;
64101
}
65102
}
66103
</style>

components/collection/drop/MintButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const mintForLabel = computed(() =>
6969
$i18n.t('drops.mintForPaid', [
7070
`${formatAmountWithRound(drop.value?.price ? Number(drop.value?.price) * amountToMint.value : '', decimals.value)} ${
7171
chainSymbol.value
72-
} ${priceUsd.value ? '/ ' + (priceUsd.value * amountToMint.value).toFixed(1) + ' ' + $i18n.t('general.usd') : ''}`,
72+
} ${priceUsd.value ? '/ ' + (priceUsd.value * amountToMint.value).toFixed(2) + ' ' + $i18n.t('general.usd') : ''}`,
7373
]),
7474
)
7575

components/collection/drop/modal/DropConfirmModal.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,17 @@ const resentInitialConfirmationEmail = ref(false)
9999
100100
const mintedNFT = computed<MintedNFT | undefined>(() =>
101101
claimedNft.value
102-
? {
102+
? ({
103103
...claimedNft.value,
104+
index: Number(claimedNft.value.sn),
104105
image: sanitizeIpfsUrl(claimedNft.value.image),
106+
mimeType: 'text/html',
105107
collection: {
106108
id: claimedNft.value.collection,
107109
name: claimedNft.value.collectionName,
108110
max: claimedNft.value.max,
109111
},
110-
}
112+
} as MintedNFT)
111113
: undefined,
112114
)
113115

components/collection/drop/modal/paid/MintOverview.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
:src="
2727
toMintNft.imageDataPayload
2828
? toMintNft.imageDataPayload.image
29-
: sanitizeIpfsUrl(toMintNft.image)
29+
: sanitizeIpfsUrl(toMintNft.animationUrl)
3030
"
3131
:alt="toMintNft.name"
3232
:mime-type="!toMintNft.imageDataPayload ? 'text/html' : undefined"

components/collection/drop/modal/shared/SuccessfulDrop.vue

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
single: $t('drops.youSuccessfullyClaimedNft', [1]),
99
multiple: $t('drops.amountMintedSuccessfully', [items.length]),
1010
}"
11-
:items="items"
12-
media-mime-type="text/html" />
11+
:items="items" />
1312
</SuccessfulModalBody>
1413
</template>
1514

1615
<script setup lang="ts">
1716
import type { ItemMedia } from '@/components/common/successfulModal/SuccessfulItemsMedia.vue'
1817
import { MintedNFT, MintingSession } from '../../types'
18+
import { ShareProp } from '@/components/common/successfulModal/SuccessfulModalBody.vue'
1919
2020
const emit = defineEmits(['list'])
2121
const props = defineProps<{
@@ -27,6 +27,7 @@ const { $i18n } = useNuxtApp()
2727
const { toast } = useToast()
2828
const { urlPrefix } = usePrefix()
2929
const { accountId } = useAuth()
30+
const { getCollectionFrameUrl } = useSocialShare()
3031
3132
const cantList = computed(() => !props.canListNfts)
3233
const txHash = computed(() => props.mintingSession.txHash ?? '')
@@ -42,6 +43,7 @@ const items = computed<ItemMedia[]>(() =>
4243
image: item.image,
4344
collection: item.collection.id,
4445
collectionName: item.collection.name,
46+
mimeType: item.mimeType,
4547
})),
4648
)
4749
@@ -54,16 +56,27 @@ const userProfilePath = computed(
5456
)
5557
5658
const sharingTxt = computed(() =>
57-
$i18n.t('sharing.dropNft', [
58-
mintedNft.value?.id,
59-
mintedNft.value?.collection.max,
60-
]),
59+
singleMint.value
60+
? $i18n.t('sharing.dropNft', [`#${mintedNft.value?.index}`])
61+
: $i18n.t('sharing.dropNfts', [
62+
props.mintingSession.items.map((item) => `#${item.index}`).join(', '),
63+
]),
6164
)
6265
63-
const share = computed(() => ({
66+
const share = computed<ShareProp>(() => ({
6467
text: sharingTxt.value,
6568
url: nftFullUrl.value,
6669
withCopy: singleMint.value,
70+
social: {
71+
farcaster: {
72+
embeds: [
73+
getCollectionFrameUrl(
74+
urlPrefix.value,
75+
mintedNft.value?.collection.id as string,
76+
),
77+
],
78+
},
79+
},
6780
}))
6881
6982
const actionButtons = computed(() => ({

components/collection/drop/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ export type MintedNFT = {
3434
chain: string
3535
name: string
3636
image: string
37+
index: number
3738
collection: { id: string; name: string; max: number }
39+
mimeType?: string
3840
}
3941

4042
export type MintingSession = {

components/common/autoTeleport/AutoTeleportPopover.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<NeoIcon icon="fa-info-circle" pack="fa-regular" class="ml-2 text-k-grey" />
44

55
<template #content>
6-
<div class="w-[16rem] bg-background-color text-xs border p-4">
6+
<div class="w-[16rem] bg-background-color text-sm border p-4">
77
<div class="flex text-base mb-3">
88
<NeoIcon icon="fa-info-circle" pack="fa-regular" class="mr-2" />
99

@@ -49,7 +49,7 @@
4949
<div class="flex justify-start mt-5">
5050
<a
5151
href="https://hello.kodadot.xyz/tutorial/teleport/auto-teleport"
52-
class="text-k-blue hover:text-k-blue-hover text-xs"
52+
class="text-k-blue hover:text-k-blue-hover text-sm"
5353
target="_blank"
5454
rel="nofollow noopener noreferrer"
5555
>{{ $t('helper.learnMore') }}</a

components/common/listingCart/ListingCartMini.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<transition name="slide">
33
<div v-if="listingCartStore.count" class="listing-container">
44
<div class="inline-flex items-center">
5-
<div class="k-shadow bg-background-color border py-4 px-6">
5+
<div class="k-shadow bg-background-color border flex items-center h-13 px-6">
66
<div class="inline-flex items-center">
77
<div>
88
<b>{{ listingCartStore.count }}</b>
@@ -28,8 +28,9 @@
2828
</div>
2929
</div>
3030
<NeoButton
31-
class="h-full border-l-0 py-4 px-7"
31+
class="border-l-0 px-7"
3232
:variant="'k-accent'"
33+
size="large"
3334
@click="preferencesStore.listingCartModalOpen = true">
3435
{{ $t('listingCart.listItem', listingCartStore.count) }}
3536
</NeoButton>

components/common/listingCart/SuccessfulListingBody.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ const { accountId } = useAuth()
2828
const mediaItems = computed<ItemMedia[]>(() =>
2929
props.items.map((item) => ({
3030
id: item.id,
31-
image: item.meta?.image as string,
31+
image: (item.mediaUrl?.image || item.meta?.image) as string,
3232
name: item.name,
3333
collection: item.collection.id,
3434
collectionName: item.collection.name,
35+
mimeType: item.mediaUrl?.mimeType,
3536
price: item.listPrice
3637
? String(item.listPrice * Math.pow(10, decimals.value))
3738
: undefined,

0 commit comments

Comments
 (0)