Skip to content

refactor: change analog/digital field to a more generic mode field #45

Description

@pskillen

Problem

Channels currently use a coarse mode field (analogue | digital | other) derived from vendor CPS "Channel Type". That is enough for OpenGD77 today (FM vs DMR) but does not express the modes we want to support across vendors:

Analog: FM, AM, SSB (USB and LSB)

Digital: DMR, YSF, Tetra

Issue #11 already calls for mode pills and filters (Digital / FM / AM / SSB) in the channel table; the data model needs to catch up before we can implement those consistently.

Intended outcome

Replace the binary analogue/digital abstraction with a specific channel mode value that drives UI pills, filters, and conditional form fields.

Documentation

Create docs/reference/channel-modes.md as the canonical reference:

  • List every supported mode value (FM, AM, SSB-USB, SSB-LSB, DMR, YSF, Tetra, …)
  • Static colour mapping per mode (hex + Mantine token), consistent with band pill styling
  • Notes on which form fields apply per mode (e.g. hide CTCSS/DCS on digital modes)

Data model

  • Update ChannelMode (or equivalent) in src/models/codeplug.ts
  • Update docs/features/data-model/ to match
  • Migration / import mapping: OpenGD77 Channel Type → new mode values (AnalogueFM, DigitalDMR, etc.)
  • Preserve backward compatibility for existing projects in localStorage (sensible defaults for other)

UI

Update channels list, detail, and edit pages:

  • Mode pill with documented colours
  • Edit form mode selector with the full enum
  • Hide/show fields based on mode (tones, colour code, timeslot, contact/TG list, etc.)
  • List filters for mode (per feat: CRUD channels #11)

Implementation should mirror the band reference pattern: src/lib/channelModes.ts (or similar) must match docs/reference/channel-modes.md.

Affected

  • src/models/codeplug.tsChannelMode type and defaults
  • src/lib/import/ — OpenGD77 channel type mapping
  • src/routes/channels/ — list, detail, edit
  • docs/reference/channel-modes.md (new)
  • docs/features/data-model/

Notes / dependencies

  • Unblocks mode pills and mode filters in feat: CRUD channels #11 (CRUD channels).
  • Related to feat: CRUD channels #11 mention of "Highlight digital/fm/am/ssb channels".
  • Does not cover multi-mode channels (single entity carrying both analog and digital) — see the separate multi-mode channels issue.

Out of scope

  • Multi-mode / dual-mode channel modelling (analog+digital as one logical channel).
  • Export-layer mode mapping for every vendor (initial focus: internal model + OpenGD77 import).

Workflow note

Branch from origin/main, atomic conventional commits, PR linking Closes #.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions