Repository navigation
feat(workout-session): add "Share your success" workout image - #250
Open
pruthvi-builds wants to merge 1 commit into
Open
pruthvi-builds wants to merge 1 commit into
pruthvi-builds wants to merge 1 commit into
Conversation
At the end of a workout, users can now generate and share a social- friendly summary image (date, muscles worked, exercises completed, workout.cool branding) from the session-complete screen. The image is rendered off-screen and captured client-side with html-to-image, then shared via the native Web Share API on supported devices, falling back to a direct download otherwise. English copy only for now — other locales fall back to English until translated by a native speaker. Closes Snouzy#54
|
@pruthvi-builds is attempting to deploy a commit to the Workoutcool Team Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
At the end of a workout, users can now generate and share a social-friendly summary image straight from the session-complete screen, next to the existing "Go to my profile" button.
Why
Closes #54. Boosts motivation and gives users something worth posting after a workout, per the issue.
How
ShareWorkoutCard: the visual card — date, muscle groups worked (reusing the existinggetAttributeValueLabeltranslation helper), number of exercises completed, and workout.cool branding (the same logo used in the header). Rendered at a fixed 600×750 size for a clean social-ratio export.ShareWorkoutButton: renders the card off-screen (position: fixed; left: -9999px, notdisplay: none, so it stays measurable/paintable), captures it as a PNG viahtml-to-image'stoBlob(2x pixel ratio for crisp output), then:navigator.sharewith aFile) when supported — this is the primary path on mobile, per the issue's "mobile focus."WorkoutSessionSets' congrats screen, reusing data already present in the session store (session.muscles,session.exercises,session.startedAt) — no backend or schema changes needed.html-to-imageas a new dependency (as suggested in the issue itself). Nothing else added.Card design: a blue-to-emerald gradient, the workout.cool logo + wordmark top-left, a trophy emoji, "Workout Complete!" heading, the formatted date, muscle-group pill badges (consistent semi-transparent white, chosen after an earlier per-muscle-tinted version had contrast issues against parts of the gradient), an exercises-completed stat pill with a dumbbell icon, and a "workout.cool — Free & Open Source" footer.
On translations: I added the new UI strings to
locales/en.tsonly. I'm not confident enough in Spanish/French/Portuguese/Russian/Chinese to add accurate translations myself, and didn't want to introduce low-quality machine-translated copy — the app falls back to English for missing keys (verified this is already the case elsewhere in the codebase, e.g.en.tsandfr.tsdon't have identical key sets today). Happy to add translations if you'd rather have them from day one, or leave it for a translation-focused follow-up.Testing
pnpm exec tsc --noEmit— clean.pnpm exec eslinton the changed files — clean.pnpm exec vitest run— all 28 existing tests still pass (no relevant unit-testable pure logic was introduced here — the existing test suite is small and focused on pure calculation/formatting functions elsewhere in the app, which this feature doesn't have; happy to add tests if you'd like a specific approach).pnpm run build— full production build succeeds.pnpm test:e2eto click through the actual share/download flow. I visually verified the card's design (colors, contrast, layout at the target 600×750 size) by rendering the exact markup standalone before wiring it in, but I can't attach that image here from my current setup. Would appreciate a maintainer double-checking the live share/download behavior, especially thenavigator.sharepath on an actual mobile device — happy to iterate on the design based on what it actually looks like running.Related Issue
Closes #54