Remember last "toggle half screen" state in local browser storage (per device) #3141
Zak Siddiqui opened 1 month ago

Replaces OD-3139

Summary

OneDev exposes a toggle half screen control on several views - issues, pull requests, and any other screen that offers it. Today that state is not remembered: a user who turns it on must turn it on again every time they open an issue, a pull request, or any other view that has the control.

Problem

The user's intent is being discarded, which creates repetitive friction. If the toggle was left on, opening a new issue/PR should already show half screen; if it was left off, it should open off. Re-selecting it on every view implies the UI is not paying attention to an obvious, stable preference.

Desired behavior

  • Remember the user's last choice of the toggle half screen control.
  • If it was last on, every relevant view opens with it already on.
  • If it was last off, every relevant view opens with it already off.
  • Remember it silently - no extra "save preferences" step or dialog.
  • Persist it in local browser storage, per device (not per user, not in the database). It is acceptable if a new device or a new browser session starts from the default; the goal is to stop re-toggling on every single page.

Scope

  • Applies to every view that currently exposes the toggle half screen control (issues, pull requests, and any other such screen).
  • Does not require any server-side, account-level, or database changes.
  • Does not affect anonymous users - persistence is purely client-side, so it works the same regardless of sign-in state.

Implementation approach: follow the light/dark mode persistence pattern

Rather than inventing a new mechanism, this should reuse the same client-side pattern already used for remembering the user's light/dark mode choice. The concrete details below must be confirmed by reading the source before implementing, since they are not verified here:

  • Identify how the light/dark mode preference is stored (expected: browser local storage, e.g. a key such as theme or similar) and where the read/write helpers live.
  • Identify how the preference is read on page/view load so the correct mode is applied before render, and how it is written when the user changes it.
  • Mirror that exact pattern for the toggle half screen state: a dedicated storage key, read on view initialization to pre-apply the toggle, and written on every user change (on and off).
  • Reuse the existing storage abstraction/helpers and naming conventions so the two preferences behave consistently and stay easy to find.
  • Ensure multi-tab behavior is at least as good as the existing theme behavior (i.e. no regression relative to how theme currently handles other open tabs).

Notes to confirm during investigation

  • Exact storage key/name used for theme, and whether it is namespaced.
  • Whether the theme value is read per-render, per-app-init, or both.
  • Whether any shared utility (a "client preferences" helper) already exists that both preferences should use.
  • Default value for toggle half screen when no stored value exists (assumed: current default / off unless the current default is otherwise).
  • Robin Shen commented 1 month ago

    The half-screen is designed as an action instead of a state. Otherwise, it will be very cubersome to show existing issue only in top half of the screen as the add new comment will occupy bottom half of the screen.

  • Robin Shen changed state to 'Closed' 1 month ago
    Previous Value Current Value
    Open
    Closed
  • Zak Siddiqui commented 2 weeks ago

    @robin

    ...cumbersome to show existing issue only in top half of the screen as the add new comment will occupy bottom half of the screen.

    The reason I disagree with this is because it is a matter of choice whether to show this or not.

    The only people who will be using this half screen are those who, like me, need to be scrolling up and down and want that text box to be always visible. It's easily removed at any point in time. If they stop wanting it visible, they can untoggle it, and then it will be a state.

    It doesn't need to be a state that is mirrored across all tabs at all times. It can be a state that is only loaded whenever a page is loaded, if that makes it easier.

    The other reason I disagree is that it doesn't necessarily take up the entire half of the screen, since the size is scalable down to a smaller section of the screen. This makes it very convenient to always have the text box there while still being able to see the text of the issue in two-thirds of the screen.

    Because this feature is not in place, every time I load a page, it's more cumbersome for me because I have to toggle the half-screen text box every single time. If people don't want the cumbersome nature of this half-screen toggle, then they can simply untoggle it, and it won't be cumbersome for them.

  • Zak Siddiqui changed state to 'Open' 2 weeks ago
    Previous Value Current Value
    Closed
    Open
1/1
Type
Enhancement
Priority
Normal
Assignee
Labels
No labels
Issue Votes (1)
Watchers (2)
Reference
OD-3141
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover