Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit de1be7a

Browse files
author
Dan Greco
committed
Fix time
1 parent 59761e5 commit de1be7a

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

dist/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
temperature_unit: 'C',
6969
printer_type: 'I3',
7070
round_temperature: false,
71-
vertical: true,
7271
use_24hr: true,
7372
light_entity: 'switch.light',
7473
camera_entity: "camera.test",

src/Components/Card/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,22 +139,23 @@ const Card = ({ }) => {
139139
animate={{ height: hidden ? 0.0 : 'auto', opacity: hidden ? 0.0 : 1.0, scale: hidden ? 0.0 : 1.0 }}
140140
transition={{ ease: "easeInOut", duration: 0.25 }}
141141
>
142-
<div style={{ ...styles.Section, width: vertical ? '100%' : '50%', height: vertical ? 'auto' : '100%', display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingLeft: vertical ? 80 : 16, paddingRight: vertical ? 80 : 16 }}>
142+
<div style={{ ...styles.Section, width: vertical ? '100%' : '50%', height: vertical ? 'auto' : '100%', display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingLeft: vertical ? 64 : 16, paddingRight: vertical ? 64 : 16 }}>
143143
<PrinterView
144144
toggleVideo={toggleVideo}
145145
hasCamera={config.camera_entity !== undefined}
146+
style={{width: vertical ? 'auto' : '100%', flexGrow: 1}}
146147
/>
147148
{
148149
vertical ? (
149-
<p style={{ width: '50%', fontSize: 36 }}>{round ? Math.round(percent) : percent}%</p>
150+
<p style={{ width: '50%', fontSize: 36, textAlign: 'center', fontWeight: 'bold' }}>{round ? Math.round(percent) : percent}%</p>
150151
) : null
151152
}
152153
</div>
153154
<div
154155
style={{
155156
...styles.Section,
156-
paddingLeft: vertical ? 64 : 16,
157-
paddingRight: vertical ? 64 : 32,
157+
paddingLeft: vertical ? 32 : 16,
158+
paddingRight: vertical ? 32 : 32,
158159
width: vertical ? '100%' : '50%',
159160
height: vertical ? 'auto' : '100%'
160161
}}

src/Components/PrinterView/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import I3 from '../../Printers/I3';
66

77
import styles from './styles';
88

9-
const PrinterView = ({ toggleVideo, hasCamera }) => {
9+
const PrinterView = ({ toggleVideo, hasCamera, style }) => {
1010

1111
const {
1212
hass,
@@ -45,6 +45,7 @@ const PrinterView = ({ toggleVideo, hasCamera }) => {
4545
ref={ref}
4646
style={{
4747
...styles.PrinterView,
48+
...style,
4849
cursor: hasCamera ? 'pointer' : 'default'
4950
}}
5051
>

src/Components/PrinterView/styles.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const styles = {
22
PrinterView: {
3-
width: '100%',
43
height: '100%',
54
boxSizing: 'border-box'
65
}

src/Components/Stats/TimeStat.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ type TimeStatProps = {
5555

5656
const TimeStat: React.FC<TimeStatProps> = ({timeEntity, condition, config, direction}) => {
5757

58-
const [ time, setTime ] = useState<number>( timeEntity.state || 0);
58+
const [ time, setTime ] = useState<number>( parseInt(timeEntity.state) || 0);
5959
const [ lastIntervalId, setLastIntervalId ] = useState<number>(-1);
6060

61-
const incTime = () => setTime( time => time + direction );
61+
const incTime = () => setTime( time => (parseInt(time) + parseInt(direction)) );
6262

6363
useEffect(() => {
6464

0 commit comments

Comments
 (0)