@dino-ovum/theme 0.0.0-stage → 0.1.1

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 (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -2
  3. package/package.json +36 -3
  4. package/src/app/Root.jsx +5 -0
  5. package/src/app/components/DocumentCategoryPage.jsx +21 -0
  6. package/src/app/components/DocumentPagination.jsx +58 -0
  7. package/src/app/components/DocumentTable.jsx +116 -0
  8. package/src/app/components/ErrorPageContent.jsx +36 -0
  9. package/src/app/components/HomeHeading.jsx +34 -0
  10. package/src/app/components/LibraryLayout.jsx +36 -0
  11. package/src/app/components/NotFoundContent.jsx +24 -0
  12. package/src/app/components/SpaceOverview.jsx +17 -0
  13. package/src/app/components/StatusPage.jsx +54 -0
  14. package/src/app/components/Updates.jsx +137 -0
  15. package/src/app/components/navigation/Breadcrumbs.jsx +52 -0
  16. package/src/app/components/navigation/ColorModeToggle.jsx +66 -0
  17. package/src/app/components/navigation/LanguageDropdown.jsx +108 -0
  18. package/src/app/components/navigation/LibraryNavigation.jsx +20 -0
  19. package/src/app/components/navigation/MobileNavigation.jsx +12 -0
  20. package/src/app/components/navigation/RecentUpdatesLink.jsx +36 -0
  21. package/src/app/components/navigation/SidebarToggle.jsx +60 -0
  22. package/src/app/components/ui/DocumentDate.jsx +25 -0
  23. package/src/app/components/ui/FilterChip.jsx +14 -0
  24. package/src/app/components/ui/TopicBadge.jsx +14 -0
  25. package/src/app/hooks/useDocumentTable.js +60 -0
  26. package/src/app/hooks/useUpdates.js +23 -0
  27. package/src/app/logic/document-breadcrumbs.js +24 -0
  28. package/src/app/logic/document-dates.js +19 -0
  29. package/src/app/logic/document-list.js +15 -0
  30. package/src/app/logic/document-location.js +19 -0
  31. package/src/app/logic/document-taxonomy.js +10 -0
  32. package/src/app/logic/pagination.js +24 -0
  33. package/src/app/logic/update-groups.js +18 -0
  34. package/src/app/providers/AppProviders.jsx +5 -0
  35. package/src/app/providers/SidebarVisibility.jsx +19 -0
  36. package/src/app/routes.js +15 -0
  37. package/src/app/styles/components/DocumentCategoryPage.module.scss +50 -0
  38. package/src/app/styles/components/DocumentPagination.module.scss +45 -0
  39. package/src/app/styles/components/DocumentTable.module.scss +188 -0
  40. package/src/app/styles/components/LibraryLayout.module.scss +59 -0
  41. package/src/app/styles/components/StatusPage.module.scss +55 -0
  42. package/src/app/styles/components/Updates.module.scss +102 -0
  43. package/src/app/styles/components/navigation/Breadcrumbs.module.scss +5 -0
  44. package/src/app/styles/components/navigation/LanguageDropdown.module.scss +49 -0
  45. package/src/app/styles/components/navigation/MobileNavigation.module.scss +5 -0
  46. package/src/app/styles/components/navigation/NavigationControls.module.scss +70 -0
  47. package/src/app/styles/components/ui/FilterChip.module.scss +28 -0
  48. package/src/app/styles/components/ui/TopicBadge.module.scss +42 -0
  49. package/src/app/styles/custom.scss +7 -0
  50. package/src/app/styles/globals.css +64 -0
  51. package/src/app/styles/pages/home.scss +92 -0
  52. package/src/app/styles/theme/navigation.scss +56 -0
  53. package/src/app/styles/theme/tags.css +21 -0
  54. package/src/app/styles/tokens/_breakpoints.scss +4 -0
  55. package/src/app/styles/tokens/colors.css +62 -0
  56. package/src/app/styles/tokens/layout.css +20 -0
  57. package/src/app/styles/tokens/typography.css +11 -0
  58. package/src/assets/fonts/pretendard/LICENSE +94 -0
  59. package/src/assets/fonts/pretendard/PretendardStd-Bold.woff2 +0 -0
  60. package/src/assets/fonts/pretendard/README.md +8 -0
  61. package/src/index.js +48 -0
  62. package/src/theme/ColorModeToggle/index.jsx +1 -0
  63. package/src/theme/DinoOvum/DocumentTable.jsx +1 -0
  64. package/src/theme/DinoOvum/HomeHeading.jsx +1 -0
  65. package/src/theme/DinoOvum/LibraryLayout.jsx +1 -0
  66. package/src/theme/DinoOvum/Updates.jsx +1 -0
  67. package/src/theme/DinoOvum/UpdatesPage.jsx +20 -0
  68. package/src/theme/DocBreadcrumbs/index.jsx +1 -0
  69. package/src/theme/DocCardList/index.jsx +18 -0
  70. package/src/theme/DocItem/Layout/index.jsx +17 -0
  71. package/src/theme/DocRoot/Layout/index.jsx +1 -0
  72. package/src/theme/DocSidebarItem/Category/index.jsx +15 -0
  73. package/src/theme/ErrorPageContent.jsx +1 -0
  74. package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.jsx +1 -0
  75. package/src/theme/Navbar/Search/index.jsx +13 -0
  76. package/src/theme/NavbarItem/ComponentTypes.jsx +11 -0
  77. package/src/theme/NotFound/Content/index.jsx +1 -0
  78. package/src/theme/Root.jsx +1 -0
  79. package/src/translations/ja.json +107 -0
  80. package/src/translations/ko.json +107 -0
  81. package/src/utils.js +4 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 4BFC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,23 @@
1
- # Temporary Holding Version
1
+ # @dino-ovum/theme
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Shared Docusaurus components, styles, fonts, and UI translations for Dino Ovum.
4
+
5
+ Use through `@dino-ovum/preset`, which registers the base theme and shared data plugins. Adding this theme alone does not configure document navigation or search.
6
+
7
+ Public components for MDX and custom pages:
8
+
9
+ ```jsx
10
+ import HomeHeading from '@theme/DinoOvum/HomeHeading';
11
+ import DocumentTable from '@theme/DinoOvum/DocumentTable';
12
+ import LibraryLayout from '@theme/DinoOvum/LibraryLayout';
13
+ import Updates from '@theme/DinoOvum/Updates';
14
+ import UpdatesPage from '@theme/DinoOvum/UpdatesPage';
15
+ ```
16
+
17
+ Pass `customCss` to the preset to load site styles after the shared theme. Override individual components in your site's `src/theme/`; use `@theme-original` there to wrap the package implementation.
18
+
19
+ Korean and Japanese UI messages are bundled; English messages are provided by the components. Site `code.json` translations override defaults. Existing `docnest.*` message IDs are retained for migration compatibility.
20
+
21
+ Pure route, date, and document-location helpers are exported from `@dino-ovum/theme/utils` for build-time integration. Internal `src/app` paths are not public API.
22
+
23
+ MIT. The bundled Pretendard font retains its license in `src/assets/fonts/pretendard/LICENSE`.
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
+ "version": "0.1.1",
3
+ "type": "module",
4
+ "license": "MIT",
5
+ "author": "4BFC",
6
+ "engines": {
7
+ "node": ">=24.22.1 <25"
8
+ },
9
+ "files": [
10
+ "src",
11
+ "LICENSE",
12
+ "README.md"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/4BFC/dino-ovum.git"
20
+ },
2
21
  "name": "@dino-ovum/theme",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
22
+ "description": "Shared Docusaurus components and styles for Dino Ovum.",
23
+ "main": "./src/index.js",
24
+ "exports": {
25
+ ".": "./src/index.js",
26
+ "./utils": "./src/utils.js",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "dependencies": {
30
+ "@docusaurus/plugin-content-docs": "3.10.1",
31
+ "@docusaurus/theme-common": "3.10.1",
32
+ "clsx": "^2.0.0"
33
+ },
34
+ "peerDependencies": {
35
+ "@docusaurus/core": "3.10.1",
36
+ "react": "^19.0.0",
37
+ "react-dom": "^19.0.0"
38
+ }
6
39
  }
@@ -0,0 +1,5 @@
1
+ import AppProviders from './providers/AppProviders.jsx';
2
+
3
+ export default function Root({children}) {
4
+ return <AppProviders>{children}</AppProviders>;
5
+ }
@@ -0,0 +1,21 @@
1
+ import DocBreadcrumbs from './navigation/Breadcrumbs.jsx';
2
+ import Heading from '@theme/Heading';
3
+ import DocumentTable from './DocumentTable.jsx';
4
+ import styles from '../styles/components/DocumentCategoryPage.module.scss';
5
+
6
+ export default function DocumentCategoryPage({directory, title, description}) {
7
+ return (
8
+ <section className={styles['library-category-page']}>
9
+ <header className={styles['library-category-page__header']}>
10
+ <DocBreadcrumbs />
11
+ <Heading as="h1">{title}</Heading>
12
+ <p>{description}</p>
13
+ </header>
14
+ <DocumentTable
15
+ key={directory}
16
+ directory={directory}
17
+ fill
18
+ />
19
+ </section>
20
+ );
21
+ }
@@ -0,0 +1,58 @@
1
+ import Link from '@docusaurus/Link';
2
+ import {translate} from '@docusaurus/Translate';
3
+ import styles from '../styles/components/DocumentPagination.module.scss';
4
+
5
+ export default function DocumentPagination({page, pages, numbers, pageUrl}) {
6
+ return (
7
+ <nav
8
+ className={styles['library-pagination']}
9
+ aria-label={translate({id: 'docnest.pagination', message: 'Document pages'})}
10
+ >
11
+ {page === 1 ? (
12
+ <button
13
+ type="button"
14
+ disabled
15
+ aria-label={translate({id: 'docnest.pagination.previous', message: 'Previous page'})}
16
+ >
17
+ ‹
18
+ </button>
19
+ ) : (
20
+ <Link
21
+ to={pageUrl(page - 1)}
22
+ aria-label={translate({id: 'docnest.pagination.previous', message: 'Previous page'})}
23
+ >
24
+ ‹
25
+ </Link>
26
+ )}
27
+ {numbers.map((number) => (
28
+ <Link
29
+ key={number}
30
+ to={pageUrl(number)}
31
+ aria-label={translate(
32
+ {id: 'docnest.pagination.page', message: 'Page {number}'},
33
+ {number},
34
+ )}
35
+ aria-current={page === number ? 'page' : undefined}
36
+ >
37
+ {number}
38
+ </Link>
39
+ ))}
40
+ {page === pages ? (
41
+ <button
42
+ type="button"
43
+ disabled
44
+ aria-label={translate({id: 'docnest.pagination.next', message: 'Next page'})}
45
+ >
46
+ ›
47
+ </button>
48
+ ) : (
49
+ <Link
50
+ to={pageUrl(page + 1)}
51
+ aria-label={translate({id: 'docnest.pagination.next', message: 'Next page'})}
52
+ >
53
+ ›
54
+ </Link>
55
+ )}
56
+ </nav>
57
+ );
58
+ }
@@ -0,0 +1,116 @@
1
+ import Link from '@docusaurus/Link';
2
+ import {translate} from '@docusaurus/Translate';
3
+ import clsx from 'clsx';
4
+ import TopicBadge from './ui/TopicBadge.jsx';
5
+ import DocumentDate from './ui/DocumentDate.jsx';
6
+ import DocumentPagination from './DocumentPagination.jsx';
7
+ import {documentTaxonomy} from '../logic/document-taxonomy.js';
8
+ import useDocumentTable from '../hooks/useDocumentTable.js';
9
+ import styles from '../styles/components/DocumentTable.module.scss';
10
+
11
+ export default function DocumentTable({directory, fill = false}) {
12
+ const {documents, page, pages, start, end, numbers, pageUrl, tableAreaRef, headRef, firstRowRef} =
13
+ useDocumentTable(directory);
14
+
15
+ return (
16
+ <section
17
+ className={clsx(
18
+ styles['library-document-list'],
19
+ fill && styles['library-document-list--fill'],
20
+ )}
21
+ aria-label={translate(
22
+ {id: 'docnest.documents.in', message: 'Documents in {directory}'},
23
+ {directory},
24
+ )}
25
+ >
26
+ <div className={styles['library-document-list__toolbar']}>
27
+ <h2>
28
+ {translate({id: 'docnest.all', message: 'All'})} <span>{documents.length}</span>
29
+ </h2>
30
+ <span role="status">
31
+ {documents.length
32
+ ? translate(
33
+ {id: 'docnest.documents.count', message: '{start}–{end} of {total}'},
34
+ {start: start + 1, end, total: documents.length},
35
+ )
36
+ : translate({id: 'docnest.documents.empty', message: 'No documents'})}
37
+ </span>
38
+ </div>
39
+ <div
40
+ className={styles['library-document-list__table-area']}
41
+ ref={tableAreaRef}
42
+ >
43
+ <table className={styles['library-document-table']}>
44
+ <caption className={styles['library-document-table__caption']}>
45
+ {translate(
46
+ {id: 'docnest.documents.caption', message: 'All documents in {directory}'},
47
+ {directory},
48
+ )}
49
+ </caption>
50
+ <thead ref={headRef}>
51
+ <tr>
52
+ <th scope="col">{translate({id: 'docnest.document', message: 'Document'})}</th>
53
+ <th
54
+ scope="col"
55
+ className={styles['library-document-table__directory']}
56
+ >
57
+ {translate({id: 'docnest.category', message: 'Category'})}
58
+ </th>
59
+ <th
60
+ scope="col"
61
+ className={styles['library-document-table__updated']}
62
+ >
63
+ {translate({id: 'docnest.updated', message: 'Updated'})}
64
+ </th>
65
+ </tr>
66
+ </thead>
67
+ <tbody>
68
+ {documents.slice(start, end).map((doc, index) => {
69
+ const {category, topic, tone} = documentTaxonomy(doc.directory);
70
+ return (
71
+ <tr
72
+ key={doc.href}
73
+ ref={index === 0 ? firstRowRef : undefined}
74
+ >
75
+ <td>
76
+ <Link
77
+ to={doc.href}
78
+ className={styles['library-document-table__link']}
79
+ title={doc.title}
80
+ >
81
+ <span className={styles['library-document-table__title-line']}>
82
+ <span className={styles['library-document-table__title']}>{doc.title}</span>
83
+ <TopicBadge
84
+ className={styles['library-document-table__badge']}
85
+ tone={tone}
86
+ title={doc.directory}
87
+ >
88
+ {topic}
89
+ </TopicBadge>
90
+ </span>
91
+ <small className={styles['library-document-table__mobile-directory']}>
92
+ {category}
93
+ </small>
94
+ </Link>
95
+ </td>
96
+ <td className={styles['library-document-table__directory']}>
97
+ <span>{category}</span>
98
+ </td>
99
+ <td className={styles['library-document-table__updated']}>
100
+ <DocumentDate value={doc.updated} />
101
+ </td>
102
+ </tr>
103
+ );
104
+ })}
105
+ </tbody>
106
+ </table>
107
+ </div>
108
+ <DocumentPagination
109
+ page={page}
110
+ pages={pages}
111
+ numbers={numbers}
112
+ pageUrl={pageUrl}
113
+ />
114
+ </section>
115
+ );
116
+ }
@@ -0,0 +1,36 @@
1
+ import Translate from '@docusaurus/Translate';
2
+ import styles from '../styles/components/StatusPage.module.scss';
3
+ import StatusPage from './StatusPage.jsx';
4
+
5
+ export default function ErrorPageContent({error, tryAgain}) {
6
+ return (
7
+ <StatusPage
8
+ title={<Translate id="docnest.error.title">Page Error</Translate>}
9
+ description={
10
+ <p>
11
+ <Translate id="docnest.error.description">
12
+ We couldn't display this page. Try again, or head back home.
13
+ </Translate>
14
+ </p>
15
+ }
16
+ actions={
17
+ <button
18
+ type="button"
19
+ className="button button--primary"
20
+ onClick={tryAgain}
21
+ >
22
+ <Translate id="docnest.error.retry">Try again</Translate>
23
+ </button>
24
+ }
25
+ >
26
+ {error && (
27
+ <details className={styles.details}>
28
+ <summary>
29
+ <Translate id="docnest.error.details">Error details</Translate>
30
+ </summary>
31
+ <pre>{error.message}</pre>
32
+ </details>
33
+ )}
34
+ </StatusPage>
35
+ );
36
+ }
@@ -0,0 +1,34 @@
1
+ import useBaseUrl from '@docusaurus/useBaseUrl';
2
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
3
+ import {useThemeConfig} from '@docusaurus/theme-common';
4
+ import ThemedImage from '@theme/ThemedImage';
5
+
6
+ export default function HomeHeading() {
7
+ const {
8
+ siteConfig: {title, customFields},
9
+ } = useDocusaurusContext();
10
+ const {
11
+ navbar: {logo},
12
+ } = useThemeConfig();
13
+ const light = useBaseUrl(logo?.src ?? '');
14
+ const dark = useBaseUrl(logo?.srcDark ?? logo?.src ?? '');
15
+ return (
16
+ <header className="library-home__heading">
17
+ {logo?.src && (
18
+ <ThemedImage
19
+ className="library-home__logo"
20
+ alt=""
21
+ width={72}
22
+ height={72}
23
+ sources={{light, dark}}
24
+ />
25
+ )}
26
+ <div className="library-home__titleline">
27
+ <h1>{title}</h1>
28
+ {customFields.version && (
29
+ <span className="library-home__version">v.{customFields.version}</span>
30
+ )}
31
+ </div>
32
+ </header>
33
+ );
34
+ }
@@ -0,0 +1,36 @@
1
+ import BackToTopButton from '@theme/BackToTopButton';
2
+ import {useSidebarVisibility} from '../providers/SidebarVisibility.jsx';
3
+ import LibraryNavigation from './navigation/LibraryNavigation.jsx';
4
+ import styles from '../styles/components/LibraryLayout.module.scss';
5
+ import {translate} from '@docusaurus/Translate';
6
+
7
+ export default function LibraryLayout({children, lang}) {
8
+ const {collapsed} = useSidebarVisibility();
9
+ return (
10
+ <div
11
+ className={styles.layout}
12
+ data-collapsed={collapsed}
13
+ >
14
+ <BackToTopButton />
15
+ <aside
16
+ className={styles.sidebar}
17
+ inert={collapsed}
18
+ aria-hidden={collapsed || undefined}
19
+ >
20
+ <nav
21
+ id="doc-library-navigation"
22
+ className={`menu thin-scrollbar ${styles.navigation}`}
23
+ aria-label={translate({id: 'docnest.navigation', message: 'Library navigation'})}
24
+ >
25
+ <LibraryNavigation />
26
+ </nav>
27
+ </aside>
28
+ <main
29
+ className={styles.main}
30
+ lang={lang}
31
+ >
32
+ <div className={styles.content}>{children}</div>
33
+ </main>
34
+ </div>
35
+ );
36
+ }
@@ -0,0 +1,24 @@
1
+ import Translate from '@docusaurus/Translate';
2
+ import StatusPage from './StatusPage.jsx';
3
+
4
+ export default function NotFoundContent({className}) {
5
+ return (
6
+ <StatusPage
7
+ className={className}
8
+ title={<Translate id="theme.NotFound.title">Page Not Found</Translate>}
9
+ description={
10
+ <>
11
+ <p>
12
+ <Translate id="theme.NotFound.p1">We could not find what you were looking for.</Translate>
13
+ </p>
14
+ <p>
15
+ <Translate id="theme.NotFound.p2">
16
+ Please contact the owner of the site that linked you to the original URL and let them
17
+ know their link is broken.
18
+ </Translate>
19
+ </p>
20
+ </>
21
+ }
22
+ />
23
+ );
24
+ }
@@ -0,0 +1,17 @@
1
+ import {usePluginData} from '@docusaurus/useGlobalData';
2
+ import DocCardList from '@theme/DocCardList';
3
+
4
+ function firstLink(item) {
5
+ if (item.type === 'link') return item.href;
6
+ return item.items.map(firstLink).find(Boolean);
7
+ }
8
+
9
+ export default function SpaceOverview({space}) {
10
+ const {sidebar} = usePluginData('library-navigation');
11
+ const root = space ? sidebar.find((item) => item.label === space) : null;
12
+ const entries = space ? root?.items || [] : sidebar;
13
+ const items = entries
14
+ .map((item) => ({type: 'link', label: item.label, href: firstLink(item)}))
15
+ .filter((item) => item.href);
16
+ return <DocCardList items={items} />;
17
+ }
@@ -0,0 +1,54 @@
1
+ import clsx from 'clsx';
2
+ import Translate from '@docusaurus/Translate';
3
+ import useBaseUrl from '@docusaurus/useBaseUrl';
4
+ import {useThemeConfig} from '@docusaurus/theme-common';
5
+ import Heading from '@theme/Heading';
6
+ import ThemedImage from '@theme/ThemedImage';
7
+ import {SITE_ROUTES} from '../routes.js';
8
+ import styles from '../styles/components/StatusPage.module.scss';
9
+
10
+ // Shared frame for the error and not-found pages: site logo, title, and the home action.
11
+ export default function StatusPage({className, title, description, actions, children}) {
12
+ const {
13
+ navbar: {logo},
14
+ } = useThemeConfig();
15
+ const light = useBaseUrl(logo?.src ?? '');
16
+ const dark = useBaseUrl(logo?.srcDark ?? logo?.src ?? '');
17
+ const home = useBaseUrl(SITE_ROUTES.home);
18
+
19
+ return (
20
+ <main className={clsx('container margin-vert--xl', className)}>
21
+ <div className={styles.content}>
22
+ <div className={styles.heading}>
23
+ {logo?.src && (
24
+ <ThemedImage
25
+ className={styles.logo}
26
+ alt=""
27
+ width={96}
28
+ height={96}
29
+ sources={{light, dark}}
30
+ />
31
+ )}
32
+ <Heading
33
+ as="h1"
34
+ className={styles.title}
35
+ >
36
+ {title}
37
+ </Heading>
38
+ </div>
39
+ {description}
40
+ <div className={styles.actions}>
41
+ {actions}
42
+ {/* A full page load leaves a broken client state behind. */}
43
+ <a
44
+ className="button button--secondary button--outline"
45
+ href={home}
46
+ >
47
+ <Translate id="docnest.error.home">Back home</Translate>
48
+ </a>
49
+ </div>
50
+ {children}
51
+ </div>
52
+ </main>
53
+ );
54
+ }
@@ -0,0 +1,137 @@
1
+ import Link from '@docusaurus/Link';
2
+ import {translate} from '@docusaurus/Translate';
3
+ import FilterChip from './ui/FilterChip.jsx';
4
+ import DocumentDate from './ui/DocumentDate.jsx';
5
+ import useUpdates from '../hooks/useUpdates.js';
6
+ import styles from '../styles/components/Updates.module.scss';
7
+
8
+ const spaceLabel = (name) =>
9
+ name === 'All' ? translate({id: 'docnest.all', message: 'All'}) : name;
10
+
11
+ export default function Updates() {
12
+ const {instance, setInstance, newOnly, setNewOnly, days, setDays, instances, groups, total} =
13
+ useUpdates();
14
+
15
+ return (
16
+ <div className={styles.updates}>
17
+ <h1>{translate({id: 'docnest.updates.title', message: 'Recent Updates'})}</h1>
18
+ <p className={styles.muted}>
19
+ {translate({
20
+ id: 'docnest.updates.description',
21
+ message: 'Browse new and updated documents by date and document space.',
22
+ })}
23
+ </p>
24
+
25
+ <div
26
+ role="group"
27
+ aria-label={translate({id: 'docnest.updates.range', message: 'Date range'})}
28
+ className={styles.filters}
29
+ >
30
+ {[
31
+ {
32
+ v: 7,
33
+ t: translate({id: 'docnest.updates.days', message: 'Last {days} days'}, {days: 7}),
34
+ },
35
+ {
36
+ v: 30,
37
+ t: translate({id: 'docnest.updates.days', message: 'Last {days} days'}, {days: 30}),
38
+ },
39
+ {
40
+ v: 90,
41
+ t: translate({id: 'docnest.updates.days', message: 'Last {days} days'}, {days: 90}),
42
+ },
43
+ {v: 0, t: translate({id: 'docnest.updates.allTime', message: 'All time'})},
44
+ ].map((o) => (
45
+ <FilterChip
46
+ key={o.v}
47
+ active={days === o.v}
48
+ onClick={() => setDays(o.v)}
49
+ >
50
+ {o.t}
51
+ </FilterChip>
52
+ ))}
53
+ </div>
54
+
55
+ <div
56
+ role="group"
57
+ aria-label={translate({id: 'docnest.updates.spaces', message: 'Document spaces'})}
58
+ className={styles.filters}
59
+ >
60
+ {instances.map((name) => (
61
+ <FilterChip
62
+ key={name}
63
+ active={instance === name}
64
+ onClick={() => setInstance(name)}
65
+ >
66
+ {spaceLabel(name)}
67
+ </FilterChip>
68
+ ))}
69
+ </div>
70
+ <label className={styles.checkbox}>
71
+ <input
72
+ type="checkbox"
73
+ checked={newOnly}
74
+ onChange={(e) => setNewOnly(e.target.checked)}
75
+ />
76
+ {translate({id: 'docnest.updates.newOnly', message: 'New documents only'})}
77
+ </label>
78
+
79
+ <p
80
+ role="status"
81
+ className={styles.summary}
82
+ >
83
+ {translate(
84
+ {id: 'docnest.updates.summary', message: 'Dates: {dates}, documents: {total}'},
85
+ {dates: groups.length, total},
86
+ )}
87
+ </p>
88
+
89
+ {groups.map(([day, items]) => (
90
+ <section
91
+ className={styles.day}
92
+ key={day}
93
+ >
94
+ <h2>
95
+ <DocumentDate value={day} />
96
+ <span className={styles.count}>
97
+ {translate(
98
+ {id: 'docnest.updates.dayCount', message: ', documents: {total}'},
99
+ {total: items.length},
100
+ )}
101
+ </span>
102
+ </h2>
103
+ <ul className={styles.list}>
104
+ {items.map((e) => (
105
+ <li
106
+ key={e.url}
107
+ className={styles.entry}
108
+ >
109
+ <span
110
+ className={styles.status}
111
+ data-new={e.isNew}
112
+ >
113
+ {e.isNew
114
+ ? translate({id: 'docnest.new', message: 'New'})
115
+ : translate({id: 'docnest.updated', message: 'Updated'})}
116
+ </span>
117
+ <Link
118
+ to={e.url}
119
+ className={styles.title}
120
+ >
121
+ {e.title}
122
+ </Link>
123
+ <span className={styles.space}>{spaceLabel(e.instance)}</span>
124
+ </li>
125
+ ))}
126
+ </ul>
127
+ </section>
128
+ ))}
129
+
130
+ {total === 0 && (
131
+ <p>
132
+ {translate({id: 'docnest.updates.empty', message: 'No documents match these filters.'})}
133
+ </p>
134
+ )}
135
+ </div>
136
+ );
137
+ }