forked from sagnik/Velocity-OS
fix: complete Velocity-OS feature migration wiring
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { motion, AnimatePresence } from 'framer-motion';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import styles from './ControlRoom.module.css';
|
||||
|
||||
/**
|
||||
@@ -39,7 +38,9 @@ const PANELS: { id: Panel; label: string; icon: string }[] = [
|
||||
|
||||
export default function ControlRoom() {
|
||||
const navigate = useNavigate();
|
||||
const [active, setActive] = useState<Panel>('system');
|
||||
const location = useLocation();
|
||||
const routePanel = location.pathname.split('/').filter(Boolean)[1] as Panel | undefined;
|
||||
const active: Panel = PANELS.some((panel) => panel.id === routePanel) ? routePanel! : 'system';
|
||||
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
@@ -64,7 +65,7 @@ export default function ControlRoom() {
|
||||
<button
|
||||
key={id}
|
||||
className={`${styles.sideItem} ${active === id ? styles.sideActive : ''}`}
|
||||
onClick={() => setActive(id)}
|
||||
onClick={() => navigate(`/control-room/${id}`)}
|
||||
aria-current={active === id ? 'page' : undefined}
|
||||
>
|
||||
<span className={styles.sideIcon}>{icon}</span>
|
||||
|
||||
Reference in New Issue
Block a user