You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

55 lines
1.5 KiB

import type { PaxcounterValidation } from "@app/validation/moduleConfig/paxcounter.tsx";
import { DynamicForm } from "@components/Form/DynamicForm.tsx";
import { useDevice } from "@core/stores/deviceStore.ts";
import { Protobuf } from "@meshtastic/js";
export const Paxcounter = (): JSX.Element => {
const { moduleConfig, setWorkingModuleConfig } = useDevice();
const onSubmit = (data: PaxcounterValidation) => {
setWorkingModuleConfig(
new Protobuf.ModuleConfig.ModuleConfig({
payloadVariant: {
case: "paxcounter",
value: data,
},
}),
);
};
return (
<DynamicForm<PaxcounterValidation>
onSubmit={onSubmit}
defaultValues={moduleConfig.paxcounter}
fieldGroups={[
{
label: "Paxcounter Settings",
description: "Settings for the Paxcounter module",
fields: [
{
type: "toggle",
name: "enabled",
label: "Module Enabled",
description: "Enable Paxcounter",
},
{
type: "number",
name: "paxcounterUpdateInterval",
label: "Update Interval (seconds)",
description:
"How long to wait between sending paxcounter packets",
properties: {
suffix: "Seconds",
},
disabledBy: [
{
fieldName: "enabled",
},
],
},
],
},
]}
/>
);
};