Plan sharing: export/import a plan file + printable PDF
New "Share your plan" action in the Plan header (lib/plan-share.js): - Export plan file: a small JSON with just your routines, the week schedule and any custom exercises they use — a friend imports it into their own openGym. Import merges (adds routines with fresh ids, dedupes customs by name+body part, optional "use this schedule"), so nothing they already have is overwritten. - Print / Save as PDF: a clean, one-page-per-plan printout rendered in a hidden iframe; break-inside:avoid keeps every exercise (and each routine that fits) whole, so an exercise never splits across a page.
This commit is contained in:
1 parent
211fb86480
commit
af9289dcd9
3 files changed
+326
-4
No files matched your search
@@ -2,7 +2,7 @@ import { useNavigate } from 'react-router-dom'
|
||||
import { useStore } from '../store/useStore.js'
|
||||
import { DAYN, uid } from '../lib/format.js'
|
||||
import { t } from '../lib/i18n.js'
|
||||
import { dayAssignSheet, loadStarterPlan } from '../sheets.jsx'
|
||||
import { dayAssignSheet, loadStarterPlan, planToolsSheet } from '../sheets.jsx'
|
||||
import Icon from '../components/Icon.jsx'
|
||||
import { Button } from '../components/ui.jsx'
|
||||
import { glyphOf, DEFAULT_GLYPH } from '../lib/glyphs.js'
|
||||
@@ -19,7 +19,10 @@ export default function Plan() {
|
||||
}
|
||||
|
||||
return <>
|
||||
<div className="hdr"><div><h1>{t('Plan')}</h1><div className="sub">{t('Your weekly routine')}</div></div></div>
|
||||
<div className="hdr">
|
||||
<div><h1>{t('Plan')}</h1><div className="sub">{t('Your weekly routine')}</div></div>
|
||||
<button className="iconbtn" onClick={planToolsSheet} aria-label={t('Share your plan')} title={t('Share your plan')}><Icon name="upload" /></button>
|
||||
</div>
|
||||
<div className="cols"><div>
|
||||
<h4 className="sec">{t('Week schedule')}</h4>
|
||||
<div className="list" style={{ display: 'flex', flexDirection: 'column' }}>
|
||||
|
||||
Reference in new issue
Block a user