Files
orangecat/docs/features/sharing-system.md
T

9.3 KiB

Project Sharing System

Last Updated: 2025-11-03 Status: ✅ Fully Functional

Overview

The sharing system enables users to share Bitcoin fundraising projects across multiple platforms with rich social media previews. The implementation follows DRY (Don't Repeat Yourself) principles with reusable, modular components.


Features

✅ Multi-Platform Sharing

  • Twitter - Optimized tweets with hashtags (#Bitcoin #Fundraising)
  • Facebook - Rich link previews
  • LinkedIn - Professional sharing with summary
  • WhatsApp - Mobile-friendly sharing
  • Email - Pre-formatted email templates

✅ Native Mobile Share

  • Uses Web Share API when available
  • Integrates with device share sheet
  • Includes all installed apps (iMessage, Messenger, etc.)
  • Graceful fallback to copy-to-clipboard

✅ Rich Social Previews

  • Open Graph meta tags for Facebook/LinkedIn
  • Twitter Card meta tags
  • Large image cards (1200x630px recommended)
  • Automatic title and description formatting

✅ Copy to Clipboard

  • One-click URL copying
  • Visual feedback with toast notifications
  • Fallback for browsers without share API

Architecture

Components

1. ShareButton (src/components/sharing/ShareButton.tsx)

Purpose: Trigger component for sharing

Props:

{
  projectId: string;
  projectTitle: string;
  projectDescription?: string;
  projectImage?: string;
  variant?: 'button' | 'icon';
  size?: 'sm' | 'md' | 'lg';
}

Features:

  • Button or icon-only variants
  • Dropdown positioning
  • Keyboard navigation (Escape to close)
  • Click-outside detection
  • Accessible (ARIA labels)

2. CampaignShare (src/components/sharing/CampaignShare.tsx)

Purpose: Share options UI with platform selection

Props:

{
  projectId: string;
  projectTitle: string;
  projectDescription?: string;
  projectImage?: string;
  currentUrl?: string;
  onClose?: () => void;
  variant?: 'modal' | 'dropdown' | 'inline';
}

Features:

  • 5 social platforms + email
  • Native Web Share API integration
  • Analytics tracking for each share
  • Platform-specific URL formatting
  • Visual feedback (colors, icons)

Variants:

  • modal - Full-screen overlay
  • dropdown - Compact dropdown menu (default)
  • inline - Embedded in page

3. SocialMetaTags (src/components/seo/SocialMetaTags.tsx)

Purpose: Reusable SEO component for rich social previews

Props:

{
  title: string;
  description: string;
  image?: string;
  url?: string;
  type?: 'website' | 'article' | 'profile';
  siteName?: string;
  twitterCard?: 'summary' | 'summary_large_image';
}

Generated Tags:

  • Open Graph (og:title, og:description, og:image, og:url, og:type)
  • Twitter Card (twitter:card, twitter:title, twitter:description, twitter:image)
  • Standard meta (title, description)

Usage

Basic Implementation

import ShareButton from '@/components/sharing/ShareButton';
import SocialMetaTags from '@/components/seo/SocialMetaTags';

export default function ProjectPage({ project }) {
  return (
    <>
      {/* Add social meta tags */}
      <SocialMetaTags
        title={`${project.title} - OrangeCat`}
        description={project.description}
        image={project.image}
        url={`https://orangecat.com/project/${project.id}`}
      />

      {/* Add share button */}
      <ShareButton
        projectId={project.id}
        projectTitle={project.title}
        projectDescription={project.description}
        variant="button"
        size="sm"
      />
    </>
  );
}

Best Practices

1. DRY - Don't Repeat Yourself ✅

  • Use SocialMetaTags component instead of manual meta tags
  • Use ShareButton instead of reimplementing share UI
  • Single source of truth for share URL generation

2. Modular Design ✅

  • ShareButton handles UI and dropdown logic
  • CampaignShare handles platform actions
  • SocialMetaTags handles SEO
  • Each component has a single responsibility

3. Accessibility ✅

  • ARIA labels on buttons
  • Keyboard navigation (Escape key)
  • Focus management
  • Screen reader friendly

4. Performance ✅

  • Progressive enhancement (Web Share API)
  • Graceful degradation
  • No unnecessary re-renders
  • Lightweight components

5. Analytics ✅

  • Track share events by platform
  • Track native share separately
  • Include project metadata in events

Platform-Specific Formatting

Twitter

{title}

{description}

#Bitcoin #Fundraising #Crowdfunding

{url}

Facebook

URL with Open Graph preview

LinkedIn

URL: {url}
Title: {title}
Summary: {description}

WhatsApp

{title}

{description}

{url}

Email

Subject: Support this project: {title}
Body:
Hi,

I wanted to share this amazing Bitcoin fundraising project with you:

{title}

{description}

Check it out here: {url}

Best regards

User Experience

Desktop Flow

  1. User clicks "Share" button
  2. Dropdown appears with platform icons
  3. User selects platform
  4. New window opens with pre-filled content
  5. User confirms share on platform

Mobile Flow (with Web Share API)

  1. User clicks "Share" button
  2. Dropdown appears with "Share via..." button prominently
  3. User clicks "Share via..."
  4. Native device share sheet opens
  5. User selects app (WhatsApp, iMessage, etc.)
  6. Share completes in chosen app

Mobile Flow (fallback)

  1. User clicks "Share" button
  2. Dropdown appears (no native share)
  3. User selects platform or copies link
  4. Toast notification confirms action

Analytics Events

Track these events for sharing metrics:

trackEvent('project_share_Twitter', { projectId, projectTitle });
trackEvent('project_share_Facebook', { projectId, projectTitle });
trackEvent('project_share_LinkedIn', { projectId, projectTitle });
trackEvent('project_share_WhatsApp', { projectId, projectTitle });
trackEvent('project_share_Email', { projectId, projectTitle });
trackEvent('project_share_native', { projectId, projectTitle });

Design Decisions

✅ Share Button Visible to All Users (Not Just Owner)

Rationale: Visitors are the viral amplification vector. The whole point of sharing is enabling others to spread the word.

✅ Native Share API as Primary on Mobile

Rationale: Users expect native behavior on mobile devices. It's more familiar and provides access to all their apps.

✅ Reusable SocialMetaTags Component

Rationale: Following DRY principles. Every page that needs social sharing can reuse this component instead of duplicating meta tags.

❌ No QR Codes (Intentionally Excluded)

Rationale: QR codes are for physical→digital transitions (posters, business cards). Users viewing the project page are already digital. If needed, this is a separate "Marketing Materials" feature.

❌ No Share Icons on Project Cards (Intentionally Excluded)

Rationale: Cards are for browsing/discovery. Share makes sense on detail page after user engagement. Adding icons to every card clutters the UI.


Testing Checklist

Functional Testing

  • Share button appears on project pages for all users
  • Clicking share button opens dropdown
  • All 5 platforms open correct sharing windows
  • Copy link copies correct URL
  • Toast notifications appear on copy
  • Escape key closes dropdown
  • Click outside closes dropdown
  • Native share works on mobile (if supported)

Social Preview Testing

Use these validators:

Cross-Browser Testing

  • Chrome (desktop & mobile)
  • Safari (desktop & mobile)
  • Firefox
  • Edge

Accessibility Testing

  • Keyboard navigation works
  • Screen reader announces button
  • Focus visible on keyboard nav
  • ARIA labels present

Maintenance

Adding New Platforms

To add a new sharing platform:

  1. Add platform config to CampaignShare.tsx:
{
  name: 'NewPlatform',
  icon: NewIcon,
  color: 'text-color-xxx',
  bgColor: 'bg-color-xxx',
  action: (url, title, description) => {
    const shareUrl = `https://newplatform.com/share?url=${url}`;
    window.open(shareUrl, '_blank');
  }
}
  1. Add analytics tracking:
trackEvent('project_share_NewPlatform', { projectId, projectTitle });
  1. Test share flow on actual platform

Performance Metrics

Expected Impact

  • 3-5x increase in click-through rate from rich previews
  • 60-70% of mobile users will use native share
  • Reduced friction for viral sharing

Monitor These KPIs

  • Share button click rate
  • Shares by platform
  • Traffic from social referrals
  • Conversion rate from shared links

Future Enhancements

P1 - High Priority

  • Add share count display ("Shared 127 times")
  • Add custom share messages per platform
  • A/B test share button placement

P2 - Medium Priority

  • Generate dynamic share images with project details
  • Add "Share Update" for project milestones
  • Email share tracking (unique UTM codes)

P3 - Low Priority

  • QR code generation for marketing materials (separate feature)
  • Downloadable social media graphics
  • Share leaderboard for top sharers

Status: Production Ready ✅ Maintainer: Development Team Last Review: 2025-11-03