Skip to content

Commit

Permalink
Merge pull request #80 from art-by-city/79-bump-artbycitysdk-to-013
Browse files Browse the repository at this point in the history
Bumps @artbycity/sdk to v0.1.3 and adds support for ancient legacy da…
  • Loading branch information
jim-toth authored Oct 20, 2023
2 parents b81ec15 + c2db903 commit 5a96185
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 33 deletions.
22 changes: 7 additions & 15 deletions components/FeedItemCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,25 +125,17 @@ const { data, pending } = useLazyAsyncData(props.id, async () => {
})

const src = computed(() => {
if (data.value) {
if ('images' in data.value && data.value.images.length > 0) {
return `${gatewayBase}/${data.value.images[0].preview}`
}
}
if (!data.value) { return '' }

return ''
return data.value.image.preview.startsWith('data:image')
? data.value.image.preview
: `${gatewayBase}/${data.value.image.preview}`
})

const isPlayable = computed(() => {
if (data.value) {
if ('images' in data.value) {
return !!data.value.images[0].animated
} else if (
'audio' in data.value || 'model' in data.value
) { return true }
}

return false
if (!data.value) { return false }

return data.value.image.animated || !!data.value.audio || !!data.value.model
})

const to = computed(() => {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"vue-eslint-parser": "^9.3.1"
},
"dependencies": {
"@artbycity/sdk": "^0.1.1",
"@artbycity/sdk": "^0.1.3",
"@google/model-viewer": "^3.3.0",
"@mdi/font": "^7.2.96",
"@pinia/nuxt": "^0.4.11",
Expand Down
27 changes: 14 additions & 13 deletions pages/[profile]/[slugOrId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<v-img
:src="src"
aspect-ratio="1"
style="cursor: pointer;"
class="publication-image"
max-height="75vh"
max-width="75vw"
Expand Down Expand Up @@ -212,6 +211,7 @@
}
.publication-image {
margin: 0 auto;
cursor: pointer;
}
</style>

Expand All @@ -236,14 +236,11 @@ const hasError = computed(() => {
})
const src = computed(() => {
if (artwork.value) {
if ('images' in artwork.value && artwork.value.images.length > 0) {
/* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */
return `${gatewayBase}/${artwork.value.images[0].preview4k}`
}
}
if (!artwork.value) { return '' }
return ''
return artwork.value.image.preview4k.startsWith('data:image')
? artwork.value.image.preview4k
: `${gatewayBase}/${artwork.value.image.preview4k}`
})
const audioSrc = computed(() => {
Expand Down Expand Up @@ -294,11 +291,15 @@ const onOverlayClicked = debounce(() => {
})
const onImageClicked = debounce(() => {
if (artwork.value) {
if ('images' in artwork.value && artwork.value.images.length > 0) {
/* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */
window.open(`${gatewayBase}/${artwork.value.images[0].image}`, '_blank')
}
if (!artwork.value) { return }
if (!artwork.value.image.image.startsWith('data:image')) {
return `${gatewayBase}/${artwork.value.image.image}`
}
const image = new Image()
image.src = artwork.value.image.image
const w = window.open('', '_blank')
w?.document.write(image.outerHTML)
})
</script>

0 comments on commit 5a96185

Please sign in to comment.