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

🔧 wip: nuxt3 #6917

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 24 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
node: true,
},
extends: [
'plugin:vue/recommended',
// 'plugin:vue/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
Expand All @@ -15,8 +15,9 @@ module.exports = {
ecmaVersion: 2020,
sourceType: 'module',
},
plugins: ['vue', 'prettier', '@typescript-eslint', 'unicorn'],
plugins: ['prettier', '@typescript-eslint', 'unicorn'],
rules: {
'no-empty-function': 'warn',
'no-trailing-spaces': 'error',
'unicorn/no-for-loop': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: false }],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import '~/node_modules/highlight.js/styles/github-dark.css';
@import '@/styles/abstracts/variables';
@import '@/assets/styles/abstracts/variables';

.content-markdown {
pre.hljs {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion styles/index.scss → assets/styles/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@import "abstracts/theme";

// FRAMEWORK (note: don't move this on top)
@import "~bulma";
@import "bulma/bulma.sass";

// GLOBAL
@import "./global.scss";
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions components/CookieBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
</div>
<div class="bar ml-4 mr-4" />
<div class="action is-success">
<NeoButton variant="text" no-shadow @click.native="declineCookies">
<NeoButton variant="text" no-shadow @click="declineCookies">
{{ $t('cookies.decline') }}
</NeoButton>
<NeoButton
variant="text"
no-shadow
class="has-text-weight-bold ml-3"
@click.native="acceptCookies">
@click="acceptCookies">
{{ $t('cookies.accept') }}
</NeoButton>
</div>
Expand Down
8 changes: 4 additions & 4 deletions components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@

<script lang="ts" setup>
import { NeoIcon } from '@kodadot1/brick'

import { nextTick } from 'vue'
import { ConnectWalletModalConfig } from '@/components/common/ConnectWallet/useConnectWallet'
import ChainSelectDropdown from '@/components/navbar/ChainSelectDropdown.vue'
import CreateDropdown from '@/components/navbar/CreateDropdown.vue'
Expand All @@ -208,7 +208,7 @@ import { getChainNameByPrefix } from '@/utils/chain'
import { createVisible } from '@/utils/config/permission.config'
import ShoppingCartButton from './navbar/ShoppingCartButton.vue'

const { $nextTick, $neoModal } = useNuxtApp()
const { $neoModal } = useNuxtApp()
const instance = getCurrentInstance()
const showTopNavbar = ref(true)
const openMobileSearchBar = ref(false)
Expand Down Expand Up @@ -292,7 +292,7 @@ const onScroll = () => {
}

const setBodyScroll = (allowScroll: boolean) => {
$nextTick(() => {
nextTick(() => {
const body = document.querySelector('body') as HTMLBodyElement
if (allowScroll) {
body.classList.remove('is-clipped')
Expand All @@ -304,7 +304,7 @@ const setBodyScroll = (allowScroll: boolean) => {

const showMobileSearchBar = () => {
openMobileSearchBar.value = true
$nextTick(() => {
nextTick(() => {
mobilSearchRef.value?.focusInput()
})
setBodyScroll(false)
Expand Down
9 changes: 4 additions & 5 deletions components/TheFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="is-flex is-align-items-center footer-container-subs-items">
<div id="custom-substack-embed"></div>

<script>
<!-- <script>
window.CustomSubstackWidget = {
substackUrl: 'kodadot.substack.com',
placeholder: '[email protected]',
Expand All @@ -22,7 +22,7 @@
},
}
</script>
<script src="https://substackapi.com/widget.js" async></script>
<script src="https://substackapi.com/widget.js" async></script> -->
</div>
</section>
<section class="footer-container-info is-flex is-flex-direction-column">
Expand Down Expand Up @@ -145,7 +145,6 @@
</clipPath>
</defs>
</svg>

<NeoIcon
v-else
:pack="item.name == 'Swag' ? 'fas' : 'fab'"
Expand All @@ -160,11 +159,11 @@
</template>

<script lang="ts" setup>
import { TranslateResult } from 'vue-i18n/types'
// import { TranslateResult } from 'vue-i18n/types'
import { NeoIcon } from '@kodadot1/brick'

interface Menu {
name: TranslateResult
name: string
url: string
external?: boolean
}
Expand Down
2 changes: 1 addition & 1 deletion components/base/SubmitButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:expanded="expanded"
icon-pack="far"
outlined
@click.native="$emit('click')">
@click="$emit('click')">
<slot>
{{ $t(label) }}
</slot>
Expand Down
19 changes: 12 additions & 7 deletions components/blog/BlogPost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,32 @@
</div>
</template>

<script setup>
<script setup lang="ts">
import { format } from 'date-fns'
import { convertMarkdownToText } from '@/utils/markdown'
import { nextTick } from 'vue'
import hljs from 'highlight.js'

const { $seoMeta } = useNuxtApp()
const { $nextTick, $seoMeta } = useNuxtApp()
const route = useRoute()

const slug = route.params.slug
const attributes = ref({})
const singlePostComponent = ref('')

onMounted(async () => {
const post = await import(`~/content/blog/${slug}.md`)
// const post = await import(`~/content/blog/${slug}.md`)
const post = {
attributes: 'test',
vue: {
component: {},
},
}

attributes.value = post.attributes
singlePostComponent.value = post.vue.component

// must wait the page finished render then highlight the code
await nextTick()
await $nextTick()
hljs.highlightAll()
})

Expand All @@ -54,15 +59,15 @@ const meta = computed(() => {
]
})

useNuxt2Meta({
useHead({
title,
meta,
})
</script>

<style lang="scss">
@use 'sass:meta';
@import '@/styles/abstracts/variables';
@import '@/assets/styles/abstracts/variables';

// dynamic load highlight syntax theme based on page theme
html.light-mode {
Expand Down
2 changes: 1 addition & 1 deletion components/bsx/Asset/AssetTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<NeoButton
v-else
icon-left="money-bill"
@click.native="tellFrens(props.row.id)">
@click="tellFrens(props.row.id)">
{{ $t('asset.action.default') }}
</NeoButton>
</NeoTableColumn>
Expand Down
2 changes: 1 addition & 1 deletion components/bsx/Offer/MasterOfferTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
v-if="isLogIn"
icon-left="paper-plane"
class="fill-button mt-6"
@click.native="fillUpAddress">
@click="fillUpAddress">
Fill My Address
</NeoButton>
</div>
Expand Down
10 changes: 3 additions & 7 deletions components/bsx/Offer/MyOffer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
{{ option.value }}
</option>
</NeoSelect>
<NeoButton
no-shadow
size="medium"
icon-left="refresh"
@click.native="refresh" />
<NeoButton no-shadow size="medium" icon-left="refresh" @click="refresh" />
</div>
<Loader v-model="isLoading" :status="status" />
<NeoTable :data="displayOffers(offers)">
Expand Down Expand Up @@ -63,13 +59,13 @@
v-if="props.row.caller === accountId"
no-shadow
icon-left="times"
@click.native="onClick(props.row, true)" />
@click="onClick(props.row, true)" />
<NeoButton
v-else
variant="success"
no-shadow
icon-left="money-bill"
@click.native="onClick(props.row, false)" />
@click="onClick(props.row, false)" />
</NeoTableColumn>
<NeoTableColumn
v-slot="props"
Expand Down
2 changes: 1 addition & 1 deletion components/bsx/Offer/OffersUserTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
v-if="props.row.status === 'ACTIVE'"
no-shadow
icon-left="times"
@click.native="withdrawOffer(props.row)" />
@click="withdrawOffer(props.row)" />
</NeoTableColumn>
</NeoTable>
</div>
Expand Down
5 changes: 5 additions & 0 deletions components/carousel/module/CarouselAgnostic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
:key="`${item.id}-${index}`"
class="keen-slider__slide carousel-item">
<div class="h-full is-flex is-flex-direction-column">
<nuxt-link :to="`/bsx/collection/${item.id}`">
{{ item.id }}
</nuxt-link>
<CarouselMedia :item="item" :index="index" :length="nfts.length" />
<CarouselInfo :item="item" />
</div>
Expand All @@ -29,6 +32,8 @@
</template>

<script lang="ts" setup>
const CarouselMedia = defineAsyncComponent(() => import('./CarouselMedia.vue'))
const CarouselInfo = defineAsyncComponent(() => import('./CarouselInfo.vue'))
import type { CarouselNFT } from '@/components/base/types'

import 'keen-slider/keen-slider.min.css'
Expand Down
56 changes: 30 additions & 26 deletions components/carousel/utils/useCarouselEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,8 @@ const nftEventVariables = {

const disableChainsOnBeta = ['snek']

const fetchLatestEvents = (chain, type, where = {}) => {
const { $apollo } = useNuxtApp()
const query = chain === 'ksm' ? latestEventsRmrkv2 : latestEvents

return $apollo.query({
query,
client: chain,
variables: {
limit: limit,
orderBy: 'timestamp_DESC',
where: {
...nftEventVariables[type],
...where,
},
},
})
}

const useChainEvents = (chain, type) => {
const query = chain === 'ksm' ? latestEventsRmrkv2 : latestEvents
const nfts = ref<{ nft: NFTWithMetadata; timestamp: string }[]>([])
const uniqueNftId = ref<string[]>([])
const totalCollection = reactive({})
Expand Down Expand Up @@ -75,25 +58,46 @@ const useChainEvents = (chain, type) => {
pushNft(nft)
}

const fetchEvents = () => {
fetchLatestEvents(chain, type, {
// const { result, refetch } = useQuery(query, {
// limit: limit,
// orderBy: 'timestamp_DESC',
// where: {
// ...nftEventVariables[type],
// nft: {
// ...(type === 'newestList' && { price_gt: 0 }),
// id_not_in: [...new Set(excludeNftId.value)],
// collection: {
// id_not_in: [...new Set(excludeCollectionId.value)],
// },
// },
// },
// })

const { onResult, refetch } = useQuery(query, {
limit: limit,
orderBy: 'timestamp_DESC',
where: {
...nftEventVariables[type],
nft: {
...(type === 'newestList' && { price_gt: 0 }),
id_not_in: [...new Set(excludeNftId.value)],
collection: {
id_not_in: [...new Set(excludeCollectionId.value)],
},
},
}).then((response) => {
response.data.events.forEach((nft) => {
limitCollection(nft)
})
},
})

onResult((result) =>
result.data.events.forEach((nft) => {
console.log(nft)
limitCollection(nft)
})
}
)

watchEffect(() => {
if (nfts.value.length < limit) {
fetchEvents()
refetch()
}
})

Expand Down
14 changes: 7 additions & 7 deletions components/carousel/utils/useCarouselSpotlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import type { CarouselNFT } from '@/components/base/types'

import { sanitizeIpfsUrl } from '@/utils/ipfs'

import collectionCuratedList from '@/queries/subsquid/general/collectionCuratedList.graphql'
import collectionLastList from '@/queries/subsquid/general/collectionLastList.graphql'

const curatedCollection = {
bsx: [
'1865909717', // 'Berliner'
Expand Down Expand Up @@ -62,13 +65,10 @@ export default function useCarouselSpotlight() {
const variables = curatedCollection[urlPrefix.value]?.length
? { list: curatedCollection[urlPrefix.value] }
: undefined
const { data } = useGraphql({
queryName: curatedCollection[urlPrefix.value]?.length
? 'collectionCuratedList'
: 'collectionLastList',
queryPrefix: urlPrefix.value,
variables,
})
const query = curatedCollection[urlPrefix.value]?.length
? collectionCuratedList
: collectionLastList
const { result: data } = useQuery(query, { ...variables })

watch(data, () => {
updateCollections(data.value)
Expand Down
4 changes: 2 additions & 2 deletions components/collection/CollectionHeader/CollectionBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ const meta = computed(() => {
),
})
})
useNuxt2Meta({
useHead({
title: collectionName,
meta,
})
</script>

<style scoped lang="scss">
@import '@/styles/abstracts/variables';
@import '@/assets/styles/abstracts/variables';

.collection-banner {
background-repeat: no-repeat;
Expand Down
Loading
Loading