Skip to content

fix: default request location and segmented indicator entry animation - #1657

Open
SameDesu123 wants to merge 1 commit into
kwaroran:mainfrom
SameDesu123:fix/segmented-request-location
Open

SameDesu123 wants to merge 1 commit into
kwaroran:mainfrom
SameDesu123:fix/segmented-request-location

Conversation

@SameDesu123

Copy link
Copy Markdown
Contributor

PR Checklist

  • Required Checks
    • Have you added type definitions?
    • Have you tested your changes?
    • Have you checked that it won't break any existing features?
  • If your PR uses models1, check the following:
    • Have you checked if it works normally in all models?
    • Have you checked if it works normally in all web, local, and node-hosted versions? If it doesn't, have you blocked it in those versions?
  • If your PR is highly AI generated2, check the following:
    • Have you understood what the code does?
    • Have you cleaned up any unnecessary or redundant code?
    • Is it not a huge change?
      • We currently do not accept highly AI generated PRs that are large changes.

Summary

On the web build, Advanced Settings > Request Location showed no option selected, even for a fresh save. Selecting an option from that state made the indicator slide in from the left edge instead of appearing on the chosen option.

Related Issues

None

Changes

  • src/ts/storage/database.svelte.ts: requestLocation was never initialized in setDatabase, so it stayed undefined and matched none of the segment values ('', 'eu', 'fedramp'). Added data.requestLocation ??= '' so both new and existing saves show Default selected.
  • src/lib/UI/GUI/SegmentedControl.svelte: when there was no active option, the indicator style was cleared (x = 0, width 0), so the next selection animated from the left edge. Now, when going from no selection to a selection, the indicator is placed at the target without the transform/width transition and fades in. When the selection is removed, it fades out in place. The initial mount (no animation) and the slide between options are unchanged.

Impact

  • requestLocation: '' is falsy, so the risu-location header is still not sent by default. Request behavior does not change.
  • The SegmentedControl change affects every segmented control, but only in the "no matching value" state.

Additional Notes

To check the animation now that the default is set, run pnpm dev, open Advanced Settings, and run this in the devtools console:

const { DBState } = await import('/src/ts/stores.svelte.ts')
DBState.db.requestLocation = undefined

The indicator fades out in place. Clicking any option then makes it fade in on that option.

pnpm check and src/lib/UI/GUI/guiRendering.test.ts pass.

Footnotes

  1. Modifies the behavior of prompting, requesting, or handling responses from AI models. ↩

  2. Over 80% of the code is AI generated. ↩

- Initialize requestLocation to '' in setDatabase so the segmented control
  shows Default selected for new and existing saves.
- When SegmentedControl goes from no selection to a selection, place the
  indicator at the target and fade it in instead of sliding from the left.
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.

1 participant