Skip to content

Commit

Permalink
Adds curationfeed component and tab to profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Nopfed committed Nov 14, 2023
1 parent 0067a35 commit c724b11
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
47 changes: 47 additions & 0 deletions components/CurationsFeed.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<v-container v-if="curationFeed">
<v-row>
<v-col v-for="item in curationFeed" :key="item.id" cols="4">
<FeedItemCard :id="item.id" />
</v-col>
</v-row>
<v-row v-if="!hasReachedEnd">
<v-col>
<v-btn
elevation="2"
color="primary"
variant="outlined"
@click="onLoadMore"
>
Load More
</v-btn>
</v-col>
</v-row>
</v-container>
</template>

<script setup lang="ts">
import ArdbTransaction from 'ardb/lib/models/transaction'
const props = defineProps<{ address: string }>()
const abc = useArtByCity()
const curationFeed = ref<ArdbTransaction[]>([])
const cursor = ref<string | undefined>()
const hasReachedEnd = ref(false)
const onLoadMore = debounce(async () => {
if (hasReachedEnd.value) { return }
const { curations, cursor: nextCursor } = await abc
.curations
.createdBy(props.address, cursor.value)
curationFeed.value.push(...curations)
cursor.value = nextCursor
if (!nextCursor) {
hasReachedEnd.value = true
}
})
onLoadMore()
</script>
8 changes: 7 additions & 1 deletion pages/[profile]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<v-tab value="art">
Art
</v-tab>
<v-tab value="curations">
Curations
</v-tab>
<v-tab value="liked">
Likes
</v-tab>
Expand All @@ -42,7 +45,10 @@
</v-row>
<v-row>
<v-col>
<template v-if="tab === 'liked'">
<template v-if="tab === 'curations'">
<CurationsFeed :address="data.address" />
</template>
<template v-else-if="tab === 'liked'">
<LikesFeed :address="data.address" />
</template>
<template v-else-if="tab === 'tips'">
Expand Down

0 comments on commit c724b11

Please sign in to comment.