Browse Source

Merge pull request #366 from kylewistrand/dashboard-node-links

feat: Make nodes on dashboard clickable
pull/391/head
Hunter Thornsberry 1 year ago
committed by GitHub
parent
commit
547b86f98e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      src/pages/Dashboard/index.tsx

13
src/pages/Dashboard/index.tsx

@ -15,8 +15,9 @@ import {
import { useMemo } from "react";
export const Dashboard = () => {
const { setConnectDialogOpen } = useAppStore();
const { setConnectDialogOpen, setSelectedDevice } = useAppStore();
const { getDevices } = useDeviceStore();
const { darkMode } = useAppStore();
const devices = useMemo(() => getDevices(), [getDevices]);
@ -38,7 +39,13 @@ export const Dashboard = () => {
{devices.map((device) => {
return (
<li key={device.id}>
<div className="px-4 py-4 sm:px-6">
<button
type="button"
className={`w-full px-4 py-4 sm:px-6 ${darkMode ? "hover:bg-slate-800 focus:bg-slate-400 active:bg-slate-600" : "hover:bg-slate-50 focus:bg-slate-50 active:bg-slate-100"}`}
onClick={() => {
setSelectedDevice(device.id);
}}
>
<div className="flex items-center justify-between">
<p className="truncate text-sm font-medium text-accent">
{device.nodes.get(device.hardware.myNodeNum)?.user
@ -75,7 +82,7 @@ export const Dashboard = () => {
{device.nodes.size === 0 ? 0 : device.nodes.size - 1}
</div>
</div>
</div>
</button>
</li>
);
})}

Loading…
Cancel
Save