Skip to content

Commit

Permalink
Add new device and edit device
Browse files Browse the repository at this point in the history
  • Loading branch information
DocMoebiuz committed Nov 3, 2024
1 parent 7f4a037 commit 6115d06
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
28 changes: 28 additions & 0 deletions frontend/src/pages/devices/DeviceEditMobiFlight.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import DeviceIcon from "@/components/mobiflight/icons/DeviceIcon";
import { DeviceElementType, IDeviceItem } from "@/types";
import { IconTrash } from "@tabler/icons-react";

export type MobiFlightDeviceEditPanelProps = {
device: IDeviceItem;
};

export const MobiFlightDeviceEditPanel = (
props: MobiFlightDeviceEditPanelProps
) => {
const device = props.device;
return (
<div className="w-full flex flex-col p-4 overflow-y-auto gap-2">
{(device?.Elements ?? []).map((element) => {
return (
<div className="group flex flex-row gap-4 items-center hover:bg-slate-200 py-2 px-4 rounded-md cursor-pointer border-2 border-slate-200" key={element.Id}>
<DeviceIcon className="w-8 h-8" variant={element.Type as DeviceElementType}></DeviceIcon>
<div className="grow">{element.Name}</div>
<div className="group-hover:opacity-100 opacity-0"><IconTrash className="text-gray-400"></IconTrash></div>
</div>
);
})}
</div>
);
};

export default MobiFlightDeviceEditPanel;
24 changes: 24 additions & 0 deletions frontend/src/pages/devices/DeviceSelection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import DeviceIcon from "@/components/mobiflight/icons/DeviceIcon";
import { DeviceElementTypes } from "@/types/deviceElements";

const DeviceSelection = () => {
const availableDeviceTypes = DeviceElementTypes;

return (
<div className="flex flex-row flex-wrap gap-4">
{availableDeviceTypes.map((deviceType) => {
return (
<div
key={deviceType}
className="h-24 w-24 group flex flex-col gap-1 items-center justify-center hover:bg-slate-200 py-2 px-4 rounded-md cursor-pointer border-2 border-slate-200"
>
<DeviceIcon className="w-12 h-12" variant={deviceType}></DeviceIcon>
<div className="">{deviceType}</div>
</div>
);
})}
</div>
);
};

export default DeviceSelection;

0 comments on commit 6115d06

Please sign in to comment.