Skip to content

Commit

Permalink
Fixed minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
matthlh committed Dec 24, 2024
1 parent 4622b01 commit c8010df
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 20 deletions.
64 changes: 64 additions & 0 deletions software/tracksight/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions software/tracksight/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@mui/icons-material": "^6.1.7",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-slot": "^1.1.0",
Expand All @@ -33,6 +34,7 @@
"plotly.js": "^2.27.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-draggable": "^4.4.6",
"react-plotly.js": "^2.6.0",
"react-transition-group": "^4.4.5",
"recharts": "^2.13.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
import React, { useState, useEffect } from 'react'
import Draggable from 'react-draggable'
import { DropdownMenuCheckboxes } from './FaultFilters'

const initData = { timestamp: 0, name: 'e' }

const LiveFault: React.FC = () => {
// TODO change the TS type late
const [board1, setBoard1] = useState([initData])
const [faults, setFaults] = useState<boolean[]>([false, false, false])
const [warnings, setWarnings] = useState<boolean[]>([false, false, false])
const [faults, setFaults] = useState<boolean[]>([
false,
false,
false,
false,
false,
false,
false,
])
const [warnings, setWarnings] = useState<boolean[]>([
false,
false,
false,
false,
false,
false,
false,
])
const [count, setCount] = useState<number>(-1)

useEffect(() => {
Expand Down Expand Up @@ -56,7 +73,7 @@ const LiveFault: React.FC = () => {
return (
<div>
<FaultDisplay
width={96 * (board1[index + 1].timestamp - fault.timestamp)}
width={97 * (board1[index + 1].timestamp - fault.timestamp)}
isFault={hasFault}
isWarning={hasWarning}
/>
Expand All @@ -65,7 +82,7 @@ const LiveFault: React.FC = () => {
} else {
return (
<FaultDisplay
width={96 * (count - board1[board1.length - 1].timestamp)}
width={97 * (count - board1[board1.length - 1].timestamp)}
isFault={hasFault}
isWarning={hasWarning}
/>
Expand Down Expand Up @@ -143,10 +160,9 @@ const LiveFault: React.FC = () => {
<button
className='bg-cyan-200 dark:bg-cyan-800 pr-2 rounded-md px-2 mx-1'
onClick={() => {
console.log(board1)
setBoard1([initData])
setFaults([false, false, false])
setWarnings([false, false, false])
setFaults([false, false, false, false, false, false, false])
setWarnings([false, false, false, false, false, false, false])
setCount(-1)
}}>
Reset
Expand All @@ -172,16 +188,20 @@ const LiveFault: React.FC = () => {
}

return (
<div className='bg-gray-200 dark:bg-gray-700 w-full'>
<div className='flex flex-row justify-end'>
<div className='flex flex-col pr-9'>
{/* Below is the actual faults graph */}
{faults.map((fault, index) => {
return <FaultBar fault={fault} index={index} key={index} />
})}
// ! TODO Figure out how to cap the height of this to like 30% of screen and make this scrollable
// Replace the bottom div with a draggable one
<div className='bg-gray-200 dark:bg-gray-700 w-full h-18 overflow-hidden'>
<Draggable>
<div className='flex flex-row justify-end'>
<div className='flex flex-col pr-9'>
{/* Below is the actual faults graph */}
{faults.map((fault, index) => {
return <FaultBar fault={fault} index={index} key={index} />
})}
</div>
<div className='p-2'>TBD{/* <DropdownMenuCheckboxes /> */}</div>
</div>
<div className='p-2'>TBD{/* <DropdownMenuCheckboxes /> */}</div>
</div>
</Draggable>
{/* //! TODO: REMOVE AFTER TESTING */}
<div className='flex justify-start'>
<p className='pr-2'>Toggle Faults: </p>
Expand Down
4 changes: 2 additions & 2 deletions software/tracksight/frontend/src/app/testing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const TestingPage = () => {
{/* <MouseTest /> */}
<Timer />
<LiveFault />
<EnumerationGraph
{/* <EnumerationGraph
signalName='VC_STATE'
currentState={currentState}
currentTime={currentTime}
Expand All @@ -53,7 +53,7 @@ const TestingPage = () => {
<NumericalGraph
numericalSignals={numericalSignals}
currentTime={currentTime}
/>
/> */}
</div>
)
}
Expand Down
40 changes: 38 additions & 2 deletions software/tracksight/frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,29 @@
resolved "https://registry.npmjs.org/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz"
integrity sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA==

"@dnd-kit/accessibility@^3.1.1":
version "3.1.1"
resolved "https://registry.npmjs.org/@dnd-kit/accessibility/-/accessibility-3.1.1.tgz"
integrity sha512-2P+YgaXF+gRsIihwwY1gCsQSYnu9Zyj2py8kY5fFvUM1qm2WA2u639R6YNVfU4GWr+ZM5mqEsfHZZLoRONbemw==
dependencies:
tslib "^2.0.0"

"@dnd-kit/core@^6.3.1":
version "6.3.1"
resolved "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz"
integrity sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==
dependencies:
"@dnd-kit/accessibility" "^3.1.1"
"@dnd-kit/utilities" "^3.2.2"
tslib "^2.0.0"

"@dnd-kit/utilities@^3.2.2":
version "3.2.2"
resolved "https://registry.npmjs.org/@dnd-kit/utilities/-/utilities-3.2.2.tgz"
integrity sha512-+MKAJEOfaBe5SmV6t34p80MMKhjvUz0vRrvVJbPT0WElzaOJ/1xs+D+KDv+tD/NE5ujfrChEcshd4fLn0wpiqg==
dependencies:
tslib "^2.0.0"

"@emotion/cache@^11.13.1":
version "11.13.1"
resolved "https://registry.npmjs.org/@emotion/cache/-/cache-11.13.1.tgz"
Expand Down Expand Up @@ -1932,6 +1955,11 @@ cliui@^8.0.1:
strip-ansi "^6.0.1"
wrap-ansi "^7.0.0"

clsx@^1.1.1:
version "1.2.1"
resolved "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz"
integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==

clsx@^2.0.0, clsx@^2.1.1:
version "2.1.1"
resolved "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz"
Expand Down Expand Up @@ -5048,14 +5076,22 @@ rc-virtual-list@^3.11.1, rc-virtual-list@^3.5.1, rc-virtual-list@^3.5.2:
rc-resize-observer "^1.0.0"
rc-util "^5.36.0"

react-dom@*, "react-dom@^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^16.8 || ^17 || ^18", "react-dom@^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom@^17.0.0 || ^18.0.0 || ^19.0.0", react-dom@^18.0.0, react-dom@^18.2.0, react-dom@>=16.0.0, react-dom@>=16.11.0, react-dom@>=16.6.0, react-dom@>=16.8.0, react-dom@>=16.9.0, [email protected]:
react-dom@*, "react-dom@^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^16.8 || ^17 || ^18", "react-dom@^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom@^17.0.0 || ^18.0.0 || ^19.0.0", react-dom@^18.0.0, react-dom@^18.2.0, "react-dom@>= 16.3.0", react-dom@>=16.0.0, react-dom@>=16.11.0, react-dom@>=16.6.0, react-dom@>=16.8.0, react-dom@>=16.9.0, [email protected]:
version "18.2.0"
resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz"
integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==
dependencies:
loose-envify "^1.1.0"
scheduler "^0.23.0"

react-draggable@^4.4.6:
version "4.4.6"
resolved "https://registry.npmjs.org/react-draggable/-/react-draggable-4.4.6.tgz"
integrity sha512-LtY5Xw1zTPqHkVmtM3X8MUOxNDOUhv/khTgBgrUvwaS064bwVvxT+q5El0uUFNx5IEPKXuRejr7UqLwBIg5pdw==
dependencies:
clsx "^1.1.1"
prop-types "^15.8.1"

react-is@^16.13.1:
version "16.13.1"
resolved "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz"
Expand Down Expand Up @@ -5125,7 +5161,7 @@ react-transition-group@^4.4.5:
loose-envify "^1.4.0"
prop-types "^15.6.2"

react@*, "react@^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc", "react@^16.8 || ^17 || ^18", "react@^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react@^16.8.0 || ^17.0.0 || ^18.0.0", "react@^17.0.0 || ^18.0.0 || ^19.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16.8.0 || 17.x.x || ^18.0.0-0", react@>=16.0.0, react@>=16.11.0, react@>=16.6.0, react@>=16.8.0, react@>=16.9.0, react@>0.13.0, [email protected]:
react@*, "react@^16.0.0 || ^17.0.0 || ^18.0.0", "react@^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0-rc", "react@^16.8 || ^17 || ^18", "react@^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", "react@^16.8.0 || ^17.0.0 || ^18.0.0", "react@^17.0.0 || ^18.0.0 || ^19.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16.3.0", "react@>= 16.8.0 || 17.x.x || ^18.0.0-0", react@>=16.0.0, react@>=16.11.0, react@>=16.6.0, react@>=16.8.0, react@>=16.9.0, react@>0.13.0, [email protected]:
version "18.2.0"
resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz"
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
Expand Down

0 comments on commit c8010df

Please sign in to comment.