@@ -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+
89102export 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 >
0 commit comments