Skip to content

Commit 5ccb4fa

Browse files
committed
feat(ui): iOS passcode keypad, device page iOS header + white stat tiles; remove old photo hero (HeroHome, .solhero CSS, house-1..3)
1 parent fe3d579 commit 5ccb4fa

8 files changed

Lines changed: 81 additions & 382 deletions

File tree

‎design/mockup.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async function captureFlow(key) {
118118
await app.setViewport({ width: 393, height: 900, deviceScaleFactor: 2 });
119119
await app.goto(`${BASE}/?sim=${key}`, { waitUntil: "networkidle2" });
120120
try {
121-
await app.waitForFunction(() => !!document.querySelector(".solhero"), { timeout: 14000 });
121+
await app.waitForFunction(() => !!document.querySelector(".hscene"), { timeout: 14000 });
122122
} catch {}
123123
await sleep(1600); // let flow orbs spread along the paths
124124
await app.evaluate((pairs) => {
@@ -128,7 +128,7 @@ async function captureFlow(key) {
128128
}, MASK);
129129
await sleep(150);
130130
const box = await app.evaluate(() => {
131-
const c = document.querySelector(".solhero");
131+
const c = document.querySelector(".hscene");
132132
if (!c) return null;
133133
const r = c.getBoundingClientRect();
134134
return { x: r.left, y: r.top, width: r.width, height: r.height };

‎public/hero/house-1.webp‎

-49.3 KB
Binary file not shown.

‎public/hero/house-2.webp‎

-45.8 KB
Binary file not shown.

‎public/hero/house-3.webp‎

-36.1 KB
Binary file not shown.

‎src/components/DeviceView.tsx‎

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,19 @@ function Section({ title, count, open, onToggle, children }: { title: string; co
8686
);
8787
}
8888

89+
// iOS push-screen header: "‹ หน้าหลัก" back button + large title.
90+
function DeviceHeader({ onBack }: { onBack: () => void }) {
91+
return (
92+
<div className="mb-3.5">
93+
<button onClick={onBack} aria-label="กลับหน้าหลัก" className="flex items-center gap-0.5 -ml-2 h-11 pr-3 text-secondary text-[17px] font-semibold active:opacity-50 transition-opacity">
94+
<IconChevron className="w-6 h-6 rotate-180" />หน้าหลัก
95+
</button>
96+
<h1 className="text-[32px] font-extrabold tracking-tight leading-tight text-title">เครื่องแปลงไฟ</h1>
97+
<div className="text-[13.5px] font-semibold text-muted">อินเวอร์เตอร์ · แบตเตอรี่ · แจ้งเตือน</div>
98+
</div>
99+
);
100+
}
101+
89102
export function DeviceView({ latest, active, stationId, isPrimary = true, onBack }: { latest: Latest | null; active: boolean; stationId?: number | null; isPrimary?: boolean; onBack: () => void }) {
90103
const [dev, setDev] = useState<Device | null>(null);
91104
const [err, setErr] = useState(false);
@@ -114,12 +127,7 @@ export function DeviceView({ latest, active, stationId, isPrimary = true, onBack
114127
const failed = err || !!dev?.error;
115128
return (
116129
<>
117-
<div className="flex items-center gap-1.5 mt-1 mb-3.5">
118-
<button onClick={onBack} aria-label="กลับหน้าหลัก" className="w-10 h-10 -ml-1.5 rounded-full grid place-items-center text-title active:bg-line transition-colors">
119-
<IconBack className="w-6 h-6" />
120-
</button>
121-
<h2 className={h2}>เครื่องแปลงไฟ (Inverter)</h2>
122-
</div>
130+
<DeviceHeader onBack={onBack} />
123131
{failed ? (
124132
<div className={`${cardP} text-center py-8`}>
125133
<div className="text-[16px] font-bold text-title">ดึงข้อมูลเครื่องไม่ได้</div>
@@ -213,12 +221,7 @@ export function DeviceView({ latest, active, stationId, isPrimary = true, onBack
213221

214222
return (
215223
<>
216-
<div className="flex items-center gap-1.5 mt-1 mb-3.5">
217-
<button onClick={onBack} aria-label="กลับหน้าหลัก" className="w-10 h-10 -ml-1.5 rounded-full grid place-items-center text-title active:bg-line transition-colors">
218-
<IconBack className="w-6 h-6" />
219-
</button>
220-
<h2 className={h2}>เครื่องแปลงไฟ (Inverter)</h2>
221-
</div>
224+
<DeviceHeader onBack={onBack} />
222225

223226
<div className={cardP}>
224227
<div className="flex items-center gap-2.5">
@@ -236,9 +239,9 @@ export function DeviceView({ latest, active, stationId, isPrimary = true, onBack
236239
{/* Deye-style summary cards */}
237240
<div className="mt-3.5 grid grid-cols-2 gap-3">
238241
{summary.map((s, i) => (
239-
<div key={i} className="rounded-2xl p-4 text-white shadow-[0_10px_22px_-10px_rgba(17,17,17,0.45)]" style={{ background: `linear-gradient(135deg, ${s.a}, ${s.b})` }}>
240-
<div className="text-[13px] font-semibold text-white/85 leading-snug">{s.label}</div>
241-
<div className="text-[23px] font-extrabold leading-none mt-2 tabnum">{s.v}<span className="text-[13px] font-semibold text-white/80 ml-1">{s.u}</span></div>
242+
<div key={i} className={`${card} p-4`}>
243+
<div className="flex items-center gap-1.5 text-[13.5px] font-semibold text-body leading-snug"><span className="w-2.5 h-2.5 rounded-full shrink-0" style={{ background: s.a }} />{s.label}</div>
244+
<div className="text-[24px] font-extrabold leading-none mt-2 tabnum text-title">{s.v}<span className="text-[13px] font-bold text-muted ml-1">{s.u}</span></div>
242245
</div>
243246
))}
244247
</div>

‎src/components/HeroHome.tsx‎

Lines changed: 0 additions & 230 deletions
This file was deleted.

0 commit comments

Comments
 (0)