modified tsconfig.app.json file to deal with errors i was getting, also made changes to the tabs on the devices page and moved group stuff out of the router and into the device page file

This commit is contained in:
csawatzky 2025-01-02 15:32:39 -06:00
parent bc8b0a3405
commit 0ec54b2d31
4 changed files with 16 additions and 26 deletions

View file

@ -50,13 +50,8 @@ const useStyles = makeStyles((theme: Theme) => {
});
});
interface Props {
groups: Group[];
setGroups: React.Dispatch<React.SetStateAction<Group[]>>;
}
export default function Devices(props: Props) {
const { groups, setGroups } = props;
export default function Devices() {
const [groups, setGroups] = useState<Group[]>([]);
const isMobile = useMobile();
const classes = useStyles();
const navigate = useNavigate();
@ -182,8 +177,11 @@ export default function Devices(props: Props) {
})
}
useEffect(() => {
loadDevices()
}, [limit, page, order, orderBy, search, tab])
useEffect(() => {
@ -373,22 +371,21 @@ export default function Devices(props: Props) {
}}
>
<Tabs
{...{}}
value={groups.length > 0 ? tab : "all"}
onChange={handleTabChange}
variant="scrollable"
scrollButtons="auto"
sx={{ borderRadius: 1 }}
>
<Tab {...{}} value={"all"} label="All" />
{groupsLoading ?
<CircularProgress/>
<Tab value={"all"} label="All" />
{groupsLoading ?
<Tab value={"loading"} label={<CircularProgress />}/>
: groups.map((group, index) => {
if (group.id()) return (
<Tab {...{}} value={group.id().toString()} label={group.name()} key={"group-tab-"+index}/>
<Tab value={group.id().toString()} label={group.name()} key={"group-tab-"+index}/>
)
})}
<Tab {...{}} value={"never"} label={<CreateGroupIcon className={classes.green} />} onClick={() => openGroupSettings(undefined, "add")} />
<Tab value={"never"} label={<CreateGroupIcon className={classes.green} />} onClick={() => openGroupSettings(undefined, "add")} />
</Tabs>
</Box>
<ResponsiveTable<pond.Device>