@terrafirmagreg-team/changelog 1.2.3 → 1.2.4
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terrafirmagreg-team/changelog",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Changelog section",
|
|
6
6
|
"license": "LGPL-3.0-only",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"./types": "./src/types/index.ts"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@terrafirmagreg-team/kit": "1.2.
|
|
21
|
+
"@terrafirmagreg-team/kit": "1.2.3",
|
|
22
22
|
"@terrafirmagreg-team/mdx": "1.2.1",
|
|
23
23
|
"@terrafirmagreg-team/translate": "1.2.3",
|
|
24
24
|
"@terrafirmagreg-team/ui": "1.2.2",
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { redirect } from 'next/navigation';
|
|
2
|
+
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
3
|
+
import {
|
|
4
|
+
ChangelogTimeline,
|
|
5
|
+
type ChangelogTimelineEntry,
|
|
6
|
+
} from '@terrafirmagreg-team/changelog/components/timeline';
|
|
7
|
+
import {
|
|
8
|
+
WorkspaceBody,
|
|
9
|
+
WorkspaceDescription,
|
|
10
|
+
WorkspaceTitle,
|
|
11
|
+
} from '@terrafirmagreg-team/ui/components/layouts/workspace';
|
|
12
|
+
import { PageActions } from '@terrafirmagreg-team/kit/components/page-actions';
|
|
13
|
+
import { Skeleton } from '@terrafirmagreg-team/ui/components/ui/skeleton';
|
|
14
|
+
import type {
|
|
15
|
+
SectionPageView,
|
|
16
|
+
SectionWorkspaceProps,
|
|
17
|
+
} from '@terrafirmagreg-team/kit/components/views/section';
|
|
18
|
+
import type {
|
|
19
|
+
SectionFeatures,
|
|
20
|
+
SectionPageContext,
|
|
21
|
+
} from '@terrafirmagreg-team/kit/types/features';
|
|
22
|
+
import { sectionConfig } from '@terrafirmagreg-team/kit/lib/config';
|
|
23
|
+
import { UntranslatedCallout } from '@terrafirmagreg-team/ui/components/blocks/lang/untranslated-callout';
|
|
24
|
+
import { getMDXComponents } from '@terrafirmagreg-team/mdx/components/mdx-components';
|
|
25
|
+
import { loadLocaleRegistry } from '@terrafirmagreg-team/translate/server';
|
|
26
|
+
import { stripLangFromUrl } from '@terrafirmagreg-team/translate/lib/slug';
|
|
27
|
+
import type { TranslationState } from '@terrafirmagreg-team/translate/server';
|
|
28
|
+
import type { MDXContent } from 'mdx/types';
|
|
29
|
+
import type { TableOfContents } from '@terrafirmagreg-team/kit/components/toc/base';
|
|
30
|
+
import type { SectionPage } from '@terrafirmagreg-team/kit/types';
|
|
31
|
+
|
|
32
|
+
export type ChangelogPageContext = SectionPageContext;
|
|
33
|
+
|
|
34
|
+
export type ChangelogPageFeatures = SectionFeatures;
|
|
35
|
+
|
|
36
|
+
export function ChangelogBrowser({
|
|
37
|
+
entries,
|
|
38
|
+
lang,
|
|
39
|
+
}: {
|
|
40
|
+
entries: ChangelogTimelineEntry[];
|
|
41
|
+
lang: Lang;
|
|
42
|
+
}) {
|
|
43
|
+
return <ChangelogTimeline entries={entries} lang={lang} />;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function ChangelogPageChrome({
|
|
47
|
+
page,
|
|
48
|
+
body,
|
|
49
|
+
copied,
|
|
50
|
+
ctx,
|
|
51
|
+
dataset,
|
|
52
|
+
features,
|
|
53
|
+
}: {
|
|
54
|
+
page: SectionPage;
|
|
55
|
+
body: React.ReactNode;
|
|
56
|
+
copied?: TranslationState;
|
|
57
|
+
ctx: ChangelogPageContext;
|
|
58
|
+
dataset?: { crowdin?: string };
|
|
59
|
+
features: ChangelogPageFeatures;
|
|
60
|
+
}) {
|
|
61
|
+
const { languages } = loadLocaleRegistry();
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<UntranslatedCallout copied={copied} />
|
|
65
|
+
<WorkspaceTitle>{page.data.title}</WorkspaceTitle>
|
|
66
|
+
<WorkspaceDescription className="mb-0">
|
|
67
|
+
{page.data.description}
|
|
68
|
+
</WorkspaceDescription>
|
|
69
|
+
<div className="flex flex-row gap-2 items-center border-b pb-6">
|
|
70
|
+
<PageActions
|
|
71
|
+
copied={copied}
|
|
72
|
+
crowdinUrl={dataset?.crowdin}
|
|
73
|
+
title={page.data.title}
|
|
74
|
+
mdUrl={`${stripLangFromUrl(page.url, [...languages])}.md${
|
|
75
|
+
page.locale ? `?lang=${page.locale}` : ''
|
|
76
|
+
}`}
|
|
77
|
+
githubUrl={features.fileUrl?.(ctx.filePath)}
|
|
78
|
+
/>
|
|
79
|
+
{features.actionsRight?.(ctx)}
|
|
80
|
+
</div>
|
|
81
|
+
<WorkspaceBody>
|
|
82
|
+
{features.wrapBody ? (
|
|
83
|
+
features.wrapBody(body, ctx)
|
|
84
|
+
) : (
|
|
85
|
+
<div data-md-root className="contents">
|
|
86
|
+
{body}
|
|
87
|
+
</div>
|
|
88
|
+
)}
|
|
89
|
+
</WorkspaceBody>
|
|
90
|
+
{features.footer?.(ctx)}
|
|
91
|
+
{page.data.comments !== false ? features.comments?.(ctx) : null}
|
|
92
|
+
</>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function changelogPage({
|
|
97
|
+
page,
|
|
98
|
+
link,
|
|
99
|
+
contentDir,
|
|
100
|
+
copied,
|
|
101
|
+
crumbs = [],
|
|
102
|
+
previews,
|
|
103
|
+
footer,
|
|
104
|
+
history = true,
|
|
105
|
+
features = {},
|
|
106
|
+
}: SectionWorkspaceProps & {
|
|
107
|
+
features?: ChangelogPageFeatures;
|
|
108
|
+
}): Promise<SectionPageView> {
|
|
109
|
+
if (page.data.redirect) redirect(page.data.redirect);
|
|
110
|
+
const { body: MDX, toc } = (await (
|
|
111
|
+
page.data as unknown as {
|
|
112
|
+
load(): Promise<{ body: MDXContent; toc: TableOfContents }>;
|
|
113
|
+
}
|
|
114
|
+
).load()) as { body: MDXContent; toc: TableOfContents };
|
|
115
|
+
const filePath = `${contentDir}/${page.path.replace(/\\/g, '/')}`;
|
|
116
|
+
const datasetId = page.url.split('/').filter(Boolean)[1];
|
|
117
|
+
const dataset = datasetId
|
|
118
|
+
? sectionConfig().datasetConfig[datasetId]
|
|
119
|
+
: undefined;
|
|
120
|
+
const ctx: ChangelogPageContext = {
|
|
121
|
+
page,
|
|
122
|
+
filePath,
|
|
123
|
+
datasetId,
|
|
124
|
+
copied,
|
|
125
|
+
history,
|
|
126
|
+
};
|
|
127
|
+
const body = <MDX components={getMDXComponents({ a: link })} />;
|
|
128
|
+
return {
|
|
129
|
+
node: (
|
|
130
|
+
<ChangelogPageChrome
|
|
131
|
+
page={page}
|
|
132
|
+
body={body}
|
|
133
|
+
copied={copied}
|
|
134
|
+
ctx={ctx}
|
|
135
|
+
dataset={dataset}
|
|
136
|
+
features={features}
|
|
137
|
+
/>
|
|
138
|
+
),
|
|
139
|
+
workspace: {
|
|
140
|
+
toc,
|
|
141
|
+
full: page.data.full,
|
|
142
|
+
className: 'min-h-full',
|
|
143
|
+
breadcrumb: { items: crumbs, previews },
|
|
144
|
+
pagination: { items: footer },
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function ChangelogBrowserFallback() {
|
|
150
|
+
return (
|
|
151
|
+
<div className="flex flex-col gap-8 pt-6">
|
|
152
|
+
{Array.from({ length: 3 }, (_, i) => (
|
|
153
|
+
<div key={i} className="flex flex-col gap-3">
|
|
154
|
+
<Skeleton className="h-6 w-32" />
|
|
155
|
+
<div className="flex flex-col gap-2.5 border-l border-border ps-4">
|
|
156
|
+
<Skeleton className="h-4 w-2/3" />
|
|
157
|
+
<Skeleton className="h-4 w-4/5" />
|
|
158
|
+
<Skeleton className="h-4 w-1/2" />
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
))}
|
|
162
|
+
</div>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
import { sectionConfig } from '@terrafirmagreg-team/kit/lib/config';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type {
|
|
3
|
+
SectionLandingProps,
|
|
4
|
+
SectionLandingView,
|
|
5
|
+
} from '@terrafirmagreg-team/kit/components/views/routes';
|
|
6
|
+
import type { SectionSource } from '@terrafirmagreg-team/kit/types';
|
|
7
|
+
import { Suspense } from 'react';
|
|
4
8
|
import { timelineEntries } from '@terrafirmagreg-team/changelog/components/entries';
|
|
5
9
|
import {
|
|
6
|
-
|
|
10
|
+
ChangelogBrowser,
|
|
11
|
+
ChangelogBrowserFallback,
|
|
12
|
+
} from '@terrafirmagreg-team/changelog/components/views/browser';
|
|
13
|
+
import {
|
|
7
14
|
groupByMonth,
|
|
8
15
|
monthAnchor,
|
|
9
16
|
} from '@terrafirmagreg-team/changelog/components/timeline';
|
|
10
17
|
import { ChangelogMonthLabel } from '@terrafirmagreg-team/changelog/components/month-label';
|
|
11
18
|
|
|
12
|
-
export async function changelogLanding(
|
|
13
|
-
page
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
export async function changelogLanding({
|
|
20
|
+
page,
|
|
21
|
+
lang,
|
|
22
|
+
source,
|
|
23
|
+
route,
|
|
24
|
+
}: SectionLandingProps<SectionSource>): Promise<SectionLandingView> {
|
|
16
25
|
const dataset = page.dataset.id;
|
|
17
26
|
const entries = await timelineEntries(
|
|
18
27
|
source,
|
|
19
28
|
route,
|
|
20
29
|
dataset,
|
|
21
|
-
|
|
30
|
+
lang,
|
|
22
31
|
sectionConfig().datasetConfig[dataset]?.repo,
|
|
23
32
|
);
|
|
24
33
|
return {
|
|
25
|
-
node:
|
|
34
|
+
node: (
|
|
35
|
+
<Suspense fallback={<ChangelogBrowserFallback />}>
|
|
36
|
+
<ChangelogBrowser entries={entries} lang={lang} />
|
|
37
|
+
</Suspense>
|
|
38
|
+
),
|
|
26
39
|
workspace: {
|
|
27
|
-
toc: groupByMonth(entries,
|
|
40
|
+
toc: groupByMonth(entries, lang).map((month) => ({
|
|
28
41
|
title: <ChangelogMonthLabel monthKey={month.key} />,
|
|
29
42
|
url: `#${monthAnchor(month.key)}`,
|
|
30
43
|
depth: 2,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Layout } from '@terrafirmagreg-team/kit/components/layouts/layout';
|
|
2
|
+
import type { SectionLayoutViewProps } from '@terrafirmagreg-team/kit/components/views/routes';
|
|
3
|
+
|
|
4
|
+
export function ChangelogLayout(props: SectionLayoutViewProps) {
|
|
5
|
+
return <Layout {...props} />;
|
|
6
|
+
}
|