Skip to content

E-07: Web Share API Integration for Scan Results #53

@diyamajee-spec

Description

@diyamajee-spec

Description

Currently, after a user finishes a fish freshness scan, they are sent to the analysis dashboard to see their results (freshness index, grade, species info, and biomarker breakdown). We have plans for PDF generation, but mobile users get a lot out of native, quick-sharing options to let others (like vendors or family) know about the freshness rating via apps like WhatsApp, Telegram, or email.
This issue proposes adding a mobile-friendly "Share Scan" action button that utilizes the native browser Web Share API (with fallback for unsupported browsers/devices).

Proposed Solution

  1. Button Addition & Styling:
    • In src/pages/AnalysisDashboard.tsx, add a "Share Scan" button next to existing action buttons (e.g., "New Scan").
    • Use an appropriate share icon from lucide-react (e.g., <Share2 className="w-4 h-4" />).
    • Style it using the codebase design system tokens in src/index.css (e.g., glassmorphism styles, hover scaling, monospace labels).
  2. Sharing Handler Logic:
    • Check if navigator.share is supported by the user's browser.
    • If supported: Trigger the native share dialog with:
      • title: "FreshScan AI - Fish Freshness Report"
      • text: "I just scanned a fish ([Species Name]) using FreshScan AI. Freshness Index: [Score]% (Grade [Grade]). Check the detailed report here!"
      • url: Current page URL (window.location.href).
    • If unsupported (desktop/fallback): Copy the formatted text string + the URL to the user's clipboard and trigger a success Toast notification (e.g., "Link and report copied to clipboard!").

Tasks & Checklists

  • Add the "Share Scan" button to src/pages/AnalysisDashboard.tsx matching design specs.
  • Implement conditional check for navigator.share.
  • Implement clipboard fallback mechanism for desktop browsers.
  • Ensure the component imports are clean and run npm run lint and npm run build to verify there are no errors.

Files to Modify

  • src/pages/AnalysisDashboard.tsx

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions