Skip to content

Commit ee1e630

Browse files
committed
plate locator button size and live video modal font size update
1 parent a4d3572 commit ee1e630

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

feedingwebapp/src/Pages/Header/LiveVideoModal.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// React imports
22
import React, { useRef } from 'react'
3+
import { useMediaQuery } from 'react-responsive'
34
// The Modal is a screen that appears on top of the main app, and can be toggled
45
// on and off.
56
import Modal from 'react-bootstrap/Modal'
@@ -21,6 +22,9 @@ function LiveVideoModal(props) {
2122
const modalBodyRef = useRef(null)
2223
const margin = convertRemToPixels(1)
2324

25+
// Flag to check if the current orientation is portrait
26+
const isPortrait = useMediaQuery({ query: '(orientation: portrait)' })
27+
2428
return (
2529
<Modal
2630
show={props.show}
@@ -34,7 +38,7 @@ function LiveVideoModal(props) {
3438
fullscreen={true}
3539
>
3640
<Modal.Header closeButton>
37-
<Modal.Title id='contained-modal-title-vcenter' style={{ fontSize: '3vh' }}>
41+
<Modal.Title id='contained-modal-title-vcenter' style={{ fontSize: isPortrait ? '3vh' : '6vh' }}>
3842
Live Video
3943
</Modal.Title>
4044
</Modal.Header>

feedingwebapp/src/Pages/Home/MealStates/PlateLocator.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ const PlateLocator = (props) => {
4040
// done button width
4141
let doneButtonWidth = '47vw'
4242
// button height
43-
let buttonHeight = '8vh'
43+
let buttonHeight = isPortrait ? '6vh' : '11vh'
4444
// arrow button width
45-
let arrowButtonWidth = '13vw'
45+
let arrowButtonWidth = '16vw'
4646

4747
/**
4848
* Callback function for when the user presses one of the buttons to teleop

feedingwebapp/src/index.js

+3-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useRef } from 'react'
1+
import React from 'react'
22
import ReactDOM from 'react-dom'
33
import './index.css'
44
import App from './App'
@@ -7,20 +7,11 @@ import { View } from 'react-native'
77
import { useWindowSize } from './helpers'
88

99
const AppComponent = () => {
10-
// set initial value of window height
11-
let windowHeight = useRef(0)
12-
// set a variable for storing window inner height
13-
let newHeight = window.innerHeight
14-
// callback function when height is resized
15-
const resizeHeight = useCallback(() => {
16-
windowHeight.current = newHeight
17-
}, [newHeight])
18-
// update window size when orienttaion changes with callback
19-
useWindowSize(resizeHeight)
10+
let windowSize = useWindowSize(null)
2011

2112
return (
2213
<>
23-
<View style={{ flex: 1, height: windowHeight.current }}>
14+
<View style={{ flex: 1, height: windowSize.height }}>
2415
<App />
2516
</View>
2617
</>

0 commit comments

Comments
 (0)