Refactor NostrFeed module and remove marketplace components
- Deleted the MarketProduct component and associated market parsing logic, streamlining the NostrFeed module. - Updated FeedService to exclude marketplace events from the main feed, ensuring clearer event management. - Adjusted content filters to remove marketplace-related entries, enhancing the organization of content filtering. These changes improve the clarity and efficiency of the NostrFeed module by separating marketplace functionality.
This commit is contained in:
parent
2a9915a727
commit
3c20d1c584
6 changed files with 3 additions and 389 deletions
|
|
@ -9,8 +9,6 @@ import { useProfiles } from '../composables/useProfiles'
|
|||
import { useReactions } from '../composables/useReactions'
|
||||
import appConfig from '@/app.config'
|
||||
import type { ContentFilter } from '../services/FeedService'
|
||||
import MarketProduct from './MarketProduct.vue'
|
||||
import { parseMarketProduct } from '../utils/marketParser'
|
||||
|
||||
interface Emits {
|
||||
(e: 'reply-to-note', note: { id: string; content: string; pubkey: string }): void
|
||||
|
|
@ -130,34 +128,6 @@ function getRideshareType(note: any): string | null {
|
|||
return 'Rideshare'
|
||||
}
|
||||
|
||||
// Get market product data for market events
|
||||
function getMarketProductData(note: any) {
|
||||
if (note.kind === 30018) {
|
||||
// Create a mock NostrEvent from our FeedPost
|
||||
const mockEvent = {
|
||||
id: note.id,
|
||||
pubkey: note.pubkey,
|
||||
content: note.content,
|
||||
created_at: note.created_at,
|
||||
kind: note.kind,
|
||||
tags: note.tags,
|
||||
sig: '' // Required by Event interface
|
||||
}
|
||||
return parseMarketProduct(mockEvent)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
// Handle market product actions
|
||||
function onViewProduct(productId: string) {
|
||||
console.log('View product:', productId)
|
||||
// TODO: Navigate to product detail page or open modal
|
||||
}
|
||||
|
||||
function onShareProduct(productId: string) {
|
||||
console.log('Share product:', productId)
|
||||
// TODO: Implement sharing functionality
|
||||
}
|
||||
|
||||
// Handle reply to note
|
||||
function onReplyToNote(note: any) {
|
||||
|
|
@ -247,53 +217,8 @@ async function onToggleLike(note: any) {
|
|||
<div v-else class="h-full overflow-y-auto scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent">
|
||||
<div>
|
||||
<div v-for="(note, index) in notes" :key="note.id" :class="{ 'bg-muted/20': index % 2 === 1 }">
|
||||
<!-- Market Product Component (kind 30018) -->
|
||||
<template v-if="note.kind === 30018">
|
||||
<div class="p-3 border-b border-border/40">
|
||||
<div class="mb-2 flex items-center justify-between">
|
||||
<div class="flex items-center gap-2">
|
||||
<Badge
|
||||
v-if="isAdminPost(note.pubkey)"
|
||||
variant="default"
|
||||
class="text-xs"
|
||||
>
|
||||
Admin
|
||||
</Badge>
|
||||
<span class="text-sm font-medium">{{ getDisplayName(note.pubkey) }}</span>
|
||||
</div>
|
||||
<span class="text-xs text-muted-foreground">
|
||||
{{ formatDistanceToNow(note.created_at * 1000, { addSuffix: true }) }}
|
||||
</span>
|
||||
</div>
|
||||
<MarketProduct
|
||||
v-if="getMarketProductData(note)"
|
||||
:product="getMarketProductData(note)!"
|
||||
@view-product="onViewProduct"
|
||||
@share-product="onShareProduct"
|
||||
/>
|
||||
<!-- Fallback for invalid market data -->
|
||||
<div
|
||||
v-else
|
||||
class="p-3 border rounded-lg border-destructive/20"
|
||||
>
|
||||
<div class="flex items-center gap-2 mb-2">
|
||||
<Badge variant="destructive" class="text-xs">
|
||||
Invalid Market Product
|
||||
</Badge>
|
||||
<span class="text-xs text-muted-foreground">
|
||||
{{ formatDistanceToNow(note.created_at * 1000, { addSuffix: true }) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-sm text-muted-foreground">
|
||||
Unable to parse market product data
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Regular Text Posts and Other Event Types -->
|
||||
<!-- Text Posts and Other Event Types -->
|
||||
<div
|
||||
v-else
|
||||
class="p-3 hover:bg-accent/50 transition-colors border-b border-border/40"
|
||||
>
|
||||
<!-- Note Header -->
|
||||
|
|
@ -313,13 +238,6 @@ async function onToggleLike(note: any) {
|
|||
>
|
||||
Reply
|
||||
</Badge>
|
||||
<Badge
|
||||
v-if="note.kind === 30018"
|
||||
variant="outline"
|
||||
class="text-xs px-1.5 py-0.5"
|
||||
>
|
||||
Market Product
|
||||
</Badge>
|
||||
<Badge
|
||||
v-if="isRidesharePost(note)"
|
||||
variant="secondary"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue