Skip to content

Commit

Permalink
Merge pull request kodadot#11336 from Jarsen136/issue-3299
Browse files Browse the repository at this point in the history
Refactor: remove `/rmrk` chain agnostic components
  • Loading branch information
vikiival authored Jan 6, 2025
2 parents 9e80e12 + 9d73bf9 commit d68eb90
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 192 deletions.
4 changes: 2 additions & 2 deletions components/base/BaseTokenForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
<script setup lang="ts">
import { NeoField } from '@kodadot1/brick'
import { useVModel } from '@vueuse/core'
import { MediaType } from '../rmrk/types'
import { resolveMedia } from '../rmrk/utils'
import type { BaseMintedCollection as MintedCollection } from './types'
import { resolveMedia, MediaType } from '@/utils/gallery/media'
import Auth from '@/components/shared/Auth.vue'
import MetadataUpload from '@/components/shared/DropUpload.vue'
import BasicInput from '@/components/shared/form/BasicInput.vue'
Expand Down
3 changes: 1 addition & 2 deletions components/base/MediaItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ import {
NeoVideoMedia,
} from '@kodadot1/brick'
import AudioMedia from '@/components/shared/AudioMedia.vue'
import { getMimeType, resolveMedia } from '@/utils/gallery/media'
import { MediaType } from '@/components/rmrk/types'
import { getMimeType, resolveMedia, MediaType } from '@/utils/gallery/media'
const props = withDefaults(
defineProps<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const CommonTokenMoney = defineAsyncComponent(
)
const GalleryCard = defineAsyncComponent(
() => import('@/components/rmrk/Gallery/GalleryCard.vue'),
() => import('@/components/gallery/GalleryCard.vue'),
)
const { urlPrefix } = usePrefix()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

<script setup lang="ts">
import { NeoButton, NeoPagination, NeoTooltip } from '@kodadot1/brick'
import { getRandomIntInRange } from '../utils'
const props = withDefaults(
defineProps<{
Expand Down Expand Up @@ -80,6 +79,12 @@ const onPageChange = () => {
}
}
const getRandomIntInRange = (min: number, max: number): number => {
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min + 1)) + min
}
const goToRandomPage = () => {
onPageChange()
const pageSize = Math.ceil(props.total / props.perPage)
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions components/gallery/GalleryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,10 @@ import UnlockableTag from './UnlockableTag.vue'
import { useGalleryItem } from './useGalleryItem'
import { GALLERY_ITEM_TABS } from '@/components/gallery/GalleryItemTabsPanel/types'
import CollectionDetailsPopover from '@/components/collectionDetailsPopover/CollectionDetailsPopover.vue'
import { MediaType } from '@/components/rmrk/types'
import { usePreferencesStore } from '@/stores/preferences'
import { exist } from '@/utils/exist'
import { formatBalanceEmptyOnZero, formatNumber } from '@/utils/format/balance'
import { resolveMedia } from '@/utils/gallery/media'
import { resolveMedia, MediaType } from '@/utils/gallery/media'
import { sanitizeIpfsUrl, toOriginalContentUrl } from '@/utils/ipfs'
import { convertMarkdownToText } from '@/utils/markdown'
import { generateNftImage } from '@/utils/seoImageGenerator'
Expand Down
2 changes: 1 addition & 1 deletion components/gallery/GalleryItemToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
<script setup lang="ts">
import { NeoIcon, NeoTooltip } from '@kodadot1/brick'
import { MediaType } from '@/components/rmrk/types'
import {
determineElementType,
mediaTypeElementSelectors,
resolveMedia,
MediaType,
} from '@/utils/gallery/media'
type ReloadElement =
Expand Down
2 changes: 1 addition & 1 deletion components/identity/module/IdentityPopoverFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ import { fetchFollowersOf } from '@/services/profile'
import type { NFT } from '@/types'
const GalleryCard = defineAsyncComponent(
() => import('../../rmrk/Gallery/GalleryCard.vue'),
() => import('@/components/gallery/GalleryCard.vue'),
)
const NFT_AMOUNT = 2
Expand Down
2 changes: 1 addition & 1 deletion components/profile/activityTab/Activity.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { NeoButton } from '@kodadot1/brick'
import History from './History.vue'
import { sortedEventByDate } from '@/utils/sorting'
import FilterButton from '@/components/profile/FilterButton.vue'
import Pagination from '@/components/rmrk/Gallery/Pagination.vue'
import Pagination from '@/components/common/Pagination.vue'
const route = useRoute()
const { replaceUrl } = useReplaceUrl()
Expand Down
2 changes: 1 addition & 1 deletion components/profile/activityTab/History.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import { parseDate } from '@/utils/datetime'
import type { Interaction as EventInteraction } from '@/types'
import ResponsiveTable from '@/components/shared/ResponsiveTable.vue'
import Pagination from '@/components/rmrk/Gallery/Pagination.vue'
import Pagination from '@/components/common/Pagination.vue'
import { emptyObject } from '@/utils/empty'
const prop = withDefaults(
Expand Down
110 changes: 0 additions & 110 deletions components/rmrk/service/types.ts

This file was deleted.

12 changes: 0 additions & 12 deletions components/rmrk/types.ts

This file was deleted.

49 changes: 0 additions & 49 deletions components/rmrk/utils.ts

This file was deleted.

4 changes: 2 additions & 2 deletions composables/useUserStats.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import resolveQueryPath from '@/utils/queryPathResolver'
import type { Event } from '@/components/rmrk/service/types'
import type { InteractionWithNFT } from '@/composables/collectionActivity/types'

export default () => {
const { client, urlPrefix } = usePrefix()
Expand All @@ -9,7 +9,7 @@ export default () => {

const getUserStats = async () => {
const query = await resolveQueryPath(client.value, 'profileStatsById')
const { data } = await useAsyncQuery<{ invested: Event[] }>({
const { data } = await useAsyncQuery<{ invested: InteractionWithNFT[] }>({
query: query.default,
clientId: client.value,
variables: {
Expand Down
4 changes: 0 additions & 4 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ export default defineNuxtConfig({
path: '~/components/landing',
extensions: ['vue'],
},
{
path: '~/components/rmrk',
extensions: ['vue'],
},
{
path: '~/components/series',
extensions: ['vue'],
Expand Down
12 changes: 11 additions & 1 deletion utils/gallery/media.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { MediaType } from '~/components/rmrk/types'
export enum MediaType {
VIDEO = 'Video',
MODEL = 'Model',
IMAGE = 'Image',
AUDIO = 'Audio',
JSON = 'Json',
TEXT = 'Text',
IFRAME = 'IFrame',
UNKNOWN = 'Unknown',
OBJECT = 'Object',
}

export const mediaTypeElementSelectors: Record<
Extract<
Expand Down
3 changes: 1 addition & 2 deletions utils/mintUtils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { OpenSeaAttribute as Attribute } from '@kodadot1/hyperdata'
import consola from 'consola'
import type { MassMintNFT } from '@/types'
import { MediaType } from '@/components/rmrk/types'
import { resolveMedia } from '@/components/rmrk/utils'
import { resolveMedia, MediaType } from '@/utils/gallery/media'

type Range = [number, number]

Expand Down

0 comments on commit d68eb90

Please sign in to comment.