Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/AppDrawer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const AppDrawer = ({
onClose={toggleDrawerOff}
variant={isPermanent ? 'permanent' : 'temporary'}
PaperProps={{ style: { width, top: 'auto' } }}
ModalProps={{ keepMounted: true }}
>
<div ref={contentRef} className="flex flex-col h-full bg-[linear-gradient(180deg,#1B2023_0%,#111516_100%)]">
{!isPermanent
Expand Down
6 changes: 5 additions & 1 deletion src/components/Dashboard/DeviceList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { devices as Devices } from '@commaai/api';

import { updateDevices } from '../../actions';
import Colors from '../../colors';
import { getDeviceSettings } from '../../url';
import { deviceNamePretty, deviceIsOnline, filterRegularClick, emptyDevice } from '../../utils';
import VisibilityHandler from '../VisibilityHandler';

Expand Down Expand Up @@ -90,7 +91,7 @@ class DeviceList extends Component {
super(props);

this.state = {
settingsModalDongleId: null,
settingsModalDongleId: getDeviceSettings(window.location.pathname),
};

this.renderDevice = this.renderDevice.bind(this);
Expand All @@ -107,6 +108,9 @@ class DeviceList extends Component {

handleClosedSettingsModal() {
this.setState({ settingsModalDongleId: null });
if (window.location.pathname.endsWith('/settings')) {
window.history.replaceState(null, '', `/${this.props.selectedDevice}`);
}
}

async onVisible() {
Expand Down
10 changes: 9 additions & 1 deletion src/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,12 @@ export function getPrimeNav(pathname) {
return true;
}
return false;
}
}

export function getDeviceSettings(pathname) {
const parts = pathname.split('/').filter((m) => m.length);
if (parts.length === 2 && dongleIdRegex.test(parts[0]) && parts[1] === 'settings') {
return parts[0];
}
return null;
}
Loading