Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sheet-wide-viewport.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@app/ratewise': patch
---

桌面與平板開啟計算機、趨勢、選幣 bottom sheet 時,不再從左邊緣拉伸到右邊緣;sheet 限寬置中並帶四邊圓角,關閉退場無殘留邊條,手機維持貼底全寬不變。
8 changes: 5 additions & 3 deletions apps/ratewise/src/components/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* 收斂 E3 兩個 sheet 殼(TrendSheet / CurrencyPickerSheet)與未來 modal 需求:
* 拖曳關閉、backdrop、safe-area、fixed(65vh)/ adaptive(max-h 70vh)兩模式。
* ≥md 寬視口:max-w-screen-sm 水平置中、四邊圓角、離底 24px(#588);手機維持貼底全寬雙上圓角。
* 文案(標題、關閉鈕 aria-label)由消費端傳入,primitive 不綁 i18n。
*/

Expand Down Expand Up @@ -128,10 +129,11 @@ export function BottomSheet({
<motion.div
ref={sheetRef}
tabIndex={-1}
className={`fixed inset-x-0 bottom-0 z-50 bg-surface rounded-t-card shadow-floating flex flex-col pb-[env(safe-area-inset-bottom,0px)] outline-none ${SIZE_CLASS[size]}`}
initial={{ y: '100%' }}
className={`fixed inset-x-0 bottom-0 z-50 bg-surface rounded-t-card shadow-floating flex flex-col pb-[env(safe-area-inset-bottom,0px)] outline-none md:bottom-6 md:mx-auto md:max-w-screen-sm md:rounded-card ${SIZE_CLASS[size]}`}
// 位移 120%:md:bottom-6 使寬視口 sheet 離底 24px,100% 退場會殘留可見條;spring 收斂時間與幅度無關,勿改回 100%。
initial={{ y: '120%' }}
animate={{ y: 0 }}
exit={{ y: '100%' }}
exit={{ y: '120%' }}
transition={transitions.keyboardSheet}
drag="y"
dragConstraints={{ top: 0, bottom: 0 }}
Expand Down
13 changes: 13 additions & 0 deletions apps/ratewise/src/components/__tests__/BottomSheet.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ describe('BottomSheet primitive', () => {
expect(className).toContain('shadow-floating');
expect(className).not.toContain('bg-gradient');
});

it('≥md 寬視口限寬置中+四邊圓角,手機基底維持貼底全寬(#588)', () => {
renderSheet();
const className = screen.getByTestId('test-sheet').className;
// 寬視口:max-width 置中、四邊圓角、離底留距
expect(className).toContain('md:max-w-screen-sm');
expect(className).toContain('md:mx-auto');
expect(className).toContain('md:rounded-card');
expect(className).toContain('md:bottom-6');
// 手機基底不變:貼底全寬、雙上圓角
expect(className).toContain('inset-x-0');
expect(className).toContain('bottom-0');
});
});

describe('BottomSheet modal 鍵盤可及性(#577)', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,11 @@ export function CalculatorKeyboard({

{/* Bottom Sheet 容器 */}
<motion.div
className="fixed inset-x-0 bottom-0 z-50 bg-surface rounded-t-3xl shadow-floating max-h-[80vh] overflow-hidden"
initial={{ y: '100%' }}
className="fixed inset-x-0 bottom-0 z-50 bg-surface rounded-t-3xl shadow-floating max-h-[80vh] overflow-hidden md:bottom-6 md:mx-auto md:max-w-screen-sm md:rounded-card"
// 位移 120%:md:bottom-6 使寬視口 sheet 離底 24px,100% 退場會殘留可見條;spring 收斂時間與幅度無關,勿改回 100%。
initial={{ y: '120%' }}
animate={{ y: 0 }}
exit={{ y: '100%' }}
exit={{ y: '120%' }}
transition={transitions.keyboardSheet}
drag="y"
dragConstraints={{ top: 0, bottom: 0 }}
Expand Down
12 changes: 11 additions & 1 deletion docs/dev/002_development_reward_penalty_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> 版本:outline-v2-ultra
> 原則:每筆只保留日期、ID、原因、解法。
> 本次分數變化:-1(reward 0、penalty 1、neutral 0)|累計總分:+133
> 本次分數變化:0(reward 0、penalty 0、neutral 1)|累計總分:+134

## 新增模板(4 行)

Expand All @@ -13,6 +13,16 @@

## 條目(新→舊)

- 日期:2026-07-06
- ID:neutral-rw-596-review-audit-number-and-comment
- 原因:PR #596 body 將三檔合跑的 43/43 誤標為 `vitest run BottomSheet` 結果(單檔實為 10/10),且 120% 位移缺推導註解易被誤改回 100%
- 解法:PR body 更正為單檔 10/10 並註明 43/43 的確切指令,兩處 `y: '120%'` 補繁中推導註解(md:bottom-6 退場殘留)

- 日期:2026-07-06
- ID:reward-rw-sheet-wide-viewport-588
- 原因:BottomSheet primitive 與 CalculatorKeyboard 沿用手機貼底全寬 pattern,桌面 1440 與 iPad 12.9" 橫向 sheet 拉滿 100vw(#588、#594 第一階段)
- 解法:兩處殼層加 `md:max-w-screen-sm md:mx-auto md:rounded-card md:bottom-6` 寬視口限寬置中(進出場位移 100%→120% 補離底間距),消費端零改動,新增寬視口樣式斷言

- 日期:2026-07-06
- ID:penalty-rw-560-langsync-remount-rollback
- 原因:LanguagePreferenceSync 掛雙佈局且每次 remount 重放 init 前捕捉的 stale 偏好,session 內切語言後跨佈局 SPA 導覽把語言與 localStorage 回滾 zh-TW(#595 審查 PoC 抓出)
Expand Down
Loading