Skip to content

Add share functionality to tip split calculation page#5

Merged
bradydibble merged 1 commit intomainfrom
claude/add-messenger-share-option-qXmv1
Apr 9, 2026
Merged

Add share functionality to tip split calculation page#5
bradydibble merged 1 commit intomainfrom
claude/add-messenger-share-option-qXmv1

Conversation

@bradydibble
Copy link
Copy Markdown
Owner

Summary

Added a share button to the tip split calculation share page that allows users to share the tip distribution details via the native share API or copy to clipboard as a fallback.

Key Changes

  • New buildShareText() function: Formats the tip split data (date, shift, gross tips, fees, pools, and individual distributions) into a readable text format
  • New shareViaMessenger() function: Implements sharing logic that:
    • Uses the native Web Share API when available (for mobile/supported browsers)
    • Falls back to copying formatted text to clipboard on unsupported browsers
    • Shows "Copied!" feedback message for 2 seconds after clipboard copy
  • New share button UI: Added a styled button with share icon below the tip split card
    • Displays dynamic text (either "Share via Messenger" or "Copied!" feedback)
    • Includes hover and active state animations
    • Responsive design with proper spacing and alignment

Implementation Details

  • Uses Svelte's $state for managing the copyFeedback message
  • Share text includes all relevant information: date, shift type, gross tips, fees, pools, individual distributions, and total
  • Gracefully handles cases where the Web Share API is unavailable or user cancels the share action
  • Button styling uses CSS variables for consistency with the existing design system

https://claude.ai/code/session_01SKaGpS6Kr6TTNUrTGmWLrU

Uses the Web Share API on mobile (triggers native share sheet for iMessage,
WhatsApp, Telegram, etc.) with a clipboard fallback on desktop showing
brief 'Copied!' feedback.

https://claude.ai/code/session_01SKaGpS6Kr6TTNUrTGmWLrU
@bradydibble bradydibble merged commit d6b074a into main Apr 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants