Skip to content

Share previews the workout image, with a transparent background and Copy - #166

Open
daniel-bernardino747 wants to merge 2 commits into
TraceApps:devfrom
daniel-bernardino747:ui/share-preview
Open

daniel-bernardino747 wants to merge 2 commits into
TraceApps:devfrom
daniel-bernardino747:ui/share-preview

Conversation

@daniel-bernardino747

Copy link
Copy Markdown
Contributor

Closes #162

Summary

Share on the Workout Complete sheet now opens a preview of the image before sending it. The preview has a Solid / Transparent background choice and a Copy button. The image itself keeps its 1080 x 1350.

Changes

  • src/components/diary/WorkoutSummary.svelte: Share swaps the sheet's content for a preview (image, Solid / Transparent, Cancel / Copy / Share). The image shown is the one shared or copied.
  • src/lib/workoutCard.js:
    • renderWorkoutCard takes { transparent }: no background, lighter greys, see-through tiles and a soft shadow
    • shareWorkoutCard can take an already rendered image
    • new canCopyImage / copyWorkoutCard
  • src/i18n/en.json: new keys under workout_summary (English only)
  • CHANGELOG.md: entry under Unreleased

No new dependencies, no server changes. Styles reuse the existing buttons and tokens; the only new CSS is the preview box and its checkerboard.

Screenshots

Summary (Share used to go straight out) Preview Transparent

Rendered images (solid and transparent):

How to test

  1. Finish a workout and open its summary, then tap Share: the preview opens and nothing is sent.
  2. Tap Transparent: the preview shows a checkerboard behind the card. Tap Solid to go back.
  3. Tap Copy (HTTPS or localhost only): "Image copied" shows, and the image pastes into another app.
  4. Tap Share: the system share sheet opens with the image shown (or it downloads where sharing files isn't available).
  5. Tap Cancel: back to the summary.

Notes

  • Copy is hidden where the browser can't write an image to the clipboard, which includes plain HTTP on a LAN address.
  • Not tested in the Android app or on iOS.
  • Whether a pasted image keeps its transparency depends on the app it's pasted into.

This is only a suggestion. Feel free to use all of it, part of it or none of it.
I used AI (Claude Code) to help write these changes; I reviewed and tested them myself.

Share on the Workout Complete sheet sent the image straight to the share
sheet (or downloaded it), with no look at it first. It now opens a
preview in the same sheet, with Cancel and Share, and shares the exact
image shown. The image keeps its 1080 x 1350.

The preview adds a Solid / Transparent choice: Transparent renders the
card with no background, with lighter greys, see-through tiles and a soft
shadow, to put it over a photo in a story. Copy puts the image shown on
the clipboard; it is offered only where the browser can write an image
there (HTTPS or localhost).
scripts/exercise-media-urls.test.js reads any src={...previewUrl...} as
exercise media that must go through resolveAssetUrl. The share preview's
image is a blob: URL made in the page, not media from the server, so it
gets a name that says so.
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.

1 participant