Files
wekan/models/lib/sidebarViewButton.js
T
Lauri Ojansivu daaf563910 Docs: implemented designs move to docs/Features, filed the way the menu is.
A design that describes what WeKan already DOES belongs with the feature it
describes, not in the folder for things being proposed. Fifteen docs move:

  Design/Accessibility.md      -> Features/Accessibility/Accessibility-Improvements.md
  Design/Original-Positions.md -> Features/Board/Original-Positions.md
  Design/Page/*                -> Features/Page/*   (thirteen pages that exist)
  Design/AdminPanelProblems.md -> Features/Admin-Panel/Problems/Design.md

What stays in docs/Design is what the folder is for: the principles
(Design-Principles, Monkey-Proof-Software), the comparisons, the roadmap
(Multiverse), and the proposals not yet built (Multitenancy, Autoupdate).

The Admin Panel Problems design is new and covers six changes - summaries, the
per-actor tally, IPv4/IPv6 columns, an API report, a per-address login tally,
and blocking with increasing delays. Three are shipped and three are planned;
it is filed under the feature because the pane exists, with each planned item
marked so it can become plain description as it lands.

Every reference in the repository is rewritten - 152 files, including the CSS
comments that point at the table-page design, which a first pass over .md and
.js alone missed. Two suites asserted the old paths and now assert the new
ones. A moved doc whose links nobody fixed is worse than one nobody moved.

Thanks to xet7 !
2026-08-16 15:15:01 +03:00

35 lines
1.4 KiB
JavaScript

'use strict';
// Which way a header button that opens a sidebar VIEW goes on a click.
//
// Filter and Search only ever OPENED. Clicking one while the sidebar was
// already showing its view did nothing visible, so the button that opened the
// panel could not shut it and the only way back was the sidebar's own ✕ -
// somewhere else on screen from the thing you just clicked.
//
// They close on the second click now. `mustStayOpen` is the exception, and it
// is Filter's: with a filter on, the sidebar is the one place that says WHAT is
// being hidden from the board, and closing it would leave a board showing a
// subset of its cards with nothing on screen to say so. Search has no such
// case - its results are inside the panel and it hides nothing from the board -
// so it passes false and always toggles.
//
// Pure: two booleans in, one word out, so the guard can check every combination
// without a DOM. docs/Features/Page/Header.md
const SIDEBAR_VIEW_OPEN = 'open';
const SIDEBAR_VIEW_CLOSE = 'close';
// `isShowingView` is "the sidebar is open AND it is on THIS button's view" - a
// sidebar open on Activities is showing neither, and clicking either button
// there has to switch to it rather than close the panel.
function sidebarViewButtonAction(isShowingView, mustStayOpen) {
return isShowingView && !mustStayOpen ? SIDEBAR_VIEW_CLOSE : SIDEBAR_VIEW_OPEN;
}
module.exports = {
SIDEBAR_VIEW_OPEN,
SIDEBAR_VIEW_CLOSE,
sidebarViewButtonAction,
};