Skip to content

Commit

Permalink
Merge pull request #144 from art-by-city/143-read-only-site
Browse files Browse the repository at this point in the history
143 read only site
  • Loading branch information
jim-toth authored Aug 12, 2024
2 parents cbdc689 + 475aaa1 commit 1e61388
Show file tree
Hide file tree
Showing 10 changed files with 196 additions and 88 deletions.
142 changes: 81 additions & 61 deletions components/FeedItemCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@
<v-row align="end" class="fill-height pa-1 pl-4">
<v-col>
<a class="text-white font-weight-bold">
{{
<!-- {{
isCuration ? data?.title : data?.publication?.title
}}
}} -->
{{ data?.publication?.title }}
</a>
<br>
<a class="text-white font-italic">
Expand Down Expand Up @@ -105,9 +106,9 @@

<script setup lang="ts">
import { VImg } from 'vuetify/lib/components/index.mjs'
import {
type CollaborativeWhitelistCurationState
} from '@artbycity/sdk/dist/web/curations'
// import {
// type CollaborativeWhitelistCurationState
// } from '@artbycity/sdk/dist/web/curations'

const img = ref<VImg>()

Expand All @@ -121,53 +122,61 @@ const props = defineProps<{ id: string }>()
const abc = useArtByCity()
const { protocol, host, port } = abc.arweave.api.config
const gatewayBase = `${protocol}://${host}:${port}`
const isCuration = ref<boolean>(false)
// const isCuration = ref<boolean>(false)

const { data, pending } = useLazyAsyncData(props.id, async () => {
const checkId = await abc.transactions.get(props.id)

if (checkId) {
if (
checkId.tags.find(o => o.name === 'Entity-Type')?.value === 'curation'
) {
// if (
// checkId.tags.find(o => o.name === 'Entity-Type')?.value === 'curation'
// ) {

isCuration.value = true
// isCuration.value = true

try {
const curation = abc
.curations
.get<CollaborativeWhitelistCurationState>(props.id)

const { cachedValue: { state } } = await curation.contract.readState()
const curatedPublications = []
// try {
// const curation = abc
// .curations
// .get<CollaborativeWhitelistCurationState>(props.id)

// const { cachedValue: { state } } = await curation
// .contract.readState()
// const curatedPublications = []

let count = 0
for (let i of state.items) {
curatedPublications.push(
await abc.legacy.fetchPublication(i)
)
count += 1
if (count === 3){ break }
}

return {
contract: curation,
title: state.title,
desc: state.metadata.description as string,
state,
curatedPublications,
username: await abc.usernames.resolveUsernameFromAddress(state.owner)
}
} catch (error) {
console.error('Error fetching curation', props.id, error)
}
} else {
const publication = await abc.legacy.fetchPublication(props.id)
const username =
await abc.usernames.resolveUsernameFromAddress(publication.creator)

return { publication, username }
}
// let count = 0
// for (let i of state.items) {
// curatedPublications.push(
// await abc.legacy.fetchPublication(i)
// )
// count += 1
// if (count === 3){ break }
// }

// return {
// contract: curation,
// title: state.title,
// desc: state.metadata.description as string,
// state,
// curatedPublications,
// username: await abc
// .usernames.resolveUsernameFromAddress(state.owner)
// }
// } catch (error) {
// console.error('Error fetching curation', props.id, error)
// }
// } else {
// const publication = await abc.legacy.fetchPublication(props.id)
// const username =
// await abc.usernames.resolveUsernameFromAddress(publication.creator)

// return { publication, username }
// }
const publication = await abc.legacy.fetchPublication(props.id)
// const username =
// await abc.usernames.resolveUsernameFromAddress(publication.creator)

// return { publication, username }
return { publication }
}

return null
Expand All @@ -180,38 +189,49 @@ const src = computed(() => {
return data.value.publication.image.preview.startsWith('data:image')
? data.value.publication.image.preview
: `${gatewayBase}/${data.value.publication.image.preview}`
} else if (data.value.curatedPublications) {
} /*else if (data.value.curatedPublications) {
return data.value.curatedPublications[0]?.image.preview
.startsWith('data:image')
? data.value.curatedPublications[0]?.image.preview
: `${gatewayBase}/${data.value.curatedPublications[0]?.image.preview}`
}
}*/

})

const isPlayable = computed(() => {
if (!data.value) { return false }

if (!isCuration.value) {
return data.value.publication?.image.animated
|| !!data.value.publication?.audio
|| !!data.value.publication?.model
}
// if (!isCuration.value) {
// return data.value.publication?.image.animated
// || !!data.value.publication?.audio
// || !!data.value.publication?.model
// }
return data.value.publication?.image.animated
|| !!data.value.publication?.audio
|| !!data.value.publication?.model
})

const to = computed(() => {
if (!isCuration.value) {
return `/${data.value?.username || data.value?.publication?.creator}/${
data.value?.publication?.slug || data.value?.publication?.id
}`
} else {
return `/curations/${data.value?.contract?.contractId}`
}
// if (!isCuration.value) {
// return `/${data.value?.username || data.value?.publication?.creator}/${
// data.value?.publication?.slug || data.value?.publication?.id
// }`
// } else {
// return `/curations/${data.value?.contract?.contractId}`
// }
// return `/${data.value?.username || data.value?.publication?.creator}/${
// data.value?.publication?.slug || data.value?.publication?.id
// }`
return `/${data.value?.publication?.creator}/${
data.value?.publication?.slug || data.value?.publication?.id
}`
})
const itemAddress = computed(() => {
return isCuration.value
? data?.value?.state?.owner
: data?.value?.publication?.creator
// return isCuration.value
// ? data?.value?.state?.owner
// : data?.value?.publication?.creator
return data?.value?.publication?.creator
})
</script>
115 changes: 102 additions & 13 deletions components/ResolveUsername.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<template>
<!-- <template>
<nuxt-link
v-if="!noLink"
class="text-primary"
Expand All @@ -19,23 +19,112 @@
{{ props.address }}
</code>
</template>
</template> -->

<template>
<nuxt-link
v-if="!noLink && props.address"
class="text-primary"
:to="`/${users[props.address as keyof typeof users] || props.address}`"
>
<span v-if="users[props.address as keyof typeof users]">
{{ users[props.address as keyof typeof users] }}
</span>
<code v-else>
{{ props.address }}
</code>
</nuxt-link>
<template v-else>
<span v-if="users[props.address as keyof typeof users]">
{{ users[props.address as keyof typeof users] }}
</span>
<code v-else>
{{ props.address }}
</code>
</template>
</template>

<script setup lang="ts">
const props = defineProps<{ address?: string, noLink?: boolean}>()
const abc = useArtByCity()
// const abc = useArtByCity()
const {
data: user
} = useLazyAsyncData(`resolve-username-${props.address}`, async () => {
if (!props.address) {
return { profile: null, username: null }
}
// const {
// data: user
// } = useLazyAsyncData(`resolve-username-${props.address}`, async () => {
// if (!props.address) {
// return { profile: null, username: null }
// }
const profile = await abc.legacy.fetchProfile(props.address)
const username =
await abc.usernames.resolveUsernameFromAddress(props.address)
// const profile = await abc.legacy.fetchProfile(props.address)
// const username =
// await abc.usernames.resolveUsernameFromAddress(props.address)
return { profile, username }
})
// return { profile, username }
// })
const users = {
"0EeHrLUiUepAW3IZ8ZrNRu8bxEOlumouTdMYKBPPPTM": "knust.art",
"1KZdIq1mkiTjb1gf6f5c__MUkheFyU6UK8-MMciSKnE": "higgsboson",
"1cX5WcLKn2kPWmiXPKbRIPpAWm5YP9H1172HpkYN1QI": "spunkart",
"1qXUQWHAqdk7JWk8PWcXlkhUdBuSH8hOZ010gVNexbc": "munaytu",
"2aLkIcBH52s2LtZoyRQC_YaFGGSB2r2yGUtgYM5MjZc": "murkury",
"3VOaO9LbI-zbta_u5Lw_KOTb-MAcRWikcV4X9fVvqBA": "jarm",
"3iqkDExLuyVn_Q3ojigg0pWmS_MgQjU_R5LCyo82CkE": "rubicon",
"3tt4qUpZSL5iFk5kMtu1Q_hgdsxd6FgyuRN37OICJes": "rob",
"4T0gyN4fDHrKSitSl-sw5_FuxGLg8sysBRsP4OF0I2o": "3d_stage_man",
"5V9nhSOQ5NeCRw9hAPoTMk8z1WimZfEeOqrbsvX_7-U": "elizabethtubbs",
"6uzZ2xVslWpFib3BR-J731uogU-FRuKDUifFVRZq8xE": "todcomplex",
"8Ki2ZXNe373ku9thijG_0tN8XR9B3mRoseGZqF1OpLM": "dankbinder",
"9XaFpHnpswVxZ7juWnG5iK9tYocYG_EYRf9WRmzbfCQ": "astronation",
"36Ar8VmyC7YS7JGaep9ca2ANjLABETTpxSeA7WOV45Y": "jim",
"83cE_sKfvJ2XugWumQZPY8KU9PpWqC8P_CnItpJWXn4": "purselnyc",
"276ituk07Igo0QzT5sa_ISRXwp04T5RfzBwZHS808h4": "paulmp",
"A2JEmT4LTk5WeBUFRGESX07OR-FUbtqfdBlBl8ooB64": "klarakopi",
"AVLvtbpOYQUM6_AAO2H0yG44Wl7A3O_F81YlIGrIaOA": "sull",
"AuIwEAQiHQHRDEMgXBHtYoJnQUlka2fqZsSvcxnLdE4": "bookwarrior",
"CxuvfybNxiEPpXGqIbM7tzzdSYOlOW9VOUWkf0FWH4c": "stargeezer",
"FB38OEe2LaObB4wpCu84NeQ1v7WsM9qltzRJfCZT3tg": "luchguch",
"FffUfjSCpv2PJhw1P0qzfM1P7xejXPdAQ-2qNWclFTg": "meredithmarsone",
"IEQHFG7nty3NvgTJB-22TX9iLv_wRBvzawg6dUQ6dM8": "striga",
"IP6zGbkq6jM_3VkzOiXrErbGisgIQCkkn6TlyFptPPY": "rheannon",
"IyWaTU4CUbaamvkK6oDNGCuB2pKMe7s3N4015qgY4iM": "jodybossert",
"LtILfPM8agd7RU6AaQmwh0SFEvxPu-tb06E_iHksvUM": "dabit",
"Q-47UUx60RSHNKS8jWkJA0DHX--PhGDC_0njFIplraQ": "n0tslide",
"Qk6U75ZH_Wtwq5BsNSZK35eYq2lUZbVtP_qfif2JeZk": "brecky",
"RJM8gDmbjPQw71EuN5rDgNQOLqE_WVvTDyqn4dNxZUg": "darsh",
"TJm7pAxZyJNE8IhYgC1ZEF3RiRI3B5u38REQJU0uy8I": "scott",
"TpdM8DXFdrcFwlJPv4v-jG1QAMWQi735FktvP74n6D4": "stephenkelly",
"UZcMu3sc90iBbmOU-LUS7mFsziPGIBLgcHKpB013pnk": "gabrieldisante",
"Uy2XZ7P7F4zBllF5uPdd1ih9jiQrIGvD3X8L13cc5_s": "artbycity",
"V1Vw3pLLoo67TNBMxP5SNh0iyoYAqoFLmCTUl2TBR-4": "cranial_origami",
"X3JpXG7ih3fyOaAqo3JXFBa2PLxKz7Va4v2xKWI23xA": "gds",
"XMRo2-N6pZZi7vo3A9gg1_ncK3fRuGYheuz7Lo7PH1Y": "oaldamster",
"YftBIDY3rUeITuEhhXBHCGY77K6VkBj70STjRyGFE4k": "paratect",
"YiQwzqUom7VYHCQ8WfTiXkHPGsVY7_zVk8fF9SuGYwI": "miceheads",
"aJIPwBoPqt1FGaa4pRoMotuDZr68PHRAoXe3lUerFTs": "harrymattihukkinen",
"aYDOU6kEcE3lK7aA-gTmUKHTbLlQnZZXWpv1_i_Uq1U": "kobold",
"bVa4IblSUZ0_VsqXPcr0e3oF6Q87yJ6EUVsxbwqwWmY": "mechelllord",
"cbXs6b-7NtpGtI2ed_A8p6sZRa2Ofy9L-hdxFK4EOL0": "dutchbihary",
"dYRuag6nzcdFXJ02_Ljf8ks-WDUrpAMeSI0agFd_ZBQ": "liz",
"fnJn1Kk2OTJeAK0cdfi4HLruw-9eaxImxVbnX226uJk": "amy",
"fsoSa_ZaN32EVo3nmmInaPq-7aZ4TTlWVaaYeNjpZ7A": "jamie",
"fzZvnOKhZoEC7txjXj-pYx-sSV3NLDLJi9u4BhvzXxU": "ikohaus",
"gU0ESu0Vm7SVjpjFf4yTSQUxPdC9Y84dOAxGNEVB0ac": "ohlala",
"hyL5aEp4K7fd7hYEjKxi6caxjyL2UANONOnnnFe7jwc": "daliahammar",
"i_0lXhTIsKKABEKYNlNTiKtY3QTbo9Dm56uzEvvi85g": "onlyarweave",
"k4fkc6NDiMmfVR06qX5P5XvAOlLi9J9fgBaa8pLvIBc": "zoran",
"kxOp1vsQZz-09PI5JGQ4ZQFUS1cFef6RiMRIEtgMtvQ": "libgen",
"mKRPxOSIe08BddCnrL9en8C3hUGqwA5l1sUZilGsjDg": "monchri",
"mg2tlAm4WgE7EgjavH09iOU67NwJIAyAFCDXg7RIdfc": "elycolz",
"nN5tmr6oBh5LBpFyVeq9iTn8NsxNZN9ziWC05PRyXE0": "codink",
"oDu0duoGgGJrKDaRU7AXnxVCYq-3LIi-jIX26pWThaw": "brendan",
"od35xAb8aQJjCHeLqg2n85dzSO5qEQSibYWrRgLJ7ko": "nathanwells",
"pZL40EWklkb9fO-9blbwvymjLUt5T5U31wldAnk-QAM": "bekopi",
"qoFt_qa74r8rPAIeZVd7wJUdQwLi8_7NvDOxs1dWf3c": "becopro",
"rxcJhMO1f1PUGUbM3gkBpNVK60iV-qhkqVK7jk2qGGo": "jstarr",
"x3GW6wfBZ3wHTflETInuzJ5rOv_6JvlFi-dl6yYAr8Y": "slava",
"xzCrjqG0qjX66T8mGNFyQEKd4qK6clSlp8XVvw2glwE": "maracarmona",
"ykP865v2o25da4fOR4Nex102tvTd7PXDsbCHPNLZV0o": "stefan",
"zIe2L7WAptLeDdDUcGPOFtBkItZuRE2wE2GQh2LfFqc": "johnnybrushstrokes"
}
</script>
8 changes: 4 additions & 4 deletions components/TopNavButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DISCOVER
</v-btn>
</v-col>
<v-col v-if="auth.isLoggedIn">
<!-- <v-col v-if="auth.isLoggedIn">
<v-btn
color="white"
density="comfortable"
Expand All @@ -21,7 +21,7 @@
>
CURATE
</v-btn>
</v-col>
</v-col> -->
<v-col class="mx-2">
<ConnectButton />
</v-col>
Expand All @@ -37,8 +37,8 @@
}
</style>

<script setup lang="ts">
<!-- <script setup lang="ts">
import { useAuthStore } from '~/stores/auth'
const auth = useAuthStore()
</script>
</script> -->
4 changes: 2 additions & 2 deletions pages/[profile]/[slugOrId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@
{{ artwork.title }}
</span>
</v-col>
<v-col cols="4" md="3" lg="2">
<!-- <v-col cols="4" md="3" lg="2">
<CurateMenu :item="artwork.id" />
</v-col>
</v-col> -->
</v-row>
<v-row>
<v-col
Expand Down
Loading

0 comments on commit 1e61388

Please sign in to comment.