@skillcdn/console 0.4.5 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/README.md +4 -4
  2. package/dist/api.d.ts +2 -2
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +2 -2
  5. package/dist/api.js.map +1 -1
  6. package/dist/cli/cli.d.ts +6 -0
  7. package/dist/cli/cli.d.ts.map +1 -1
  8. package/dist/cli/cli.js +83 -42
  9. package/dist/cli/cli.js.map +1 -1
  10. package/dist/cli/format.d.ts +8 -1
  11. package/dist/cli/format.d.ts.map +1 -1
  12. package/dist/cli/format.js +11 -2
  13. package/dist/cli/format.js.map +1 -1
  14. package/dist/cli/help.d.ts.map +1 -1
  15. package/dist/cli/help.js +22 -10
  16. package/dist/cli/help.js.map +1 -1
  17. package/dist/cli/keys.d.ts +10 -0
  18. package/dist/cli/keys.d.ts.map +1 -0
  19. package/dist/cli/keys.js +59 -0
  20. package/dist/cli/keys.js.map +1 -0
  21. package/dist/cli/main.js +2 -1
  22. package/dist/cli/main.js.map +1 -1
  23. package/dist/cli/terminal.d.ts +7 -0
  24. package/dist/cli/terminal.d.ts.map +1 -1
  25. package/dist/cli/terminal.js +39 -0
  26. package/dist/cli/terminal.js.map +1 -1
  27. package/dist/client.d.ts +9 -1
  28. package/dist/client.d.ts.map +1 -1
  29. package/dist/client.js +5 -1
  30. package/dist/client.js.map +1 -1
  31. package/dist/components/plugin-frame.d.ts.map +1 -1
  32. package/dist/components/plugin-frame.js +73 -17
  33. package/dist/components/plugin-frame.js.map +1 -1
  34. package/dist/components/sessions.d.ts +15 -0
  35. package/dist/components/sessions.d.ts.map +1 -0
  36. package/dist/components/sessions.js +17 -0
  37. package/dist/components/sessions.js.map +1 -0
  38. package/dist/components/shell.d.ts.map +1 -1
  39. package/dist/components/shell.js +198 -28
  40. package/dist/components/shell.js.map +1 -1
  41. package/dist/components/workspace.d.ts +2 -0
  42. package/dist/components/workspace.d.ts.map +1 -1
  43. package/dist/components/workspace.js +19 -4
  44. package/dist/components/workspace.js.map +1 -1
  45. package/dist/console.css +228 -21
  46. package/dist/console.d.ts +5 -2
  47. package/dist/console.d.ts.map +1 -1
  48. package/dist/console.js +106 -21
  49. package/dist/console.js.map +1 -1
  50. package/dist/data.d.ts +7 -1
  51. package/dist/data.d.ts.map +1 -1
  52. package/dist/data.js +26 -5
  53. package/dist/data.js.map +1 -1
  54. package/dist/i18n/en.d.ts +24 -0
  55. package/dist/i18n/en.d.ts.map +1 -1
  56. package/dist/i18n/en.js +21 -0
  57. package/dist/i18n/en.js.map +1 -1
  58. package/dist/i18n/index.d.ts +2 -2
  59. package/dist/i18n/index.d.ts.map +1 -1
  60. package/dist/i18n/index.js +7 -3
  61. package/dist/i18n/index.js.map +1 -1
  62. package/dist/i18n/ko.d.ts.map +1 -1
  63. package/dist/i18n/ko.js +23 -2
  64. package/dist/i18n/ko.js.map +1 -1
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +1 -0
  68. package/dist/index.js.map +1 -1
  69. package/dist/plugin/bridge.d.ts +7 -3
  70. package/dist/plugin/bridge.d.ts.map +1 -1
  71. package/dist/plugin/bridge.js +1 -0
  72. package/dist/plugin/bridge.js.map +1 -1
  73. package/dist/plugin/context.d.ts +16 -1
  74. package/dist/plugin/context.d.ts.map +1 -1
  75. package/dist/plugin/define.d.ts.map +1 -1
  76. package/dist/plugin/define.js +6 -3
  77. package/dist/plugin/define.js.map +1 -1
  78. package/dist/plugin/sandbox.d.ts.map +1 -1
  79. package/dist/plugin/sandbox.js +8 -1
  80. package/dist/plugin/sandbox.js.map +1 -1
  81. package/dist/plugin/web.d.ts +16 -3
  82. package/dist/plugin/web.d.ts.map +1 -1
  83. package/dist/plugin/web.js +8 -1
  84. package/dist/plugin/web.js.map +1 -1
  85. package/dist/router.d.ts +6 -0
  86. package/dist/router.d.ts.map +1 -1
  87. package/dist/router.js +5 -0
  88. package/dist/router.js.map +1 -1
  89. package/dist/routes.d.ts +3 -1
  90. package/dist/routes.d.ts.map +1 -1
  91. package/dist/routes.js +2 -0
  92. package/dist/routes.js.map +1 -1
  93. package/dist/schemas.d.ts +38 -0
  94. package/dist/schemas.d.ts.map +1 -1
  95. package/dist/schemas.js +37 -1
  96. package/dist/schemas.js.map +1 -1
  97. package/dist/tokens.d.ts.map +1 -1
  98. package/dist/tokens.js +1 -0
  99. package/dist/tokens.js.map +1 -1
  100. package/dist/vocabulary.d.ts +6 -0
  101. package/dist/vocabulary.d.ts.map +1 -1
  102. package/dist/vocabulary.js +7 -0
  103. package/dist/vocabulary.js.map +1 -1
  104. package/docs/specs/cli.md +5 -5
  105. package/docs/specs/plugins.md +28 -15
  106. package/docs/specs/rest.md +12 -8
  107. package/package.json +1 -1
  108. package/skills/building-a-plugin/SKILL.md +3 -3
  109. package/skills/planning-the-board/references/setting-up.md +1 -1
  110. package/src/api.ts +6 -0
  111. package/src/cli/cli.ts +115 -43
  112. package/src/cli/format.ts +15 -2
  113. package/src/cli/help.ts +22 -10
  114. package/src/cli/keys.ts +69 -0
  115. package/src/cli/main.ts +2 -1
  116. package/src/cli/terminal.ts +40 -0
  117. package/src/client.ts +18 -0
  118. package/src/components/plugin-frame.tsx +92 -24
  119. package/src/components/sessions.tsx +108 -0
  120. package/src/components/shell.tsx +265 -52
  121. package/src/components/workspace.tsx +46 -2
  122. package/src/console.tsx +181 -16
  123. package/src/data.ts +33 -5
  124. package/src/i18n/en.ts +25 -0
  125. package/src/i18n/index.ts +11 -3
  126. package/src/i18n/ko.ts +27 -2
  127. package/src/index.ts +1 -0
  128. package/src/plugin/bridge.ts +8 -3
  129. package/src/plugin/context.ts +16 -1
  130. package/src/plugin/define.ts +10 -2
  131. package/src/plugin/sandbox.ts +9 -1
  132. package/src/plugin/web.ts +21 -4
  133. package/src/router.ts +7 -0
  134. package/src/routes.ts +3 -1
  135. package/src/schemas.ts +41 -0
  136. package/src/styles/console.css +228 -21
  137. package/src/tokens.ts +1 -0
  138. package/src/vocabulary.ts +9 -0
package/dist/console.js CHANGED
@@ -21,6 +21,7 @@ import { MemberList, ProjectForm, ProjectMark, } from "./components/projects.js"
21
21
  import { RemotePicturesContext } from "./components/remote-pictures.js";
22
22
  import { GoalTimeline } from "./components/roadmap.js";
23
23
  import { RulesForm, RulesView } from "./components/rules.js";
24
+ import { SessionList } from "./components/sessions.js";
24
25
  import { isPlainClick, Shell, } from "./components/shell.js";
25
26
  import { SignIn } from "./components/sign-in.js";
26
27
  import { SkillList } from "./components/skills.js";
@@ -48,6 +49,7 @@ export const DEFAULT_COMPONENTS = {
48
49
  EventFeed,
49
50
  SignIn,
50
51
  TokenList,
52
+ SessionList,
51
53
  PeopleList,
52
54
  TeamList,
53
55
  SkillList,
@@ -198,11 +200,13 @@ export function languageToKeep(me, browser, packs) {
198
200
  }
199
201
  /**
200
202
  * The pages a console that holds a token does not offer: the tokens themselves, and the
201
- * approval of an agent's connection, which makes one; a person's own doing on the console's
202
- * own pages, signed in. Everything else a person may do, their agent may (ADR-0021).
203
+ * approval of an agent's connection, which makes one; the browsers signed in; a person's own
204
+ * doing on the console's own pages, signed in. Everything else a person may do, their agent may
205
+ * (ADR-0021).
203
206
  */
204
207
  export function onlyOnOwnPages(route) {
205
208
  return (route.name === "agents" ||
209
+ route.name === "sessions" ||
206
210
  route.name === "new-token" ||
207
211
  route.name === "person-agents" ||
208
212
  route.name === "connect");
@@ -683,6 +687,59 @@ function ProjectSettingsPage(props) {
683
687
  })
684
688
  : undefined, busy: busy }))] }), _jsxs("section", { className: "sc-panel", "aria-label": words.rules.workspaceRules, children: [_jsxs("div", { className: "sc-section-head", children: [_jsx("h2", { className: "sc-section-title", children: words.rules.workspaceRules }), _jsx("a", { className: "sc-muted", href: settingsHref(), children: words.rules.onWorkspaceSettings })] }), rules !== undefined && _jsx(RulesView, { rules: rules.workspace, scope: "workspace", folded: true })] })] }));
685
689
  }
690
+ /**
691
+ * The views of the settings: the workspace's, read by everyone, and the browsers the person is
692
+ * signed in on (board #309), which a console that holds a token does not offer, and so does not
693
+ * name.
694
+ */
695
+ function SettingsViews(props) {
696
+ const views = useWords().settings.views;
697
+ return (_jsxs("nav", { className: "sc-subtabs sc-settings-views", "aria-label": views.aria, children: [_jsx("a", { className: cx("sc-tab", props.on === "workspace" && "sc-tab-current"), href: PATHS.settings, "aria-current": props.on === "workspace" ? "page" : undefined, children: views.workspace }), _jsx("a", { className: cx("sc-tab", props.on === "sessions" && "sc-tab-current"), href: PATHS.sessions, "aria-current": props.on === "sessions" ? "page" : undefined, children: views.sessions })] }));
698
+ }
699
+ /**
700
+ * The browsers whoever is signed in is signed in on (board #309): read when the page opens, and
701
+ * again once one of them, or all the others, are signed out.
702
+ */
703
+ function SessionsPage(props) {
704
+ const words = useWords();
705
+ const { data, components } = props;
706
+ const { busy, error, act } = useAction();
707
+ const [sessions, setSessions] = useState(undefined);
708
+ const [failure, setFailure] = useState(undefined);
709
+ const read = data.actions.sessions;
710
+ useEffect(() => {
711
+ const controller = new AbortController();
712
+ read(controller.signal)
713
+ .then((found) => {
714
+ if (!controller.signal.aborted) {
715
+ setSessions(found);
716
+ }
717
+ })
718
+ .catch((caught) => {
719
+ if (!controller.signal.aborted) {
720
+ setFailure(errorWords(caught, words.common.somethingWentWrong, words));
721
+ }
722
+ });
723
+ return () => controller.abort();
724
+ }, [read, words]);
725
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "sc-page-head", children: _jsx("h1", { className: "sc-page-title", children: words.settings.title }) }), _jsx(SettingsViews, { on: "sessions" }), (error ?? failure) !== undefined && _jsx(Callout, { tone: "danger", children: error ?? failure }), sessions === undefined ? (failure === undefined && (_jsx("div", { className: "sc-loading", children: _jsx(Spinner, { label: words.sessions.loading }) }))) : (_jsx(components.SessionList, { sessions: sessions.items, idleDays: sessions.idleDays, busy: busy, onEnd: (session) => void act(async () => {
726
+ // Read again whether it went or not: one ended from elsewhere, or whose time
727
+ // ended, is not found, and its row goes all the same.
728
+ try {
729
+ await data.actions.endSession(session.id);
730
+ }
731
+ finally {
732
+ setSessions(await read());
733
+ }
734
+ }), onEndOthers: () => void act(async () => {
735
+ try {
736
+ await data.actions.endOtherSessions();
737
+ }
738
+ finally {
739
+ setSessions(await read());
740
+ }
741
+ }) }))] }));
742
+ }
686
743
  /**
687
744
  * The workspace's settings (ADR-0023): its rules, the console's own until an administrator
688
745
  * writes the organization's; its categories, kept on their own page; and where its skills come
@@ -750,7 +807,7 @@ function WorkspaceSettingsPage(props) {
750
807
  navigation.replace(PATHS.settings);
751
808
  }), onCancel: () => navigation.back(PATHS.settings) })] })] }));
752
809
  }
753
- return (_jsxs(_Fragment, { children: [head, error !== undefined && _jsx(Callout, { tone: "danger", children: error }), workspace !== undefined && (_jsxs("section", { className: "sc-panel", "aria-label": words.settings.workspace.aria, children: [_jsxs("div", { className: "sc-section-head", children: [_jsx("h2", { className: "sc-section-title", children: words.settings.workspace.title }), administrator && (_jsx("a", { className: "sc-button sc-button-secondary sc-button-sm", href: settingsHref("workspace"), children: words.common.edit }))] }), _jsx(WorkspaceSettingsView, { workspace: workspace, console: data.me?.console })] })), _jsxs("section", { className: "sc-panel", "aria-label": words.rules.title, children: [_jsx("h2", { className: "sc-section-title", children: words.rules.title }), rules === undefined ? (_jsx(Spinner, { label: words.rules.loading })) : (_jsx(RulesView, { rules: rules, scope: "workspace", editHref: administrator ? settingsHref("rules") : undefined, onArchive: administrator
810
+ return (_jsxs(_Fragment, { children: [head, !holdsToken(data) && _jsx(SettingsViews, { on: "workspace" }), error !== undefined && _jsx(Callout, { tone: "danger", children: error }), workspace !== undefined && (_jsxs("section", { className: "sc-panel", "aria-label": words.settings.workspace.aria, children: [_jsxs("div", { className: "sc-section-head", children: [_jsx("h2", { className: "sc-section-title", children: words.settings.workspace.title }), administrator && (_jsx("a", { className: "sc-button sc-button-secondary sc-button-sm", href: settingsHref("workspace"), children: words.common.edit }))] }), _jsx(WorkspaceSettingsView, { workspace: workspace, console: data.me?.console })] })), _jsxs("section", { className: "sc-panel", "aria-label": words.rules.title, children: [_jsx("h2", { className: "sc-section-title", children: words.rules.title }), rules === undefined ? (_jsx(Spinner, { label: words.rules.loading })) : (_jsx(RulesView, { rules: rules, scope: "workspace", editHref: administrator ? settingsHref("rules") : undefined, onArchive: administrator
754
811
  ? () => void act(async () => {
755
812
  setRules(await data.actions.archiveRules());
756
813
  })
@@ -808,20 +865,30 @@ function PersonAgentsPage(props) {
808
865
  * A plate, read when the page is opened: the person's own, or another person's for whoever
809
866
  * oversees them. The week at the top is the address's.
810
867
  */
868
+ /**
869
+ * What a person's own pages showed last, by what each read: come back to, a page stands at once
870
+ * with what it showed and reads again behind it, rather than wait on the server every time a
871
+ * tab is pressed. Forgotten when the person signs out.
872
+ */
873
+ const shownBefore = new Map();
874
+ function rememberedAs(key) {
875
+ return shownBefore.get(key);
876
+ }
811
877
  function PlatePage(props) {
812
878
  const words = useWords();
813
- const { components, load, couldNotLoad, refused } = props;
814
- const [plate, setPlate] = useState(undefined);
879
+ const { components, load, couldNotLoad, refused, remember } = props;
880
+ const [plate, setPlate] = useState(() => rememberedAs(remember));
815
881
  const [problem, setProblem] = useState(undefined);
816
882
  const [forbidden, setForbidden] = useState(false);
817
883
  useEffect(() => {
818
884
  const controller = new AbortController();
819
- setPlate(undefined);
885
+ setPlate(rememberedAs(remember));
820
886
  setProblem(undefined);
821
887
  setForbidden(false);
822
888
  load(controller.signal)
823
889
  .then((answer) => {
824
890
  if (!controller.signal.aborted) {
891
+ shownBefore.set(remember, answer);
825
892
  setPlate(answer);
826
893
  }
827
894
  })
@@ -839,7 +906,7 @@ function PlatePage(props) {
839
906
  }
840
907
  });
841
908
  return () => controller.abort();
842
- }, [load, couldNotLoad, refused]);
909
+ }, [load, couldNotLoad, refused, remember]);
843
910
  return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "sc-page-head", children: [_jsx("h1", { className: "sc-page-title", children: props.title }), props.aside] }), problem !== undefined && _jsx(Callout, { tone: "danger", children: problem }), forbidden && refused !== undefined ? (_jsx(EmptyState, { title: refused.title, body: refused.body, action: _jsx(LinkButton, { href: PATHS.work, children: words.nav.work }) })) : plate === undefined ? (problem === undefined && (_jsx("div", { className: "sc-loading", children: _jsx(Spinner, { label: props.loading }) }))) : plate.tasks.length === 0 &&
844
911
  (plate.closed?.length ?? 0) === 0 &&
845
912
  (plate.decisions?.length ?? 0) === 0 ? (_jsx(EmptyState, { title: props.empty.title, body: props.empty.body })) : (_jsx(components.WorkList, { work: plate, week: props.week, weekStart: props.weekStart, taskHref: (projectKey, task) => taskHref(projectKey, task.number), decisionHref: (projectKey, decisionId) => decisionHref(projectKey, decisionId), weekHref: props.weekHref }))] }));
@@ -882,10 +949,11 @@ function MyDecisionPage(props) {
882
949
  /** What is on the person's own plate, across their projects. */
883
950
  /** How many of a person's decisions are read at a time. */
884
951
  const MY_DECISIONS_PAGE = 50;
885
- /** The decisions addressed to the person, or, with `raised`, those they raised for someone else (ADR-0042). */
886
- function useMyDecisions(myDecisions, raised, couldNotLoad) {
887
- const [items, setItems] = useState(undefined);
888
- const [more, setMore] = useState(false);
952
+ function useMyDecisions(myDecisions, raised, couldNotLoad,
953
+ /** What the first page is remembered by, with whose it is. */
954
+ remember) {
955
+ const [items, setItems] = useState(() => rememberedAs(remember)?.items);
956
+ const [more, setMore] = useState(() => rememberedAs(remember)?.more ?? false);
889
957
  const [busy, setBusy] = useState(false);
890
958
  const [problem, setProblem] = useState(undefined);
891
959
  const read = useCallback(async (offset, signal) => {
@@ -895,6 +963,9 @@ function useMyDecisions(myDecisions, raised, couldNotLoad) {
895
963
  if (signal?.aborted === true) {
896
964
  return;
897
965
  }
966
+ if (offset === 0) {
967
+ shownBefore.set(remember, { items: page.items, more: page.more });
968
+ }
898
969
  setItems((before) => (offset === 0 ? page.items : [...(before ?? []), ...page.items]));
899
970
  setMore(page.more);
900
971
  }
@@ -908,14 +979,16 @@ function useMyDecisions(myDecisions, raised, couldNotLoad) {
908
979
  setBusy(false);
909
980
  }
910
981
  }
911
- }, [myDecisions, raised, couldNotLoad]);
982
+ }, [myDecisions, raised, couldNotLoad, remember]);
912
983
  useEffect(() => {
913
984
  const controller = new AbortController();
914
- setItems(undefined);
985
+ const kept = rememberedAs(remember);
986
+ setItems(kept?.items);
987
+ setMore(kept?.more ?? false);
915
988
  setProblem(undefined);
916
989
  void read(0, controller.signal);
917
990
  return () => controller.abort();
918
- }, [read]);
991
+ }, [read, remember]);
919
992
  const readMore = useCallback(() => void read(items?.length ?? 0), [read, items]);
920
993
  const reload = useCallback(() => void read(0), [read]);
921
994
  return { items, more, busy, problem, readMore, reload };
@@ -927,8 +1000,9 @@ function useMyDecisions(myDecisions, raised, couldNotLoad) {
927
1000
  function MyDecisionsPage(props) {
928
1001
  const words = useWords();
929
1002
  const { myDecisions, answerReachedDecision } = props.data.actions;
930
- const addressed = useMyDecisions(myDecisions, false, words.myDecisions.couldNotLoad);
931
- const raised = useMyDecisions(myDecisions, true, words.myDecisions.couldNotLoad);
1003
+ const whose = props.data.me?.person?.id ?? "";
1004
+ const addressed = useMyDecisions(myDecisions, false, words.myDecisions.couldNotLoad, `decisions:${whose}:addressed`);
1005
+ const raised = useMyDecisions(myDecisions, true, words.myDecisions.couldNotLoad, `decisions:${whose}:raised`);
932
1006
  const { busy, error, act } = useAction();
933
1007
  const problem = addressed.problem ?? raised.problem ?? error;
934
1008
  // Answered at the decision's own address (ADR-0068), so that one that reaches the person from a
@@ -946,7 +1020,7 @@ function MyDecisionsPage(props) {
946
1020
  function WorkPage(props) {
947
1021
  const words = useWords();
948
1022
  const { work } = props.data.actions;
949
- return (_jsx(PlatePage, { components: props.components, load: work, title: words.work.title, week: props.week, weekStart: weekStartOf(props.data.me?.workspace), weekHref: workHref, loading: words.work.loading, couldNotLoad: words.work.couldNotLoad, empty: words.work.empty }));
1023
+ return (_jsx(PlatePage, { components: props.components, load: work, remember: `work:${props.data.me?.person?.id ?? ""}`, title: words.work.title, week: props.week, weekStart: weekStartOf(props.data.me?.workspace), weekHref: workHref, loading: words.work.loading, couldNotLoad: words.work.couldNotLoad, empty: words.work.empty }));
950
1024
  }
951
1025
  /** Another person's plate, for whoever oversees them: an administrator, or an owner of a project they are in. */
952
1026
  function PersonWorkPage(props) {
@@ -956,7 +1030,7 @@ function PersonWorkPage(props) {
956
1030
  const name = person === undefined ? "?" : personName(person);
957
1031
  const { personWork } = data.actions;
958
1032
  const load = useCallback((signal) => personWork(id, signal), [personWork, id]);
959
- return (_jsx(PlatePage, { components: props.components, load: load, title: words.people.workOf(name), aside: _jsx(LinkButton, { href: PATHS.people, children: words.nav.people }), week: props.week, weekStart: weekStartOf(data.me?.workspace), weekHref: (day) => personWorkHref(id, day), loading: words.people.loadingWork, couldNotLoad: words.people.couldNotLoadWork, empty: { title: words.people.noWork.title(name), body: words.people.noWork.body }, refused: words.people.notOverseen }));
1033
+ return (_jsx(PlatePage, { components: props.components, load: load, remember: `work:${data.me?.person?.id ?? ""}:${id}`, title: words.people.workOf(name), aside: _jsx(LinkButton, { href: PATHS.people, children: words.nav.people }), week: props.week, weekStart: weekStartOf(data.me?.workspace), weekHref: (day) => personWorkHref(id, day), loading: words.people.loadingWork, couldNotLoad: words.people.couldNotLoadWork, empty: { title: words.people.noWork.title(name), body: words.people.noWork.body }, refused: words.people.notOverseen }));
960
1034
  }
961
1035
  function WorkspacePage(props) {
962
1036
  const words = useWords();
@@ -981,6 +1055,9 @@ function WorkspacePage(props) {
981
1055
  if (route.name === "person-work") {
982
1056
  return _jsx(PersonWorkPage, { id: route.id, data: data, components: components, week: route.week });
983
1057
  }
1058
+ if (route.name === "sessions") {
1059
+ return _jsx(SessionsPage, { data: data, components: components });
1060
+ }
984
1061
  if (route.name === "workspace-settings") {
985
1062
  return (_jsx(WorkspaceSettingsPage, { form: route.form, data: data, navigation: navigation, language: language }));
986
1063
  }
@@ -1082,9 +1159,11 @@ export function createConsole(config = {}) {
1082
1159
  const failure = signInFailureOf(location.search);
1083
1160
  const title = data.me?.workspace.name ?? fallbackTitle;
1084
1161
  const viaToken = holdsToken(data);
1085
- // The language: the person's own, else the browser's, else the first the console speaks.
1162
+ // The language: the person's own, else the browser's, else the workspace's (ADR-0081), else
1163
+ // the first the console speaks.
1086
1164
  const chosen = data.me?.language;
1087
- const pack = useMemo(() => chooseLanguage(chosen, typeof navigator === "undefined" ? [] : navigator.languages, languages), [chosen]);
1165
+ const fallback = data.me?.workspace.language;
1166
+ const pack = useMemo(() => chooseLanguage(chosen, typeof navigator === "undefined" ? [] : navigator.languages, languages, fallback), [chosen, fallback]);
1088
1167
  const words = pack.messages;
1089
1168
  const toKeep = languageToKeep(data.me, typeof navigator === "undefined" ? [] : navigator.languages, languages);
1090
1169
  useEffect(() => {
@@ -1171,6 +1250,7 @@ export function createConsole(config = {}) {
1171
1250
  href: PATHS.settings,
1172
1251
  label: words.nav.settings,
1173
1252
  current: route.name === "workspace-settings" ||
1253
+ route.name === "sessions" ||
1174
1254
  route.name === "categories" ||
1175
1255
  route.name === "plugins-settings",
1176
1256
  },
@@ -1299,7 +1379,12 @@ export function createConsole(config = {}) {
1299
1379
  (route.name === "plugin" &&
1300
1380
  data.plugins.some((candidate) => candidate.key === route.plugin &&
1301
1381
  pluginPagesAt(candidate, route.level).some((candidate, index) => candidate.wide &&
1302
- (route.page === undefined ? index === 0 : candidate.key === route.page)))), onNavigate: (href) => navigation.go(href), onSignOut: viaToken ? undefined : () => void data.actions.signOut(), children: page }));
1382
+ (route.page === undefined ? index === 0 : candidate.key === route.page)))), onNavigate: (href) => navigation.go(href), onSignOut: viaToken
1383
+ ? undefined
1384
+ : () => {
1385
+ shownBefore.clear();
1386
+ void data.actions.signOut();
1387
+ }, children: page }));
1303
1388
  }
1304
1389
  return (_jsx(LanguageContext.Provider, { value: pack, children: _jsx(RemotePicturesContext.Provider, { value: pictureSrc, children: content }) }));
1305
1390
  }