@anthusai/papyrus 1.0.0-next.8 → 1.0.0

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 (209) hide show
  1. package/amplify/auth/redirect-urls.js +54 -0
  2. package/amplify/auth/redirect-urls.ts +66 -0
  3. package/amplify/auth/resource.js +20 -5
  4. package/amplify/auth/resource.ts +27 -5
  5. package/amplify/data/resource.js +42 -80
  6. package/amplify/data/resource.ts +42 -80
  7. package/amplify/data/schema.js +45 -60
  8. package/amplify/data/schema.ts +47 -60
  9. package/amplify/functions/category-action/handler.ts +5 -3
  10. package/amplify/functions/console-chat-responder/py/execute_tactus_runner.py +0 -10
  11. package/amplify/functions/console-chat-responder/resource.js +0 -7
  12. package/amplify/functions/console-chat-responder/resource.ts +0 -8
  13. package/amplify/functions/console-chat-responder/src/main.rs +0 -9
  14. package/amplify/functions/content-actions/handler.py +143 -1
  15. package/amplify/functions/content-actions/requirements.txt +2 -1
  16. package/amplify/functions/content-actions/resource.js +6 -1
  17. package/amplify/functions/content-actions/resource.ts +9 -2
  18. package/amplify/functions/renditions/handler.py +120 -0
  19. package/amplify/functions/renditions/requirements.txt +4 -0
  20. package/amplify/functions/shared/python-bundle.js +42 -2
  21. package/amplify/functions/shared/python-bundle.ts +47 -2
  22. package/amplify/functions/shared/reference-curation-metadata.ts +29 -0
  23. package/amplify/inbound-email/ses-intake.js +86 -0
  24. package/amplify/inbound-email/ses-intake.ts +110 -0
  25. package/amplify/plugins/registry.js +19 -0
  26. package/amplify/plugins/registry.ts +23 -0
  27. package/amplify/plugins/signup/function/handler.py +200 -0
  28. package/amplify/plugins/signup/function/resource.js +27 -0
  29. package/amplify/plugins/signup/function/resource.ts +35 -0
  30. package/amplify/plugins/signup/papyrus.plugin.js +59 -0
  31. package/amplify/plugins/signup/papyrus.plugin.ts +74 -0
  32. package/amplify/plugins/signup/schema.js +40 -0
  33. package/amplify/plugins/signup/schema.ts +41 -0
  34. package/amplify/plugins/signup/waf.js +48 -0
  35. package/amplify/plugins/signup/waf.ts +51 -0
  36. package/amplify/plugins/types.js +1 -0
  37. package/amplify/plugins/types.ts +39 -0
  38. package/amplify/plugins/wire.js +24 -0
  39. package/amplify/plugins/wire.ts +26 -0
  40. package/amplify/publication/default-publication.js +18 -0
  41. package/amplify/publication/default-publication.ts +20 -0
  42. package/amplify/publication/invalidation-alarm.js +26 -0
  43. package/amplify/publication/invalidation-alarm.ts +30 -0
  44. package/amplify/publication/redirect-and-index.js +37 -0
  45. package/amplify/publication/renditions-function.js +74 -0
  46. package/amplify/publication/renditions-function.ts +112 -0
  47. package/amplify/publication/renditions-settings.js +51 -0
  48. package/amplify/publication/renditions-settings.ts +58 -0
  49. package/amplify/publication/reproject-on-deploy.js +73 -0
  50. package/amplify/publication/reproject-on-deploy.ts +78 -0
  51. package/amplify/publication/s3-projection-settings.js +67 -0
  52. package/amplify/publication/s3-projection-settings.ts +101 -0
  53. package/amplify/publication/s3-projection.js +151 -0
  54. package/amplify/publication/s3-projection.ts +201 -0
  55. package/amplify/resolver-waves.js +26 -0
  56. package/amplify/resolver-waves.ts +34 -0
  57. package/amplify/revalidate-invalidation-settings.js +30 -0
  58. package/amplify/revalidate-invalidation-settings.ts +35 -0
  59. package/amplify/revalidate-secret-policy.js +13 -0
  60. package/amplify/revalidate-secret-policy.ts +19 -0
  61. package/amplify/site-backend-config.js +65 -1
  62. package/amplify/site-backend-config.ts +153 -2
  63. package/amplify/site-backend-names.js +103 -0
  64. package/amplify/site-backend-names.ts +166 -0
  65. package/amplify/site-backend.js +143 -176
  66. package/amplify/site-backend.ts +181 -201
  67. package/amplify/storage-backups/construct.js +31 -0
  68. package/amplify/storage-backups/construct.ts +47 -0
  69. package/app/[year]/[month]/[day]/[articleSlug]/page.tsx +8 -1
  70. package/app/[year]/[month]/[day]/edition-route-page.tsx +2 -0
  71. package/app/[year]/[month]/[day]/page/[pageNumber]/page.tsx +6 -1
  72. package/app/[year]/[month]/[day]/page.tsx +1 -1
  73. package/app/[year]/[month]/[day]/section/[sectionKey]/page.tsx +6 -1
  74. package/app/api/archive/editions/route.ts +1 -1
  75. package/app/api/cyclotron/priming-proof/route.ts +11 -0
  76. package/app/api/media/[...path]/route.ts +5 -16
  77. package/app/api/revalidate/route.ts +15 -7
  78. package/app/archive/page.tsx +1 -1
  79. package/app/articles/[slug]/page.tsx +7 -5
  80. package/app/blog-rhythm.css +278 -0
  81. package/app/cyclotron/page.tsx +13 -0
  82. package/app/globals.css +2 -0
  83. package/app/layout.tsx +16 -0
  84. package/app/newsroom/[section]/[...selection]/page.tsx +9 -6
  85. package/app/newsroom/[section]/page.tsx +6 -3
  86. package/app/newsroom/layout.tsx +4 -9
  87. package/app/newsroom/settings/page.tsx +6 -0
  88. package/app/newsroom/work/page.tsx +10 -0
  89. package/app/page.tsx +22 -8
  90. package/app/robots.ts +2 -5
  91. package/app/tailwind.css +1 -0
  92. package/bin/papyrus-infra.mjs +3 -3
  93. package/components/amplify-client-provider.tsx +5 -22
  94. package/components/archive-shell.tsx +2 -22
  95. package/components/article-video.tsx +152 -5
  96. package/components/blog-page-background.tsx +23 -6
  97. package/components/news-desk-page.tsx +4 -15
  98. package/components/news-desk-taxonomy-client.ts +90 -3
  99. package/components/newspaper.tsx +6 -2
  100. package/components/newsroom-access-gate.tsx +2 -1
  101. package/components/newsroom-board-view.tsx +99 -0
  102. package/components/newsroom-client-shell.tsx +12 -0
  103. package/components/newsroom-curation-provider.tsx +17 -0
  104. package/components/newsroom-fonts/playfair-display-700.ttf +0 -0
  105. package/components/newsroom-fonts/playfair-display-900.ttf +0 -0
  106. package/components/newsroom-fonts/playfair-display-OFL.txt +93 -0
  107. package/components/newsroom-fonts/plus-jakarta-sans-400.ttf +0 -0
  108. package/components/newsroom-fonts/plus-jakarta-sans-600.ttf +0 -0
  109. package/components/newsroom-fonts/plus-jakarta-sans-OFL.txt +93 -0
  110. package/components/newsroom-newsprint-board.css +48 -0
  111. package/components/newsroom-ops-overview.tsx +28 -11
  112. package/components/newsroom-ops-shell.tsx +7 -1
  113. package/components/newsroom-organizer-shell.tsx +130 -0
  114. package/components/newsroom-organizer.css +63 -0
  115. package/components/newsroom-references-view.tsx +92 -8
  116. package/components/papyrus-console-shell.tsx +4 -2
  117. package/components/pictogram-figure.tsx +9 -2
  118. package/components/presentation-header.tsx +135 -0
  119. package/components/presentation-rhythm-hrule.tsx +17 -0
  120. package/components/priming-proof-page.tsx +92 -0
  121. package/components/publication-cyclotron-panel.tsx +57 -0
  122. package/components/reader-auth-control.tsx +8 -5
  123. package/components/reference-curation-controls.tsx +77 -0
  124. package/components/reference-cyclotron-status.tsx +109 -0
  125. package/components/reference-priming.tsx +18 -0
  126. package/components/reference-relevance-review.tsx +75 -0
  127. package/components/settings-page.tsx +2 -1
  128. package/components/signup-entries-panel.tsx +94 -0
  129. package/components/topic-steering-workspace.tsx +78 -6
  130. package/components/use-blog-header-obstacles.ts +81 -0
  131. package/components/use-brand-fonts-ready.ts +28 -0
  132. package/components/use-near-viewport.ts +30 -0
  133. package/components/use-rhythm-overlay.ts +29 -0
  134. package/infra/amplify-app-shell.js +219 -71
  135. package/infra/amplify-app-shell.ts +231 -77
  136. package/infra/build-specs.js +23 -8
  137. package/infra/build-specs.ts +27 -11
  138. package/infra/site-config.js +277 -34
  139. package/infra/site-config.ts +340 -43
  140. package/lib/amplify-outputs-path.ts +5 -1
  141. package/lib/amplify-server-runtime.ts +36 -1
  142. package/lib/approved-priming-proof-reports.ts +6 -0
  143. package/lib/blog-feature-solver.ts +459 -0
  144. package/lib/blog-rhythm.ts +134 -0
  145. package/lib/brand-fonts-watch.ts +43 -0
  146. package/lib/brand-fonts.ts +112 -0
  147. package/lib/cached-content-repository.ts +12 -0
  148. package/lib/category-repository.ts +43 -93
  149. package/lib/content-item-lifecycle.ts +55 -0
  150. package/lib/content-repository.ts +3 -0
  151. package/lib/content-types.ts +4 -0
  152. package/lib/curation-client.ts +61 -0
  153. package/lib/edition-routes.ts +31 -29
  154. package/lib/graphql-content-repository.ts +56 -22
  155. package/lib/media-route-response.ts +45 -0
  156. package/lib/newspaper-layout.ts +3 -2
  157. package/lib/newsroom-base-path.ts +12 -3
  158. package/lib/newsroom-board.ts +99 -0
  159. package/lib/newsroom-category-drilldown.ts +3 -2
  160. package/lib/newsroom-forum-routes.ts +6 -4
  161. package/lib/newsroom-index-filters.ts +14 -10
  162. package/lib/newsroom-nav.ts +3 -1
  163. package/lib/newsroom-organizer-nav.ts +37 -0
  164. package/lib/newsroom-section-routing.ts +20 -0
  165. package/lib/oauth-redirect-priority.ts +40 -0
  166. package/lib/papyrus-web-locations.ts +7 -6
  167. package/lib/plugin-settings.ts +11 -0
  168. package/lib/presentation-footer.ts +3 -2
  169. package/lib/pretext-layout.ts +12 -3
  170. package/lib/priming-proof-report.ts +89 -0
  171. package/lib/prospectus-site-identity.ts +303 -0
  172. package/lib/publication-cyclotron.ts +74 -0
  173. package/lib/rate-limit-retry.ts +55 -0
  174. package/lib/reader-base-path.ts +24 -0
  175. package/lib/reader-cache-lifetime.ts +5 -0
  176. package/lib/reader-static-params.ts +85 -4
  177. package/lib/reader-storage-url.ts +9 -12
  178. package/lib/reference-policy.ts +5 -0
  179. package/lib/relevance-decisions.ts +103 -0
  180. package/lib/relevance-status.ts +63 -0
  181. package/lib/renderer.ts +7 -0
  182. package/lib/revalidate-prewarm.ts +53 -0
  183. package/lib/revalidate-secret.ts +59 -0
  184. package/lib/robots-policy.ts +14 -0
  185. package/lib/root-route-redirect.ts +16 -0
  186. package/lib/semantic-graph.ts +7 -0
  187. package/lib/shared-credentials-provider.ts +61 -0
  188. package/lib/signup-csv.ts +24 -0
  189. package/lib/site-brand.ts +59 -0
  190. package/lib/staging-gated-path.ts +23 -0
  191. package/lib/staging-preview-object.ts +21 -5
  192. package/lib/test-editor-override.ts +4 -0
  193. package/lib/video-loading.ts +22 -0
  194. package/lib/video-script.ts +14 -0
  195. package/middleware.ts +11 -19
  196. package/package.json +64 -1
  197. package/renderers/pretext/article-page.tsx +39 -3
  198. package/renderers/pretext/presentation-shared.tsx +113 -0
  199. package/renderers/pretext/presentation-shell.tsx +15 -102
  200. package/renderers/pretext/rhythm-article-page.tsx +165 -0
  201. package/renderers/pretext/rhythm-blog-presentation.tsx +279 -0
  202. package/renderers/pretext/rhythm-shell-style.ts +35 -0
  203. package/routes.manifest.json +68 -12
  204. package/src/sync.mjs +30 -6
  205. package/src/with-papyrus.d.mts +9 -0
  206. package/src/with-papyrus.mjs +48 -3
  207. package/amplify/functions/graphql-jwt-authorizer/handler.ts +0 -193
  208. package/amplify/functions/graphql-jwt-authorizer/resource.js +0 -14
  209. package/amplify/functions/graphql-jwt-authorizer/resource.ts +0 -15
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
 
3
+ import { newsroomHref } from "../lib/newsroom-base-path";
3
4
  import Link from "next/link";
4
5
  import { SITE_BRAND } from "../lib/site-brand";
5
6
  import type { NewsDeskShellState } from "../lib/news-desk-session";
@@ -32,7 +33,7 @@ export function NewsDeskAccessGate({ shell, showSectionTabs = false }: { shell:
32
33
  <p className="m-0 text-sm text-foreground">{formatAccessActionDetail(shell)}</p>
33
34
  {shell?.phase === "signedOut" || shell?.phase === "error" ? (
34
35
  <div className="news-desk-access-panel__auth">
35
- <ReaderAuthControl postAuthPath="/newsroom" showIdentity />
36
+ <ReaderAuthControl postAuthPath={newsroomHref()} showIdentity />
36
37
  </div>
37
38
  ) : null}
38
39
  </div>
@@ -0,0 +1,99 @@
1
+ "use client";
2
+
3
+ import { useEffect, useMemo, useRef, useState } from "react";
4
+ import Link from "next/link";
5
+ import { IssueCollection, IssueDetailPanel, IssueTypeFilter, issueTypeFromFilter } from "@kanbus/ui";
6
+ import "@kanbus/ui/styles/kanban.css";
7
+ import "./newsroom-newsprint-board.css";
8
+ import { canReadNewsroomBoard, newsroomBoardConfig, projectNewsroomBoard, type NativeBoardIssue } from "../lib/newsroom-board";
9
+ import { getContentItemName, SITE_BRAND } from "../lib/site-brand";
10
+ import { getNewsroomNavHref } from "../lib/newsroom-nav";
11
+ import { loadNewsroomAssignmentPage, loadNewsroomContentItemVersions, loadNewsroomReferencePage } from "./news-desk-taxonomy-client";
12
+ import { useOptionalNewsDeskClient } from "./news-desk-client-provider";
13
+ import { NewsDeskAccessGate } from "./newsroom-access-gate";
14
+ import { NewsroomOpsShell, NewsroomOpsStatusBanner } from "./newsroom-ops-shell";
15
+ import { useResolvedPapyrusTheme } from "./use-resolved-papyrus-theme";
16
+ import { readLocalReaderSettings, subscribeReaderSettingsChanges } from "./reader-settings";
17
+
18
+ const STATIC_MOTION = { mode: "static" } as const;
19
+
20
+ /** Read-only shared board over authenticated CMS records; existing workspaces own every mutation. */
21
+ export function NewsroomBoardView() {
22
+ const session = useOptionalNewsDeskClient();
23
+ const allowed = canReadNewsroomBoard(session?.shell.phase);
24
+ const theme = useResolvedPapyrusTheme();
25
+ const [lowMotion, setLowMotion] = useState(false);
26
+ const [issues, setIssues] = useState<NativeBoardIssue[]>([]);
27
+ const [filter, setFilter] = useState("all");
28
+ const [view, setView] = useState<"board" | "list">("board");
29
+ const [revision, setRevision] = useState(0);
30
+ const [selected, setSelected] = useState<string | null>(null);
31
+ const [loading, setLoading] = useState(false);
32
+ const [error, setError] = useState<string | null>(null);
33
+ const [tokens, setTokens] = useState<{ reference?: string | null; assignment?: string | null }>({});
34
+ const generation = useRef(0);
35
+ const busy = useRef(false);
36
+ useEffect(() => {
37
+ setLowMotion(readLocalReaderSettings().motion === "low");
38
+ return subscribeReaderSettingsChanges(settings => setLowMotion(settings.motion === "low"));
39
+ }, []);
40
+ useEffect(() => {
41
+ const request = ++generation.current;
42
+ busy.current = false;
43
+ setIssues([]); setSelected(null); setTokens({}); setError(null);
44
+ if (!allowed) { setLoading(false); return; }
45
+ setLoading(true); busy.current = true;
46
+ Promise.all([
47
+ loadNewsroomContentItemVersions(),
48
+ loadNewsroomReferencePage({ limit: 50 }),
49
+ loadNewsroomAssignmentPage({ limit: 50 }),
50
+ ]).then(([contentItemVersions, references, assignments]) => {
51
+ if (generation.current !== request) return;
52
+ setIssues(projectNewsroomBoard({ contentItemVersions, references: references.items, assignments: assignments.items }));
53
+ setTokens({ reference: references.nextToken, assignment: assignments.nextToken });
54
+ }).catch((reason: unknown) => {
55
+ if (generation.current === request) setError(reason instanceof Error ? reason.message : "Could not load newsroom records.");
56
+ }).finally(() => { if (generation.current === request) { setLoading(false); busy.current = false; } });
57
+ return () => { generation.current = request + 1; };
58
+ }, [allowed, revision]);
59
+ async function loadMore(kind: "reference" | "assignment") {
60
+ if (!allowed || busy.current || !tokens[kind]) return;
61
+ const request = generation.current;
62
+ busy.current = true; setLoading(true); setError(null);
63
+ try {
64
+ const added = kind === "reference"
65
+ ? await loadNewsroomReferencePage({ limit: 50, nextToken: tokens.reference }).then(page => ({ issues: projectNewsroomBoard({ references: page.items }), token: page.nextToken }))
66
+ : await loadNewsroomAssignmentPage({ limit: 50, nextToken: tokens.assignment }).then(page => ({ issues: projectNewsroomBoard({ assignments: page.items }), token: page.nextToken }));
67
+ if (generation.current !== request) return;
68
+ setIssues(current => [...new Map([...current, ...added.issues].map(issue => [issue.id, issue])).values()]);
69
+ setTokens(current => ({ ...current, [kind]: added.token }));
70
+ } catch (reason) {
71
+ if (generation.current === request) setError(reason instanceof Error ? reason.message : "Could not load more records.");
72
+ } finally { if (generation.current === request) { setLoading(false); busy.current = false; } }
73
+ }
74
+ const config = useMemo(() => newsroomBoardConfig(issues), [issues]);
75
+ const issue = issues.find(item => item.id === selected);
76
+ if (!allowed) return <NewsDeskAccessGate shell={session?.shell ?? null} />;
77
+ return <NewsroomOpsShell activeTab="work" appTitle={SITE_BRAND.appTitle} backLabel={SITE_BRAND.backToHomeLabel} pageTitle="Board">
78
+ <div className="organizer-native-board papyrus-newsprint-board" data-color-mode={theme}>
79
+ <div className="organizer-board-toolbar">
80
+ <IssueTypeFilter config={config} value={filter} onChange={value => { setFilter(value); setSelected(null); }} name="Record type" />
81
+ <div role="group" aria-label="Record presentation"><button type="button" aria-pressed={view === "board"} onClick={() => setView("board")}>Board</button><button type="button" aria-pressed={view === "list"} onClick={() => setView("list")}>List</button><button type="button" disabled={loading} onClick={() => setRevision(current => current + 1)}>Refresh records</button></div>
82
+ </div>
83
+ <p className="organizer-board-note">{`Each ${getContentItemName().singular.toLowerCase()} appears once, in the column for its stage. Open a record to use its existing editor or workflow controls.`}</p>
84
+ {error && <NewsroomOpsStatusBanner tone="error">{error}</NewsroomOpsStatusBanner>}
85
+ <p role="status" className="organizer-board-note">{loading ? "Loading records…" : `${issues.length} records loaded. References and assignments load in pages.`}</p>
86
+ <div className="organizer-board-body" data-detail-open={Boolean(issue)}>
87
+ <IssueCollection issues={issues} config={config} query={{ type: issueTypeFromFilter(filter) }} view={view}
88
+ motion={lowMotion ? STATIC_MOTION : undefined}
89
+ columnStateKey={`papyrus.cms.columns.v1.${SITE_BRAND.id}`} initialScroll="start"
90
+ selectedIssueId={selected} detailOpen={Boolean(issue)} onSelectIssue={item => setSelected(item.id)} ariaLabel="Newsroom records"
91
+ emptyMessage={loading ? "Loading records…" : error ? "Records could not be loaded." : "No records in this selection."} />
92
+ {issue && <IssueDetailPanel issue={issue} onClose={() => setSelected(null)} fields={[{ label: "CMS record ID", value: issue.nativeId }, { label: "Status", value: issue.nativeStatus }]}>
93
+ <Link href={getNewsroomNavHref(issue.href)}>Open {issue.type}</Link>
94
+ </IssueDetailPanel>}
95
+ </div>
96
+ <div className="organizer-board-pages">{tokens.reference && <button disabled={loading} type="button" onClick={() => void loadMore("reference")}>Load more references</button>}{tokens.assignment && <button disabled={loading} type="button" onClick={() => void loadMore("assignment")}>Load more assignments</button>}</div>
97
+ </div>
98
+ </NewsroomOpsShell>;
99
+ }
@@ -0,0 +1,12 @@
1
+ import { NewsDeskClientProvider } from "./news-desk-client-provider";
2
+ import { resolveDevSandboxEditorAuth } from "../lib/dev-sandbox-editor-auth";
3
+
4
+ export function NewsroomClientShell({ children }: Readonly<{ children: React.ReactNode }>) {
5
+ const devSandboxEditorAuth = resolveDevSandboxEditorAuth();
6
+
7
+ return (
8
+ <NewsDeskClientProvider devSandboxEditorAuth={devSandboxEditorAuth}>
9
+ {children}
10
+ </NewsDeskClientProvider>
11
+ );
12
+ }
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+
3
+ import {createContext,useContext,useMemo,useRef,type ReactNode} from 'react';
4
+ import {createCurationSession,requestCuration,type CurationBootstrap,type CurationRequest,type CurationSession} from '../lib/curation-client';
5
+ import type {PublicationScope} from '../lib/publication-cyclotron';
6
+
7
+ const Context=createContext<CurationSession|null>(null);
8
+
9
+ /** Host opt-in. Absence preserves the released CMS and performs no new reads. */
10
+ export function NewsroomCurationProvider({bootstrap,request=requestCuration,children}:{bootstrap:CurationBootstrap|null;request?:CurationRequest;children:ReactNode}){
11
+ const selected=useRef<PublicationScope|null>(bootstrap?.scope??null);
12
+ selected.current=bootstrap?.scope??null;
13
+ const session=useMemo(()=>bootstrap?createCurationSession(bootstrap,request,()=>selected.current):null,[bootstrap,request]);
14
+ return <Context.Provider value={session}>{children}</Context.Provider>;
15
+ }
16
+
17
+ export function useNewsroomCuration(){return useContext(Context);}
@@ -0,0 +1,93 @@
1
+ Copyright 2017 The Playfair Display Project Authors (https://github.com/clauseggers/Playfair-Display), with Reserved Font Name "Playfair Display"
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The Plus Jakarta Sans Project Authors (https://github.com/tokotype/PlusJakartaSans)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,48 @@
1
+ .papyrus-newsprint-board {
2
+ --background: var(--org-paper);
3
+ --card: var(--org-paper);
4
+ --frame: var(--org-paper);
5
+ --column: var(--org-paper);
6
+ --border: var(--org-line);
7
+ --text-foreground: var(--org-ink);
8
+ --text-muted: var(--org-muted);
9
+ --text-selected: var(--org-ink);
10
+ --font-body: Newsroom UI, system-ui, sans-serif;
11
+ --kb-column-width: 245px;
12
+ --kb-column-radius: 0;
13
+ --kb-card-radius: 0;
14
+ --kb-card-border-width: 0;
15
+ --kb-card-shadow: none;
16
+ --kb-card-selected-shadow: none;
17
+ --kb-board-gap: 18px;
18
+ color: var(--org-ink);
19
+ background: transparent;
20
+ }
21
+ .papyrus-newsprint-board .kb-grid { height: 100%; min-height: 0; scrollbar-width: thin; }
22
+ .papyrus-newsprint-board .kb-column { border-left: 1px solid var(--org-line); padding-left: 10px; }
23
+ .papyrus-newsprint-board .kb-column-header {
24
+ border-bottom: 2px solid var(--org-ink);
25
+ padding: 5px 0;
26
+ font: 700 12px Newsroom Display, Georgia, serif;
27
+ text-transform: uppercase;
28
+ letter-spacing: .6px;
29
+ min-height: 32px;
30
+ }
31
+ .papyrus-newsprint-board .issue-card {
32
+ --issue-accent: var(--org-paper) !important;
33
+ --issue-accent-muted: var(--muted) !important;
34
+ --issue-accent-foreground: var(--org-ink) !important;
35
+ --issue-priority-bg: var(--org-paper) !important;
36
+ background: transparent !important;
37
+ border-radius: 0;
38
+ border-bottom: 1px solid var(--org-line) !important;
39
+ box-shadow: none !important;
40
+ }
41
+ .papyrus-newsprint-board .issue-accent-bar { border-bottom: 1px solid var(--org-line); background: var(--org-paper) !important; color: var(--org-ink) !important; }
42
+ .papyrus-newsprint-board .issue-accent-id { font: 400 9px Newsroom UI, system-ui, sans-serif; letter-spacing: .8px; white-space: nowrap; color: var(--org-ink) !important; }
43
+ .papyrus-newsprint-board .issue-accent-priority { border-radius: 0; color: var(--org-muted) !important; background: transparent !important; font-size: 8px; }
44
+ .papyrus-newsprint-board .issue-card h3 { font: 700 19px/1.2 Newsroom Display, Georgia, serif !important; letter-spacing: -.2px; }
45
+ .papyrus-newsprint-board .issue-card[data-selected=true] { outline: 2px solid var(--org-ink); outline-offset: -2px; }
46
+ .papyrus-newsprint-board .issue-card[data-selected=true] h3 { color: var(--org-ink) !important; }
47
+ .papyrus-newsprint-board .kb-issue-detail { background: var(--org-paper); border: 1px solid var(--org-line); border-radius: 0; box-shadow: none; }
48
+ .papyrus-newsprint-board .kb-issue-detail h2 { font: 700 28px/1.2 Newsroom Display, Georgia, serif; border-bottom: 3px double var(--org-ink); padding-bottom: 12px; }
@@ -3,8 +3,13 @@
3
3
  import {
4
4
  BookOpenIcon,
5
5
  ClipboardListIcon,
6
+ FileTextIcon,
6
7
  LayersIcon,
8
+ LightbulbIcon,
7
9
  MessageSquareIcon,
10
+ NetworkIcon,
11
+ SearchIcon,
12
+ SettingsIcon,
8
13
  } from "lucide-react";
9
14
  import Link from "next/link";
10
15
  import { usePathname } from "next/navigation";
@@ -12,7 +17,7 @@ import { useMemo } from "react";
12
17
  import { Badge } from "./ui/badge";
13
18
  import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./ui/card";
14
19
  import type { AssignmentRecord, MessageRecord, NewsroomSectionRecord, ReferenceRecord } from "../lib/category-repository";
15
- import { getNewsroomNavHref } from "../lib/newsroom-nav";
20
+ import { getNewsroomNavHref, NEWSROOM_OPS_NAV, type NewsroomNavTabId } from "../lib/newsroom-nav";
16
21
  import {
17
22
  countReferencesByStatus,
18
23
  filterReferencesByStatus,
@@ -37,15 +42,28 @@ type NewsroomOpsOverviewProps = {
37
42
  references: ReferenceRecord[];
38
43
  };
39
44
 
40
- type DestinationKey = "references" | "assignments" | "messages" | "topics";
45
+ type DestinationKey = Exclude<NewsroomNavTabId, "overview" | "desks">;
41
46
 
42
- const DESTINATION_META: Record<DestinationKey, { label: string; detail: string; href: string; icon: typeof BookOpenIcon }> = {
43
- references: { label: "References", detail: "Source intake", href: "/newsroom/references", icon: BookOpenIcon },
44
- assignments: { label: "Assignments", detail: "Work queue", href: "/newsroom/assignments", icon: ClipboardListIcon },
45
- messages: { label: "Messages", detail: "Team threads", href: "/newsroom/messages", icon: MessageSquareIcon },
46
- topics: { label: "Topics", detail: "Taxonomy", href: "/newsroom/topics", icon: LayersIcon },
47
+ const DESTINATION_ICONS: Record<DestinationKey, typeof BookOpenIcon> = {
48
+ articles: FileTextIcon,
49
+ assignments: ClipboardListIcon,
50
+ references: BookOpenIcon,
51
+ messages: MessageSquareIcon,
52
+ insights: LightbulbIcon,
53
+ topics: LayersIcon,
54
+ concepts: NetworkIcon,
55
+ administration: SettingsIcon,
56
+ search: SearchIcon,
47
57
  };
48
58
 
59
+ const DESTINATIONS = NEWSROOM_OPS_NAV.filter((item) => item.id !== "overview").map((item) => ({
60
+ key: item.id as DestinationKey,
61
+ label: item.label,
62
+ detail: item.detail,
63
+ href: item.href,
64
+ icon: DESTINATION_ICONS[item.id as DestinationKey],
65
+ }));
66
+
49
67
  function openAssignmentCount(assignments: AssignmentRecord[]): number {
50
68
  return assignments.filter((assignment) => {
51
69
  const status = assignment.status?.trim().toLowerCase() ?? "";
@@ -85,11 +103,10 @@ export function NewsroomOpsOverview({
85
103
  [newsroomSections],
86
104
  );
87
105
 
88
- const destinationCounts: Record<DestinationKey, number | null> = {
106
+ const destinationCounts: Partial<Record<DestinationKey, number | null>> = {
89
107
  references: referenceCounts.pending ?? 0,
90
108
  assignments: openAssignmentCount(assignments),
91
109
  messages: recentMessageCount(messages),
92
- topics: null,
93
110
  };
94
111
 
95
112
  return (
@@ -102,8 +119,8 @@ export function NewsroomOpsOverview({
102
119
  <section aria-label="Destinations" className="space-y-3">
103
120
  <h2 className="text-sm font-medium text-muted-foreground">Go to</h2>
104
121
  <div className="grid grid-cols-2 gap-3 sm:grid-cols-4">
105
- {(Object.keys(DESTINATION_META) as DestinationKey[]).map((key) => {
106
- const meta = DESTINATION_META[key];
122
+ {DESTINATIONS.map((meta) => {
123
+ const key = meta.key;
107
124
  const Icon = meta.icon;
108
125
  const count = destinationCounts[key];
109
126
  const href = getNewsroomNavHref(meta.href, demo);
@@ -34,6 +34,8 @@ import {
34
34
  NEWSROOM_SIDEBAR_NAV_INACTIVE,
35
35
  } from "../lib/newsroom-list-selection";
36
36
  import { cn } from "../lib/utils";
37
+ import { SITE_BRAND } from "../lib/site-brand";
38
+ import { NewsroomOrganizerShell } from "./newsroom-organizer-shell";
37
39
 
38
40
  export type NewsroomNavCount = {
39
41
  count: number | null;
@@ -41,7 +43,7 @@ export type NewsroomNavCount = {
41
43
  visible?: boolean;
42
44
  };
43
45
 
44
- type NewsroomOpsShellProps = {
46
+ export type NewsroomOpsShellProps = {
45
47
  activeTab: NewsroomNavTabId | string;
46
48
  appTitle: string;
47
49
  backHref?: string;
@@ -136,6 +138,10 @@ export function NewsroomOpsShell({
136
138
  const resolvedActiveTab = activeTab === "desks" ? "topics" : activeTab;
137
139
  const mobilePrimary = useMemo(() => NEWSROOM_MOBILE_PRIMARY_NAV, []);
138
140
 
141
+ if (SITE_BRAND.newsroomLayout === "organizer") return <NewsroomOrganizerShell activeTab={activeTab} appTitle={appTitle}
142
+ backHref={backHref} backLabel={backLabel} demo={demo} headerActions={headerActions} pageTitle={pageTitle}
143
+ showNavigation={showNavigation} tabCounts={tabCounts}>{children}</NewsroomOrganizerShell>;
144
+
139
145
  return (
140
146
  <div
141
147
  className="flex h-dvh max-h-dvh flex-col overflow-hidden bg-background text-foreground"
@@ -0,0 +1,130 @@
1
+ "use client";
2
+
3
+ import { useEffect, useId, useState } from "react";
4
+ import Link from "next/link";
5
+ import { usePathname } from "next/navigation";
6
+ import { BookOpen, ClipboardList, LayoutDashboard, Menu, MessagesSquare, PanelLeftClose, PanelLeftOpen, Settings, UserRound, LogIn, LogOut } from "lucide-react";
7
+ import { ORGANIZER_NAV_GROUPS, ORGANIZER_PRIMARY_NAV, ORGANIZER_SETTINGS_DESTINATION } from "../lib/newsroom-organizer-nav";
8
+ import { browserPathToInternalNewsroomPath } from "../lib/newsroom-base-path";
9
+ import { getNewsroomNavHref } from "../lib/newsroom-nav";
10
+ import { SITE_BRAND } from "../lib/site-brand";
11
+ import { useOptionalNewsDeskClient } from "./news-desk-client-provider";
12
+ import { ReaderAuthControl } from "./reader-auth-control";
13
+ import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription, SheetTrigger } from "./ui/sheet";
14
+ import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator } from "./ui/dropdown-menu";
15
+ import type { NewsroomOpsShellProps } from "./newsroom-ops-shell";
16
+ import "./newsroom-organizer.css";
17
+
18
+ const ICONS = { overview: LayoutDashboard, board: ClipboardList, references: BookOpen, messages: MessagesSquare };
19
+
20
+ /** Navigation is a presentation layer; existing route and server authorization still own access. */
21
+ function Navigation({ activePath, demo, admin, surface, onNavigate }: { activePath: string; demo: boolean; admin: boolean; surface: string; onNavigate?: () => void }) {
22
+ const id = useId();
23
+ const all = ORGANIZER_NAV_GROUPS.flatMap(group => group.items);
24
+ const active = all.filter(item => activePath === item.path || (item.path !== "/newsroom" && activePath.startsWith(item.path + "/"))).sort((a, b) => b.path.length - a.path.length)[0]?.key;
25
+ return <nav className="organizer-destinations" aria-label={surface === "sidebar" ? "Newsroom" : "All workspaces"}>
26
+ {ORGANIZER_NAV_GROUPS.map((group, index) => <section key={group.title} aria-labelledby={`${id}-${index}`}>
27
+ <h3 id={`${id}-${index}`}>{group.title}</h3>
28
+ {group.items.filter(item => item.access !== "admin" || admin).map(item => <Link key={item.key}
29
+ href={getNewsroomNavHref(item.path, demo)} onClick={onNavigate} aria-label={item.label}
30
+ aria-current={active === item.key ? "page" : undefined} aria-describedby={`${id}-${item.key}`}
31
+ data-news-desk-tab={item.key}>
32
+ <strong>{item.label}</strong><small id={`${id}-${item.key}`}>{item.description}</small>
33
+ </Link>)}
34
+ </section>)}
35
+ </nav>;
36
+ }
37
+
38
+ function Account({ placement }: { placement: "sidebar" | "header" }) {
39
+ const session = useOptionalNewsDeskClient();
40
+ const auth = session?.shell.auth ?? { status: "loading" as const, label: "Checking sign-in" };
41
+ const [open, setOpen] = useState(false);
42
+ useEffect(() => {
43
+ const media = matchMedia("(max-width: 900px)");
44
+ const close = () => setOpen(false);
45
+ media.addEventListener("change", close);
46
+ return () => media.removeEventListener("change", close);
47
+ }, []);
48
+ return <DropdownMenu open={open} onOpenChange={setOpen}>
49
+ <DropdownMenuTrigger className={`organizer-account organizer-account-${placement}`} aria-label="Account menu" title="Account menu">
50
+ <UserRound size={18} aria-hidden="true" /><span><strong>{auth.label}</strong><small>{auth.status === "signedIn" ? "Account & preferences" : auth.status === "signedOut" ? "Not signed in" : "Checking session"}</small></span>
51
+ </DropdownMenuTrigger>
52
+ <DropdownMenuContent className="organizer-account-popup" side={placement === "sidebar" ? "top" : "bottom"} align="end">
53
+ <DropdownMenuGroup>
54
+ <DropdownMenuLabel>{auth.label}</DropdownMenuLabel><DropdownMenuSeparator />
55
+ <DropdownMenuItem render={<Link href={getNewsroomNavHref(ORGANIZER_SETTINGS_DESTINATION.path)} />}><Settings aria-hidden="true" />{ORGANIZER_SETTINGS_DESTINATION.label}</DropdownMenuItem>
56
+ <ReaderAuthControl authState={auth} renderAction={({ disabled, onClick, signedIn }) => <DropdownMenuItem disabled={disabled} closeOnClick={false} onClick={onClick}>
57
+ {signedIn ? <LogOut aria-hidden="true" /> : <LogIn aria-hidden="true" />}{signedIn ? "Sign out" : "Sign in"}
58
+ </DropdownMenuItem>} />
59
+ </DropdownMenuGroup>
60
+ </DropdownMenuContent>
61
+ </DropdownMenu>;
62
+ }
63
+
64
+ export function NewsroomOrganizerShell({ activeTab, appTitle, backHref = "/", backLabel, children, demo = false, headerActions, pageTitle, showNavigation = true }: NewsroomOpsShellProps) {
65
+ const pathname = usePathname();
66
+ const session = useOptionalNewsDeskClient();
67
+ const admin = demo || session?.shell.dashboard?.canManageUsers === true;
68
+ const [menuOpen, setMenuOpen] = useState(false);
69
+ const [collapsed, setCollapsed] = useState(false);
70
+ const [loadedPreference, setLoadedPreference] = useState(false);
71
+ const preferenceKey = `papyrus.cms.sidebar.v1.${SITE_BRAND.id}`;
72
+ useEffect(() => {
73
+ try { setCollapsed(localStorage.getItem(preferenceKey) === "true"); } catch { /* Optional browser preference. */ }
74
+ setLoadedPreference(true);
75
+ }, [preferenceKey]);
76
+ useEffect(() => { if (loadedPreference) try { localStorage.setItem(preferenceKey, String(collapsed)); } catch { /* Controls still work without storage. */ } }, [collapsed, loadedPreference, preferenceKey]);
77
+ useEffect(() => { setMenuOpen(false); }, [pathname]);
78
+ useEffect(() => {
79
+ const media = matchMedia("(max-width: 900px)");
80
+ let previousFocus: Element | null = null;
81
+ let frame = 0;
82
+ const remember = () => { if (document.activeElement !== document.body) previousFocus = document.activeElement; };
83
+ const change = () => {
84
+ const active = document.activeElement === document.body ? previousFocus : document.activeElement;
85
+ if (!(active instanceof HTMLElement)) return;
86
+ if (!media.matches) setMenuOpen(false);
87
+ const selector = active.closest(".organizer-account, .organizer-account-popup") ? ".organizer-account"
88
+ : media.matches && active.closest(".organizer-sidebar, .organizer-toggle") ? ".organizer-more"
89
+ : !media.matches && active.closest(".organizer-bottom-nav, .organizer-menu") ? ".organizer-toggle" : null;
90
+ if (!selector) return;
91
+ cancelAnimationFrame(frame);
92
+ frame = requestAnimationFrame(() => {
93
+ if (document.activeElement === active || document.activeElement === document.body || !(document.activeElement as HTMLElement)?.getClientRects().length)
94
+ Array.from(document.querySelectorAll<HTMLElement>(selector)).find(element => element.getClientRects().length)?.focus();
95
+ });
96
+ };
97
+ document.addEventListener("focusin", remember);
98
+ media.addEventListener("change", change);
99
+ return () => { document.removeEventListener("focusin", remember); media.removeEventListener("change", change); cancelAnimationFrame(frame); };
100
+ }, []);
101
+ const activePath = browserPathToInternalNewsroomPath(pathname ?? "/newsroom");
102
+ return <div className="newsroom-organizer" data-news-desk data-newsroom-ops-shell="true" data-newsroom-chrome="organizer" data-sidebar-collapsed={collapsed || !showNavigation ? "true" : "false"}>
103
+ {showNavigation && <aside className="organizer-sidebar" hidden={collapsed} id="organizer-sidebar">
104
+ <Link className="organizer-brand" href={getNewsroomNavHref("/newsroom", demo)}>{appTitle}<small>The newsroom</small></Link>
105
+ <Navigation activePath={activePath} demo={demo} admin={admin} surface="sidebar" />
106
+ <Account placement="sidebar" />
107
+ </aside>}
108
+ <div className="organizer-workspace">
109
+ <header className="organizer-topbar" data-newsroom-ops-topbar>
110
+ {showNavigation && <button type="button" className="organizer-toggle" title={collapsed ? "Expand sidebar" : "Collapse sidebar"}
111
+ aria-label={collapsed ? "Expand sidebar" : "Collapse sidebar"} aria-expanded={!collapsed} aria-controls="organizer-sidebar" onClick={() => setCollapsed(value => !value)}>
112
+ {collapsed ? <PanelLeftOpen size={16} aria-hidden="true" /> : <PanelLeftClose size={16} aria-hidden="true" />}<span>{collapsed ? "Expand sidebar" : "Collapse sidebar"}</span>
113
+ </button>}
114
+ <Link className="organizer-masthead" href={backHref} title={backLabel}>{appTitle}</Link>
115
+ <h1 data-newsroom-ops-title>{pageTitle}</h1><div className="organizer-header-actions">{headerActions}</div><Account placement="header" />
116
+ </header>
117
+ <main className="organizer-main">{demo && <p className="organizer-demo-notice">Demo workspace · synthetic examples</p>}{children}</main>
118
+ </div>
119
+ {showNavigation && <nav className="organizer-bottom-nav" aria-label="Primary newsroom navigation"><ul>
120
+ {ORGANIZER_PRIMARY_NAV.map(item => { const Icon = ICONS[item.key as keyof typeof ICONS]; return <li key={item.key}><Link
121
+ href={getNewsroomNavHref(item.path, demo)} title={item.description} aria-label={item.label} aria-current={activeTab === item.key || activeTab === "work" && item.key === "board" ? "page" : undefined}>
122
+ <Icon size={18} aria-hidden="true" /><span>{item.label}</span></Link></li>; })}
123
+ <li><Sheet open={menuOpen} onOpenChange={setMenuOpen}><SheetTrigger className="organizer-more" aria-label="More"><Menu size={18} aria-hidden="true" /><span>More</span></SheetTrigger>
124
+ <SheetContent side="bottom" className="organizer-menu"><SheetHeader><SheetTitle>Newsroom</SheetTitle><SheetDescription>Workspaces and administration</SheetDescription></SheetHeader>
125
+ <Navigation activePath={activePath} demo={demo} admin={admin} surface="menu" onNavigate={() => setMenuOpen(false)} />
126
+ </SheetContent>
127
+ </Sheet></li>
128
+ </ul></nav>}
129
+ </div>;
130
+ }