Skip to content

Conversation

@dzienisz
Copy link
Contributor

@dzienisz dzienisz commented Oct 26, 2025

Description

Screenshot 2025-11-14 at 14 40 01 Screenshot 2025-11-14 at 14 40 05

Remove Fixed Position Picker & Simplify Position Config

Summary

Replaced the old FixedPositionPicker UI (map, tooltips, per-component admin messages) with a simpler, form-based workflow directly inside Position.tsx. The form now owns latitude, longitude, and altitude fields, validating and saving coordinates through the existing config submission flow while still sending the setFixedPosition admin message when needed. Unused translations and the obsolete component were removed.

Related Issues

Fixes: Users couldn’t reliably save fixed position coordinates after the picker button removal.

Changes Made

Removed

  • FixedPositionPicker.tsx – entire component deleted (map picker, tooltips, buttons, admin-message wiring).
  • config.json – removed translations for picker map hints, buttons, error/success toasts.

Updated Files

  • Position.tsx

    • Added latitude/longitude/altitude fields to the form schema and UI (with suffixes and clearer descriptions).
    • Integrated validation + default altitude (0) directly into form state.
    • On submit, sends setFixedPosition admin message when fixed-position coordinates are present; coordinates are omitted from config payload.
    • Uses form disabledBy to hide coordinate fields unless “Fixed Position” is enabled.
  • validation/config/position.ts

    • PositionValidationSchema now includes optional latitude, longitude, altitude.
  • config.json (en)

    • Cleaned up unused fixed-position translations; kept only label/description entries still referenced in UI.

Key Points

  • Coordinates are fully form-managed; no duplicate state between picker + form.
  • Precision clarified: UI descriptions mention 7 decimal max.
  • Suffixes display full units (“Degrees”, “Meters”/“Feet”) for clarity.
  • Altitude defaults to 0 when no existing value is present.
  • No lingering references to the removed picker (imports deleted, file removed).
  • Translation file only contains active keys.

Testing

  • ✅ Lint: pnpm run lint (root) — passes.
  • ✅ Manual checks:
    • Toggling Fixed Position on/off shows/hides coordinate fields.
    • Entering lat/lon/alt values saves via form submit; sends admin message when fixed position is enabled.
    • Disabled state respected when fixed position is off.
    • Metric vs. imperial display units update suffix and description text.
    • No references to removed picker remain.

Checklist

  • Code follows project style/patterns.
  • Type safety maintained (PositionValidationSchema updated).
  • Translations cleaned.
  • Linting passes.
  • Removed obsolete component and assets.

@vercel
Copy link

vercel bot commented Oct 26, 2025

@dzienisz is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Collaborator

@danditomaso danditomaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall really glad to see this has been added to the code base, it has been needed for a while.

I will need to see some changes reverted otherwise it will cause all kinds of type issues around the code base. Additionally, the Fixed Position component must be added to the DynamicFormField and referenced using the type field by its string value (known as a factory function). Once you look at the DynamicFormField component you'll see the pattern. I'm available to help answer any questions on will be required to get this merged

@dzienisz
Copy link
Contributor Author

I am open to all suggestions. This is my first big PR. I can improve it next week.

@dzienisz dzienisz force-pushed the feat/fixed-position branch 2 times, most recently from d3777e6 to 9b80d5e Compare October 29, 2025 13:48
@danditomaso
Copy link
Collaborator

@dzienisz Wanted to follow up and see if the fixes were going to be added to this PR?

@dzienisz
Copy link
Contributor Author

@dzienisz Wanted to follow up and see if the fixes were going to be added to this PR?

today, sorry for delay

@dzienisz dzienisz force-pushed the feat/fixed-position branch from 9b80d5e to 72dff84 Compare November 12, 2025 11:16
- Created new FixedPositionPicker component with clickable map for setting device coordinates
- Added form field type for fixed position picker that appears when fixedPosition toggle is enabled
- Implemented position request functionality to retrieve current device location
@dzienisz dzienisz force-pushed the feat/fixed-position branch from 72dff84 to c62c2d3 Compare November 12, 2025 11:37
- Added dynamic altitude unit (Meters/Feet) that respects the user's imperial/metric display preference
- Updated altitude field description to show the appropriate unit instead of hardcoded "Meters"
@dzienisz dzienisz requested a review from danditomaso November 12, 2025 11:44
- Replace hardcoded IDs with useId() hook for proper accessibility
- Use Number.isNaN() instead of isNaN() for more reliable type checking
- Add radix parameter to parseInt() and remove unnecessary fragment wrapper
- Removed dedicated FixedPositionPicker form field type in favor of toggle's additionalContent prop
- Moved FixedPositionPicker to render conditionally within toggle field instead of as separate dynamic field
- Streamlined form field types by eliminating FixedPositionPickerFieldProps
@danditomaso
Copy link
Collaborator

Can you remove the large white border and the padding around this new component, and with the exception of one other comment about using standards such as {...rest} in the component it looks good to go.

@danditomaso
Copy link
Collaborator

Also, how does this feature interact with the GPS Mode dropdown above? Can both be used at the same time?

@danditomaso
Copy link
Collaborator

Also, since. you mentioned some "recommended notes"

GPS Mode recommendation: Set to "DISABLED" or "NOT_PRESENT" when using fixed position for best results

This can be enforced at the field level, look for disabledBy: in the codebase, as its important users dont need a manual to use a new feature and that it "just works"

@dzienisz dzienisz requested a review from danditomaso November 13, 2025 15:04
@vercel
Copy link

vercel bot commented Nov 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
web-test Ready Ready Preview Comment Nov 13, 2025 5:38pm

@danditomaso
Copy link
Collaborator

danditomaso commented Nov 13, 2025

So I played with it a bit, and if I enter a lat or long greater than -90 - 90 it throws an error, or if you enter 3 digits at all, and click "set fixed position" the thrown error is caught by the top level error handler. This should really validate the input and display an error if the input isn't valid instead of throwing an error.
image
image

…s for fixed position

- Removed FixedPositionPicker component with map interface
- Added latitude, longitude, and altitude fields directly to position form
- Moved coordinate validation into PositionValidationSchema with proper min/max bounds
- Updated translation strings to include coordinate ranges and improved altitude description
- Coordinates now sent via setFixedPosition admin message on form submit when fixedPosition is enabled
@dzienisz dzienisz force-pushed the feat/fixed-position branch 2 times, most recently from 8c102c8 to b777c7b Compare November 14, 2025 13:56
@dzienisz dzienisz force-pushed the feat/fixed-position branch from b777c7b to 57612fa Compare November 14, 2025 13:59
…d unused field spreading

- Removed additionalContent prop and its JSDoc documentation from ToggleFieldProps
- Removed rendering of additionalContent below toggle switch
- Cleaned up Controller render function by removing unused rest spread operator
- Renamed field destructuring to controllerField for clarity
@dzienisz dzienisz force-pushed the feat/fixed-position branch from 57612fa to 0d252aa Compare November 14, 2025 13:59
@dzienisz
Copy link
Contributor Author

@danditomaso Setting position does not work, and I'm not sure why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants