From dfd3ddd112242964b3d27eed5e1ba61eba7c4e2d Mon Sep 17 00:00:00 2001 From: padreug Date: Wed, 17 Sep 2025 02:21:42 +0200 Subject: [PATCH] Add Rideshare functionality to NostrFeed module - Introduced a new RideshareComposer component for creating rideshare posts, allowing users to specify ride details such as type, locations, date, time, and contact methods. - Enhanced NostrFeed.vue to display rideshare badges for relevant posts, improving visibility and categorization of rideshare content. - Updated Home.vue to integrate the RideshareComposer, providing users with an option to compose rideshare requests or offers alongside regular notes. These changes enhance the user experience by facilitating rideshare interactions within the NostrFeed module, promoting community engagement. --- .../nostr-feed/components/NostrFeed.vue | 45 ++ .../components/RideshareComposer.vue | 447 ++++++++++++++++++ src/pages/Home.vue | 82 +++- 3 files changed, 564 insertions(+), 10 deletions(-) create mode 100644 src/modules/nostr-feed/components/RideshareComposer.vue diff --git a/src/modules/nostr-feed/components/NostrFeed.vue b/src/modules/nostr-feed/components/NostrFeed.vue index d453ef1..40f4781 100644 --- a/src/modules/nostr-feed/components/NostrFeed.vue +++ b/src/modules/nostr-feed/components/NostrFeed.vue @@ -92,6 +92,44 @@ function isAdminPost(pubkey: string): boolean { return adminPubkeys.includes(pubkey) } +// Check if a post is a rideshare post +function isRidesharePost(note: any): boolean { + // Check for rideshare tags + const hasTags = note.tags?.some((tag: string[]) => + tag[0] === 't' && ['rideshare', 'carpool'].includes(tag[1]) + ) || false + + // Check for rideshare-specific custom tags + const hasRideshareTypeTags = note.tags?.some((tag: string[]) => + tag[0] === 'rideshare_type' && ['offering', 'seeking'].includes(tag[1]) + ) || false + + // Check content for rideshare keywords (fallback) + const hasRideshareContent = note.content && ( + note.content.includes('šŸš— OFFERING RIDE') || + note.content.includes('🚶 SEEKING RIDE') || + note.content.includes('#rideshare') || + note.content.includes('#carpool') + ) + + return hasTags || hasRideshareTypeTags || hasRideshareContent +} + +// Get rideshare type from post +function getRideshareType(note: any): string | null { + // Check custom tags first + const typeTag = note.tags?.find((tag: string[]) => tag[0] === 'rideshare_type') + if (typeTag) { + return typeTag[1] === 'offering' ? 'Offering Ride' : 'Seeking Ride' + } + + // Fallback to content analysis + if (note.content?.includes('šŸš— OFFERING RIDE')) return 'Offering Ride' + if (note.content?.includes('🚶 SEEKING RIDE')) return 'Seeking Ride' + + return 'Rideshare' +} + // Get market product data for market events function getMarketProductData(note: any) { if (note.kind === 30018) { @@ -281,6 +319,13 @@ async function onToggleLike(note: any) { > {{ getMarketEventType({ kind: note.kind }) }} + + šŸš— {{ getRideshareType(note) }} + {{ getDisplayName(note.pubkey) }} diff --git a/src/modules/nostr-feed/components/RideshareComposer.vue b/src/modules/nostr-feed/components/RideshareComposer.vue new file mode 100644 index 0000000..9d6ed4a --- /dev/null +++ b/src/modules/nostr-feed/components/RideshareComposer.vue @@ -0,0 +1,447 @@ +