@@ -3,6 +3,7 @@ import { memo } from "react";
33import useSWR from "swr" ;
44
55import { api , HttpError , jsonFetcher } from "../api" ;
6+ import { mq } from "../mq" ;
67import { SolisData } from "../types/solis" ;
78import Box , { DrawerRow } from "./Box" ;
89import Icon from "./Icon" ;
@@ -99,53 +100,90 @@ const SolisBox: React.FC<SolisBoxProps> = ({ className }) => {
99100 >
100101 < div
101102 css = { {
103+ position : "relative" ,
102104 display : "flex" ,
103105 flexDirection : "column" ,
104106 alignItems : "center" ,
105107 justifyContent : "space-between" ,
106108 flex : 1 ,
109+ [ mq [ 0 ] ] : {
110+ flexDirection : "row" ,
111+ alignItems : "flex-start" ,
112+ justifyContent : "space-between" ,
113+ gap : 16 ,
114+ } ,
107115 } }
108116 >
109117 < div
110118 css = { {
111119 display : "flex" ,
120+ flexDirection : "column" ,
112121 alignItems : "center" ,
113- gap : "0.3em" ,
114- ...theme . typography . label ,
115- color : theme . colors . text . muted ,
116- letterSpacing : "0.04em" ,
122+ [ mq [ 0 ] ] : { alignItems : "flex-start" , gap : 4 } ,
117123 } }
118124 >
119- < Icon
120- size = { 18 }
125+ < div
121126 css = { {
122- color : isAlarm ? theme . colors . error : "inherit" ,
123- opacity : 0.7 ,
127+ display : "flex" ,
128+ alignItems : "center" ,
129+ gap : "0.3em" ,
130+ ...theme . typography . label ,
131+ color : theme . colors . text . muted ,
132+ letterSpacing : "0.04em" ,
124133 } }
125134 >
126- { isAlarm ? "warning" : "solar_power" }
127- </ Icon >
128- { data . power_unit }
129- </ div >
130- < div
131- css = { {
132- marginTop : "5px" ,
133- display : "flex" ,
134- flexDirection : "column" ,
135- alignItems : "center" ,
136- } }
137- >
135+ < Icon
136+ size = { 18 }
137+ css = { {
138+ color : isAlarm ? theme . colors . error : "inherit" ,
139+ opacity : 0.7 ,
140+ } }
141+ >
142+ { isAlarm ? "warning" : "solar_power" }
143+ </ Icon >
144+ { data . power_unit }
145+ </ div >
138146 < div
139147 css = { {
148+ marginTop : "5px" ,
149+ display : "flex" ,
140150 fontWeight : 400 ,
141151 fontSize : 50 ,
142152 lineHeight : 1 ,
143153 fontVariantNumeric : "tabular-nums" ,
154+ [ mq [ 0 ] ] : { marginTop : 0 , fontSize : 64 } ,
144155 } }
145156 >
146157 { displayPower }
147158 </ div >
148159 </ div >
160+
161+ < div
162+ css = { {
163+ display : "none" ,
164+ [ mq [ 0 ] ] : {
165+ display : "flex" ,
166+ flexDirection : "column" ,
167+ alignItems : "flex-end" ,
168+ justifyContent : "center" ,
169+ gap : 6 ,
170+ ...theme . typography . caption ,
171+ color : theme . colors . text . muted ,
172+ } ,
173+ } }
174+ >
175+ < span css = { { fontVariantNumeric : "tabular-nums" } } >
176+ { `${ data . today_energy } ${ data . today_energy_unit } tänään` }
177+ </ span >
178+ { data . battery_soc !== null && (
179+ < span css = { { fontVariantNumeric : "tabular-nums" } } >
180+ { `akku ${ Math . round ( data . battery_soc ) } %` }
181+ </ span >
182+ ) }
183+ { batteryLabel && batteryLabel !== "lepotila" && (
184+ < span > { batteryLabel } </ span >
185+ ) }
186+ </ div >
149187 </ div >
150188 </ Box >
151189 ) ;
0 commit comments