Refine check-in layout and move calendar sidebar
This commit is contained in:
1 parent
7e9f12423c
commit
8c0a4afe11
2 files changed
+31
-2
No files matched your search
@@ -42,8 +42,7 @@ export default function CheckinClient() {
|
|||||||
return <main><Dialog open={showCountdown} onOpenChange={open => { if (!open) closeCountdown(); }}><DialogContent className="countdown-dialog" showCloseButton={false}><DialogHeader><p className="dialog-kicker">CET-6 · 考试倒计时</p><DialogTitle>今天也离目标更近一步</DialogTitle><DialogDescription>2026 年 12 月 12 日 15:00 笔试</DialogDescription></DialogHeader><div className="dialog-time"><b>{remaining.days}</b><span>天</span><b>{String(remaining.hours).padStart(2, "0")}</b><span>时</span><b>{String(remaining.minutes).padStart(2, "0")}</b><span>分</span></div><p className="dialog-note">今天的任务,完成一项就是一次推进。</p><button className="dialog-button" onClick={closeCountdown}>开始今天的打卡</button></DialogContent></Dialog><div className="shell">
|
return <main><Dialog open={showCountdown} onOpenChange={open => { if (!open) closeCountdown(); }}><DialogContent className="countdown-dialog" showCloseButton={false}><DialogHeader><p className="dialog-kicker">CET-6 · 考试倒计时</p><DialogTitle>今天也离目标更近一步</DialogTitle><DialogDescription>2026 年 12 月 12 日 15:00 笔试</DialogDescription></DialogHeader><div className="dialog-time"><b>{remaining.days}</b><span>天</span><b>{String(remaining.hours).padStart(2, "0")}</b><span>时</span><b>{String(remaining.minutes).padStart(2, "0")}</b><span>分</span></div><p className="dialog-note">今天的任务,完成一项就是一次推进。</p><button className="dialog-button" onClick={closeCountdown}>开始今天的打卡</button></DialogContent></Dialog><div className="shell">
|
||||||
<header><div><p className="eyebrow">CET-6 · 2026</p><h1>大学英语六级 · 90天打卡</h1><p className="sub">从今天的一件事开始,完成比完美重要。</p></div><div className="header-actions"><a className="overview-link" href="/tasks"><LayoutList size={17} />任务总览</a><a className="overview-link" href="/stats"><BarChart3 size={17} />数据统计</a><p className="sync"><Cloud size={16} />{saving ? "正在云端保存…" : status}</p></div></header>
|
<header><div><p className="eyebrow">CET-6 · 2026</p><h1>大学英语六级 · 90天打卡</h1><p className="sub">从今天的一件事开始,完成比完美重要。</p></div><div className="header-actions"><a className="overview-link" href="/tasks"><LayoutList size={17} />任务总览</a><a className="overview-link" href="/stats"><BarChart3 size={17} />数据统计</a><p className="sync"><Cloud size={16} />{saving ? "正在云端保存…" : status}</p></div></header>
|
||||||
<section className="stats"><Stat icon={<CheckCircle2 />} value={Math.round(finished / total * 100) + "%"} label="总体完成度" detail={finished + " / " + total + " 项任务"} /><Stat icon={<CalendarDays />} value={complete + " 天"} label="完整完成" detail="目标共 90 天" /><Stat icon={<CheckCircle2 />} value={day.phase} label="当前阶段" detail="12 月 12 日笔试" /><div className="countdown"><span><Timer size={19} /></span><p>距离六级笔试</p><strong>{remaining.days}<em>天</em> {remaining.hours}<em>时</em> {remaining.minutes}<em>分</em></strong><small>2026 年 12 月 12 日 15:00</small></div></section>
|
<section className="stats"><Stat icon={<CheckCircle2 />} value={Math.round(finished / total * 100) + "%"} label="总体完成度" detail={finished + " / " + total + " 项任务"} /><Stat icon={<CalendarDays />} value={complete + " 天"} label="完整完成" detail="目标共 90 天" /><Stat icon={<CheckCircle2 />} value={day.phase} label="当前阶段" detail="12 月 12 日笔试" /><div className="countdown"><span><Timer size={19} /></span><p>距离六级笔试</p><strong>{remaining.days}<em>天</em> {remaining.hours}<em>时</em> {remaining.minutes}<em>分</em></strong><small>2026 年 12 月 12 日 15:00</small></div></section>
|
||||||
<section className="calendar"><div className="calendar-head"><div><p className="eyebrow">CHECK-IN CALENDAR</p><h2>打卡日历</h2></div><div className="month-tabs">{[8, 9, 10, 11].map(m => <button className={month === m ? "active" : ""} onClick={() => setMonth(m)} key={m}>{m + 1}月</button>)}</div></div><div className="weekdays">{["日", "一", "二", "三", "四", "五", "六"].map(x => <span key={x}>{x}</span>)}</div><div className="calendar-grid">{blanks.map((_, i) => <span key={"e" + i} />)}{dates.map(date => { const idx = plan.findIndex(p => p.date === date), p = plan[idx], n = parseTasks(records[date]?.doneTasks).length, full = !!p && n === p.tasks.length, partial = !!p && n > 0 && !full, makeup = records[date]?.checkinType === "makeup"; return <button disabled={!p} key={date} onClick={() => { if (p) { setSelected(idx); setMonth(new Date(date + "T00:00:00Z").getUTCMonth()); } }} className={"calendar-day " + (idx === selected ? "chosen " : "") + (full ? "full " : partial ? "partial " : "") + (makeup ? "makeup " : "") + (p ? "" : "outside")}><b>{Number(date.slice(-2))}</b>{p && <small>{full ? makeup ? "补打卡" : "完成" : partial ? n + "/" + p.tasks.length : date > today ? "未到日期" : "待打卡"}</small>}</button>; })}</div><p className="calendar-note"><i className="full-dot" />全部完成 <i className="partial-dot" />进行中 <i className="makeup-dot" />补打卡 <span>未来日期不可修改</span></p></section>
|
<section className="layout"><article className="card"><div className="hero"><button className="round" onClick={() => setSelected(n => Math.max(0, n - 1))} disabled={!selected}><ChevronLeft /></button><div><p>{day.phase} · {day.week}</p><h2>{fmt(day.date)}</h2><small>{isFuture ? "未来日期,暂不可打卡" : isMakeup ? "补打卡 · 已完成项目不可取消" : "今日打卡"} · 已完成 {done.length} / {day.tasks.length} 项</small></div><button className="round" onClick={() => setSelected(n => Math.min(89, n + 1))} disabled={selected === 89}><ChevronRight /></button><Progress value={done.length / day.tasks.length * 100} /></div><div className="body"><div className="tasks">{day.tasks.map(t => { const locked = isFuture || (isMakeup && done.includes(t.key)); return <label className={(done.includes(t.key) ? "task done " : "task ") + (locked ? "locked" : "")} key={t.key}><Checkbox disabled={locked} checked={done.includes(t.key)} onCheckedChange={v => toggle(t.key, v === true)} /><b>{t.label}</b><span>{t.text}</span>{isMakeup && done.includes(t.key) && <small className="locked-note">已完成,已锁定</small>}</label>; })}</div><div className="review"><p>今日状态</p><div>{["专注", "平稳", "有点累", "需要调整"].map(m => <button disabled={isFuture} className={record.mood === m ? "pill active" : "pill"} key={m} onClick={() => void save({ ...record, mood: record.mood === m ? "" : m })}>{m}</button>)}</div><label>一句复盘(可选)<textarea disabled={isFuture} value={record.note} onChange={e => setRecords(x => ({ ...x, [day.date]: { ...record, note: e.target.value } }))} onBlur={() => void save(record)} placeholder={isFuture ? "未到此日期,暂不能修改。" : "今天的收获、卡住的地方,或明天要调整的一点。"} /></label></div></div></article><aside><section className="calendar side-calendar"><div className="calendar-head"><div><p className="eyebrow">CHECK-IN</p><h2>打卡日历</h2></div><div className="month-tabs">{[8, 9, 10, 11].map(m => <button aria-label={`查看${m + 1}月`} className={month === m ? "active" : ""} onClick={() => setMonth(m)} key={m}>{m + 1}月</button>)}</div></div><div className="weekdays">{["日", "一", "二", "三", "四", "五", "六"].map(x => <span key={x}>{x}</span>)}</div><div className="calendar-grid">{blanks.map((_, i) => <span key={"e" + i} />)}{dates.map(date => { const idx = plan.findIndex(p => p.date === date), p = plan[idx], n = parseTasks(records[date]?.doneTasks).length, full = !!p && n === p.tasks.length, partial = !!p && n > 0 && !full, makeup = records[date]?.checkinType === "makeup"; return <button disabled={!p} key={date} onClick={() => { if (p) { setSelected(idx); setMonth(new Date(date + "T00:00:00Z").getUTCMonth()); } }} className={"calendar-day " + (idx === selected ? "chosen " : "") + (full ? "full " : partial ? "partial " : "") + (makeup ? "makeup " : "") + (p ? "" : "outside")}><b>{Number(date.slice(-2))}</b>{p && <small>{full ? makeup ? "补打卡" : "完成" : partial ? n + "/" + p.tasks.length : date > today ? "未到" : "待打卡"}</small>}</button>; })}</div><p className="calendar-note"><i className="full-dot" />完成 <i className="partial-dot" />进行中 <i className="makeup-dot" />补打卡</p></section><div className="dark"><p>{isFuture ? "日期限制" : isMakeup ? "补打卡" : "当前阶段"}</p><h2>{isFuture ? "暂未开放" : isMakeup ? "补做未完成项目" : day.phase}</h2><p>{isFuture ? "当天到来后即可正常打卡。" : isMakeup ? "已有完成项已锁定,只能勾选此前未完成的项目。" : "每天稳步推进,答案会慢慢变得清楚。"}</p></div><div className="side"><b>90 天阶段</b>{["Ⅰ 恢复期 · 9/13–10/5", "Ⅱ 专项期 · 10/6–11/2", "Ⅲ 真题期 · 11/3–11/29", "Ⅳ 冲刺期 · 11/30–12/11"].map(x => <p key={x}>{x}</p>)}</div></aside></section>
|
||||||
<section className="layout"><article className="card"><div className="hero"><button className="round" onClick={() => setSelected(n => Math.max(0, n - 1))} disabled={!selected}><ChevronLeft /></button><div><p>{day.phase} · {day.week}</p><h2>{fmt(day.date)}</h2><small>{isFuture ? "未来日期,暂不可打卡" : isMakeup ? "补打卡 · 已完成项目不可取消" : "今日打卡"} · 已完成 {done.length} / {day.tasks.length} 项</small></div><button className="round" onClick={() => setSelected(n => Math.min(89, n + 1))} disabled={selected === 89}><ChevronRight /></button><Progress value={done.length / day.tasks.length * 100} /></div><div className="body"><div className="tasks">{day.tasks.map(t => { const locked = isFuture || (isMakeup && done.includes(t.key)); return <label className={(done.includes(t.key) ? "task done " : "task ") + (locked ? "locked" : "")} key={t.key}><Checkbox disabled={locked} checked={done.includes(t.key)} onCheckedChange={v => toggle(t.key, v === true)} /><b>{t.label}</b><span>{t.text}</span>{isMakeup && done.includes(t.key) && <small className="locked-note">已完成,已锁定</small>}</label>; })}</div><div className="review"><p>今日状态</p><div>{["专注", "平稳", "有点累", "需要调整"].map(m => <button disabled={isFuture} className={record.mood === m ? "pill active" : "pill"} key={m} onClick={() => void save({ ...record, mood: record.mood === m ? "" : m })}>{m}</button>)}</div><label>一句复盘(可选)<textarea disabled={isFuture} value={record.note} onChange={e => setRecords(x => ({ ...x, [day.date]: { ...record, note: e.target.value } }))} onBlur={() => void save(record)} placeholder={isFuture ? "未到此日期,暂不能修改。" : "今天的收获、卡住的地方,或明天要调整的一点。"} /></label></div></div></article><aside><div className="dark"><p>{isFuture ? "日期限制" : isMakeup ? "补打卡" : "当前阶段"}</p><h2>{isFuture ? "暂未开放" : isMakeup ? "补做未完成项目" : day.phase}</h2><p>{isFuture ? "当天到来后即可正常打卡。" : isMakeup ? "已有完成项已锁定,只能勾选此前未完成的项目。" : "每天稳步推进,答案会慢慢变得清楚。"}</p></div><div className="side"><b>90 天阶段</b>{["Ⅰ 恢复期 · 9/13–10/5", "Ⅱ 专项期 · 10/6–11/2", "Ⅲ 真题期 · 11/3–11/29", "Ⅳ 冲刺期 · 11/30–12/11"].map(x => <p key={x}>{x}</p>)}</div></aside></section>
|
|
||||||
</div></main>;
|
</div></main>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,3 +146,33 @@ body {
|
|||||||
.countdown-dialog{max-width:420px!important;border:0!important;padding:30px!important;text-align:center!important;background:linear-gradient(145deg,#172554,#2563eb)!important;color:#fff!important;box-shadow:0 28px 70px #17255488!important}.dialog-kicker{margin:0;color:#bfdbfe;font-size:.78rem;font-weight:700;letter-spacing:.13em}.countdown-dialog [data-slot=dialog-title]{color:#fff;font-size:1.55rem}.countdown-dialog [data-slot=dialog-description]{color:#dbeafe;font-size:.9rem}.dialog-time{display:flex;justify-content:center;align-items:baseline;gap:7px;margin:12px 0 4px}.dialog-time b{font-size:2.7rem;line-height:1;color:#fff}.dialog-time span{font-size:.86rem;color:#bfdbfe;margin-right:3px}.dialog-note{margin:12px 0 20px;color:#dbeafe;font-size:.9rem}.dialog-button{width:100%;border:0;border-radius:12px;background:#fff;color:#1d4ed8;padding:12px;font:inherit;font-weight:700;cursor:pointer}.dialog-button:hover{background:#eff6ff}
|
.countdown-dialog{max-width:420px!important;border:0!important;padding:30px!important;text-align:center!important;background:linear-gradient(145deg,#172554,#2563eb)!important;color:#fff!important;box-shadow:0 28px 70px #17255488!important}.dialog-kicker{margin:0;color:#bfdbfe;font-size:.78rem;font-weight:700;letter-spacing:.13em}.countdown-dialog [data-slot=dialog-title]{color:#fff;font-size:1.55rem}.countdown-dialog [data-slot=dialog-description]{color:#dbeafe;font-size:.9rem}.dialog-time{display:flex;justify-content:center;align-items:baseline;gap:7px;margin:12px 0 4px}.dialog-time b{font-size:2.7rem;line-height:1;color:#fff}.dialog-time span{font-size:.86rem;color:#bfdbfe;margin-right:3px}.dialog-note{margin:12px 0 20px;color:#dbeafe;font-size:.9rem}.dialog-button{width:100%;border:0;border-radius:12px;background:#fff;color:#1d4ed8;padding:12px;font:inherit;font-weight:700;cursor:pointer}.dialog-button:hover{background:#eff6ff}
|
||||||
.calendar-day.makeup{background:#fff7ed;border-color:#fdba74}.calendar-day.makeup small{color:#c2410c}.makeup-dot{background:#f97316}.task.locked{cursor:not-allowed;opacity:.52;background:#f8fafc}.task.locked:hover{border-color:#e2e8f0;background:#f8fafc}.pill:disabled,.review textarea:disabled{cursor:not-allowed;opacity:.55}.stats-page{max-width:1100px}.insight-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.insight{background:#fff;border:1px solid #dbeafe;border-radius:18px;padding:18px;box-shadow:0 7px 22px #dbeafe66}.insight span{float:right;color:#2563eb}.insight p,.insight small{display:block;margin:0;color:#64748b;font-size:.82rem}.insight strong{display:block;margin:12px 0 4px;font-size:1.7rem}.charts{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:24px}.chart-card,.stat-detail{background:#fff;border:1px solid #dbeafe;border-radius:18px;padding:22px;box-shadow:0 10px 26px #dbeafe66}.chart-card h2,.stat-detail h2{margin:5px 0;font-size:1.3rem}.stat-detail{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:20px}.stat-detail>div:first-child{max-width:400px}.stat-detail p:not(.eyebrow){color:#64748b;line-height:1.6;margin:8px 0 0}.legend{display:grid;gap:8px;min-width:115px;color:#475569;font-size:.85rem}.legend i{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:5px}.legend .normal-dot{background:#2563eb}@media(max-width:820px){.insight-cards{grid-template-columns:repeat(2,1fr)}.charts{grid-template-columns:1fr}.stat-detail{align-items:flex-start;flex-wrap:wrap}}@media(max-width:480px){.insight-cards{grid-template-columns:1fr}.chart-card{padding:16px}.stat-detail{padding:16px}}
|
.calendar-day.makeup{background:#fff7ed;border-color:#fdba74}.calendar-day.makeup small{color:#c2410c}.makeup-dot{background:#f97316}.task.locked{cursor:not-allowed;opacity:.52;background:#f8fafc}.task.locked:hover{border-color:#e2e8f0;background:#f8fafc}.pill:disabled,.review textarea:disabled{cursor:not-allowed;opacity:.55}.stats-page{max-width:1100px}.insight-cards{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.insight{background:#fff;border:1px solid #dbeafe;border-radius:18px;padding:18px;box-shadow:0 7px 22px #dbeafe66}.insight span{float:right;color:#2563eb}.insight p,.insight small{display:block;margin:0;color:#64748b;font-size:.82rem}.insight strong{display:block;margin:12px 0 4px;font-size:1.7rem}.charts{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:24px}.chart-card,.stat-detail{background:#fff;border:1px solid #dbeafe;border-radius:18px;padding:22px;box-shadow:0 10px 26px #dbeafe66}.chart-card h2,.stat-detail h2{margin:5px 0;font-size:1.3rem}.stat-detail{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:20px}.stat-detail>div:first-child{max-width:400px}.stat-detail p:not(.eyebrow){color:#64748b;line-height:1.6;margin:8px 0 0}.legend{display:grid;gap:8px;min-width:115px;color:#475569;font-size:.85rem}.legend i{display:inline-block;width:9px;height:9px;border-radius:50%;margin-right:5px}.legend .normal-dot{background:#2563eb}@media(max-width:820px){.insight-cards{grid-template-columns:repeat(2,1fr)}.charts{grid-template-columns:1fr}.stat-detail{align-items:flex-start;flex-wrap:wrap}}@media(max-width:480px){.insight-cards{grid-template-columns:1fr}.chart-card{padding:16px}.stat-detail{padding:16px}}
|
||||||
.locked-note{margin-left:auto;color:#64748b;font-size:.75rem;white-space:nowrap}
|
.locked-note{margin-left:auto;color:#64748b;font-size:.75rem;white-space:nowrap}
|
||||||
|
|
||||||
|
/* Focused study-desk layout */
|
||||||
|
body{background:linear-gradient(140deg,#f7faff 0%,#eef4ff 48%,#f8fbff 100%);color:#172554}
|
||||||
|
.shell{max-width:1240px;padding:42px 26px 56px}
|
||||||
|
header{margin-bottom:30px}
|
||||||
|
.eyebrow{color:#315fd5;letter-spacing:.16em;font-size:.72rem}
|
||||||
|
h1{letter-spacing:-.04em;font-size:clamp(2rem,4vw,2.85rem)}
|
||||||
|
.sub{font-size:1rem}
|
||||||
|
.sync{border:1px solid #d8e5ff;box-shadow:0 8px 22px #bfdbfe88}
|
||||||
|
.overview-link{box-shadow:0 6px 16px #dbeafe99;transition:.18s transform,.18s box-shadow}
|
||||||
|
.overview-link:hover{transform:translateY(-1px);box-shadow:0 10px 22px #bfdbfe}
|
||||||
|
.stats{gap:16px}
|
||||||
|
.stat,.countdown{border-radius:20px;box-shadow:0 12px 28px #dbeafe80}
|
||||||
|
.stat{border-color:#e0eaff;background:linear-gradient(145deg,#fff,#f9fbff)}
|
||||||
|
.stat strong{font-size:1.85rem;letter-spacing:-.04em}
|
||||||
|
.countdown{background:linear-gradient(135deg,#132b66,#2463d8 68%,#4384ef);box-shadow:0 16px 32px #93c5fd99}
|
||||||
|
.layout{grid-template-columns:minmax(0,1fr) 350px;align-items:start;gap:26px;margin-top:26px}
|
||||||
|
.card{border-color:#d9e6ff;border-radius:22px;box-shadow:0 20px 48px #bfd5fb88}
|
||||||
|
.hero{padding:29px 30px 25px;background:radial-gradient(circle at 82% 0,#d9e9ff 0,transparent 36%),linear-gradient(130deg,#eef5ff,#fff 72%)}
|
||||||
|
.hero h2{font-size:1.75rem;letter-spacing:-.035em}
|
||||||
|
.hero [role=progressbar]{height:8px;border-radius:999px;overflow:hidden}
|
||||||
|
.round{transition:.16s transform,.16s background}.round:hover:not(:disabled){transform:scale(1.06);background:#eaf2ff}
|
||||||
|
.body{padding:28px}
|
||||||
|
.task{border-color:#e0e8f5;border-radius:16px;padding:16px;transition:.16s transform,.16s border-color,.16s background}
|
||||||
|
.task:hover{transform:translateX(2px);border-color:#94bafc}.task.done{background:#f2f7ff}
|
||||||
|
.task b{background:#e7efff;color:#315fd5}.task.done b{background:#cfe0ff}
|
||||||
|
.review{margin-top:26px}.review textarea{background:#fbfdff;border-color:#d5e0f0}.pill{transition:.15s transform}.pill:hover:not(:disabled){transform:translateY(-1px)}
|
||||||
|
aside{display:grid;gap:14px}.side-calendar{margin:0;padding:18px;border-radius:22px;border-color:#d9e6ff;box-shadow:0 16px 36px #bfd5fb77}.calendar-head{gap:10px}.calendar-head h2{font-size:1.22rem;letter-spacing:-.02em}.month-tabs{gap:3px}.month-tabs button{padding:6px 8px;font-size:.76rem;min-width:36px}.weekdays{margin:16px 0 7px;font-size:.7rem;gap:4px}.calendar-grid{gap:4px}.calendar-day{min-height:47px;padding:5px 4px;border-radius:10px;font-size:.8rem}.calendar-day small{font-size:.56rem;line-height:1.1}.calendar-day.chosen{outline-width:2px}.calendar-note{font-size:.7rem;line-height:1.9}.calendar-note i{width:7px;height:7px;margin:0 3px 0 8px}.dark,.side{margin:0;border-radius:20px}.dark{padding:22px;background:linear-gradient(145deg,#102555,#1d4ed8)}.dark h2{font-size:1.45rem;letter-spacing:-.025em}.side{padding:18px;border-color:#d9e6ff;box-shadow:0 10px 25px #dbeafe66}.side p{margin:12px 0;font-size:.8rem}
|
||||||
|
@media(max-width:980px){.layout{grid-template-columns:minmax(0,1fr) 300px}.calendar-day{min-height:43px}.calendar-day small{font-size:.51rem}.month-tabs button{padding:5px 6px;min-width:31px}}
|
||||||
|
@media(max-width:760px){.shell{padding:26px 15px 42px}.layout{grid-template-columns:1fr}.side-calendar{order:-1}.calendar-day{min-height:55px;padding:6px}.calendar-day small{font-size:.6rem}.month-tabs button{padding:6px 10px;min-width:38px}}
|
||||||
Reference in new issue
Block a user