Skip to content

Commit

Permalink
show user edited name inside segments instead of device original name
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Oct 11, 2024
1 parent c4a5b7c commit 35fc920
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/Dialogs/_AddSegmentDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const Root = styled('div')(({ theme }) => ({
function ConfirmationDialogRaw(props: any) {
const { onClose, value: valueProp, open, ...other } = props
const [value, setValue] = React.useState(valueProp)
const virtuals = useStore((state) => state.virtuals) || {}

const handleCancel = () => {
onClose()
Expand Down Expand Up @@ -71,7 +72,7 @@ function ConfirmationDialogRaw(props: any) {
value={props.deviceList[device].id}
key={props.deviceList[device].id}
>
{props.deviceList[device].config.name}
{virtuals[props.deviceList[device].id].config.name || props.deviceList[device].config.name}
</MenuItem>
))}
</Select>
Expand Down
5 changes: 3 additions & 2 deletions src/pages/Devices/EditVirtuals/Segment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import useSegmentStyles from './Segment.styles'

const Segment = ({ s, i, virtual, segments, calib }: any) => {
const devices = useStore((state) => state.devices)
const virtuals = useStore((state) => state.virtuals)

const title =
devices &&
devices[devices && Object.keys(devices).find((d) => d === s[0])!].config!
devices && virtuals &&
virtuals[devices && Object.keys(devices).find((d) => d === s[0])!].config!
.name
const classes = useSegmentStyles()
const updateSegments = useStore((state) => state.updateSegments)
Expand Down

0 comments on commit 35fc920

Please sign in to comment.