@eightyfourthousand/lib-editing 2026.3.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.
- package/.babelrc +12 -0
- package/.eslintrc.json +18 -0
- package/README.md +7 -0
- package/jest.config.ts +10 -0
- package/package.json +35 -0
- package/postcss.config.mjs +9 -0
- package/project.json +29 -0
- package/src/fixtures/basic/json.ts +396 -0
- package/src/fixtures/toh251/json.ts +4913 -0
- package/src/fixtures/toh251/passages.ts +2814 -0
- package/src/fixtures/types.ts +8 -0
- package/src/index.ts +4 -0
- package/src/lib/block.ts +226 -0
- package/src/lib/components/editor/BlockEditor.tsx +38 -0
- package/src/lib/components/editor/EditorBackMatterPage.tsx +95 -0
- package/src/lib/components/editor/EditorBodyPage.tsx +87 -0
- package/src/lib/components/editor/EditorHeader.tsx +22 -0
- package/src/lib/components/editor/EditorLayout.tsx +62 -0
- package/src/lib/components/editor/EditorLeftPanelPage.tsx +27 -0
- package/src/lib/components/editor/EditorProvider.tsx +399 -0
- package/src/lib/components/editor/PaginationProvider.tsx +472 -0
- package/src/lib/components/editor/TitlesBuilder.tsx +40 -0
- package/src/lib/components/editor/TranslationBuilder.tsx +171 -0
- package/src/lib/components/editor/TranslationEditor.tsx +32 -0
- package/src/lib/components/editor/extensions/Abbreviation/Abbreviation.ts +133 -0
- package/src/lib/components/editor/extensions/Audio/Audio.ts +69 -0
- package/src/lib/components/editor/extensions/Bold.ts +43 -0
- package/src/lib/components/editor/extensions/Document.ts +8 -0
- package/src/lib/components/editor/extensions/DragHandle/DragHandle.ts +429 -0
- package/src/lib/components/editor/extensions/EndNoteLink/EndNoteLink.tsx +39 -0
- package/src/lib/components/editor/extensions/EndNoteLink/EndNoteLinkHoverContent.tsx +139 -0
- package/src/lib/components/editor/extensions/EndNoteLink/EndNoteLinkMark.ts +236 -0
- package/src/lib/components/editor/extensions/EndNoteLink/endnote-utils.ts +412 -0
- package/src/lib/components/editor/extensions/GlobalConfig.ts +52 -0
- package/src/lib/components/editor/extensions/GlossaryInstance/GlossaryInput.tsx +54 -0
- package/src/lib/components/editor/extensions/GlossaryInstance/GlossaryInstance.tsx +129 -0
- package/src/lib/components/editor/extensions/GlossaryInstance/GlossaryInstanceNode.ts +148 -0
- package/src/lib/components/editor/extensions/Heading/Heading.ts +71 -0
- package/src/lib/components/editor/extensions/HoverInputField.tsx +54 -0
- package/src/lib/components/editor/extensions/Image.ts +18 -0
- package/src/lib/components/editor/extensions/Indent.ts +103 -0
- package/src/lib/components/editor/extensions/InternalLink/InternalLink.ts +173 -0
- package/src/lib/components/editor/extensions/InternalLink/InternalLinkHoverContent.tsx +137 -0
- package/src/lib/components/editor/extensions/InternalLink/InternalLinkInput.tsx +71 -0
- package/src/lib/components/editor/extensions/InternalLink/index.ts +1 -0
- package/src/lib/components/editor/extensions/Italic.ts +50 -0
- package/src/lib/components/editor/extensions/LeadingSpace.ts +106 -0
- package/src/lib/components/editor/extensions/Line/LineNode.ts +41 -0
- package/src/lib/components/editor/extensions/LineGroup/LineGroupNode.ts +124 -0
- package/src/lib/components/editor/extensions/Link/Link.ts +65 -0
- package/src/lib/components/editor/extensions/Link/LinkHoverContent.tsx +124 -0
- package/src/lib/components/editor/extensions/Link/index.ts +1 -0
- package/src/lib/components/editor/extensions/List.ts +74 -0
- package/src/lib/components/editor/extensions/Mantra/Mantra.ts +88 -0
- package/src/lib/components/editor/extensions/Mention/Mention.ts +184 -0
- package/src/lib/components/editor/extensions/Mention/MentionHoverContent.tsx +158 -0
- package/src/lib/components/editor/extensions/NodeWrapper.tsx +57 -0
- package/src/lib/components/editor/extensions/Paragraph/Paragraph.ts +25 -0
- package/src/lib/components/editor/extensions/ParagraphIndent.ts +87 -0
- package/src/lib/components/editor/extensions/Passage/EditLabel.tsx +57 -0
- package/src/lib/components/editor/extensions/Passage/EditorOptions.tsx +29 -0
- package/src/lib/components/editor/extensions/Passage/Passage.tsx +238 -0
- package/src/lib/components/editor/extensions/Passage/PassageNode.ts +223 -0
- package/src/lib/components/editor/extensions/Passage/ReaderOptions.tsx +55 -0
- package/src/lib/components/editor/extensions/Passage/ShowAnnotations.tsx +92 -0
- package/src/lib/components/editor/extensions/Passage/index.ts +1 -0
- package/src/lib/components/editor/extensions/Passage/label.spec.ts +118 -0
- package/src/lib/components/editor/extensions/Passage/label.ts +39 -0
- package/src/lib/components/editor/extensions/Placeholder.ts +9 -0
- package/src/lib/components/editor/extensions/SlashCommand/SlashCommand.ts +65 -0
- package/src/lib/components/editor/extensions/SlashCommand/SuggestionList.tsx +109 -0
- package/src/lib/components/editor/extensions/SlashCommand/Suggestions.ts +185 -0
- package/src/lib/components/editor/extensions/SmallCaps.ts +110 -0
- package/src/lib/components/editor/extensions/StarterKit.ts +36 -0
- package/src/lib/components/editor/extensions/Subscript.ts +43 -0
- package/src/lib/components/editor/extensions/Superscript.ts +43 -0
- package/src/lib/components/editor/extensions/Table.ts +32 -0
- package/src/lib/components/editor/extensions/TextAlign.ts +5 -0
- package/src/lib/components/editor/extensions/TitleMetadata.ts +40 -0
- package/src/lib/components/editor/extensions/TitleNode.ts +133 -0
- package/src/lib/components/editor/extensions/TitlesNode.ts +102 -0
- package/src/lib/components/editor/extensions/Trailer.ts +57 -0
- package/src/lib/components/editor/extensions/TranslationDocument.ts +7 -0
- package/src/lib/components/editor/extensions/TranslationMetadata.ts +58 -0
- package/src/lib/components/editor/extensions/Underline.ts +43 -0
- package/src/lib/components/editor/hooks/index.ts +4 -0
- package/src/lib/components/editor/hooks/useBlockEditor.ts +53 -0
- package/src/lib/components/editor/hooks/useDefaultExtensions.ts +39 -0
- package/src/lib/components/editor/hooks/useDirtyStore.ts +33 -0
- package/src/lib/components/editor/hooks/useTranslationExtensions.ts +148 -0
- package/src/lib/components/editor/index.ts +10 -0
- package/src/lib/components/editor/menus/EmptyBubbleMenu.tsx +42 -0
- package/src/lib/components/editor/menus/MainBubbleMenu.tsx +51 -0
- package/src/lib/components/editor/menus/TranslationBubbleMenu.tsx +57 -0
- package/src/lib/components/editor/menus/index.ts +3 -0
- package/src/lib/components/editor/menus/selectors/EndNoteSelector.tsx +388 -0
- package/src/lib/components/editor/menus/selectors/GlossarySelector.tsx +63 -0
- package/src/lib/components/editor/menus/selectors/LinkSelector.tsx +68 -0
- package/src/lib/components/editor/menus/selectors/MantraSelector.tsx +119 -0
- package/src/lib/components/editor/menus/selectors/NodeSelector.tsx +144 -0
- package/src/lib/components/editor/menus/selectors/ParagraphButtons.tsx +68 -0
- package/src/lib/components/editor/menus/selectors/SelectorInputField.tsx +68 -0
- package/src/lib/components/editor/menus/selectors/TextAlignSelector.tsx +89 -0
- package/src/lib/components/editor/menus/selectors/TextButtons.tsx +89 -0
- package/src/lib/components/editor/menus/selectors/TranslationNodeSelector.tsx +143 -0
- package/src/lib/components/editor/menus/selectors/TranslationTextButtons.tsx +125 -0
- package/src/lib/components/editor/menus/selectors/index.ts +5 -0
- package/src/lib/components/editor/save-filter.spec.ts +94 -0
- package/src/lib/components/editor/save-filter.ts +27 -0
- package/src/lib/components/editor/util.ts +304 -0
- package/src/lib/components/index.ts +3 -0
- package/src/lib/components/reader/ReaderBackMatterPage.tsx +62 -0
- package/src/lib/components/reader/ReaderBackMatterPanel.tsx +53 -0
- package/src/lib/components/reader/ReaderBodyPage.tsx +46 -0
- package/src/lib/components/reader/ReaderBodyPanel.tsx +68 -0
- package/src/lib/components/reader/ReaderLayout.tsx +39 -0
- package/src/lib/components/reader/ReaderLeftPanel.tsx +8 -0
- package/src/lib/components/reader/ReaderLeftPanelPage.tsx +31 -0
- package/src/lib/components/reader/TranslationReader.tsx +28 -0
- package/src/lib/components/reader/index.ts +2 -0
- package/src/lib/components/reader/ssr.ts +3 -0
- package/src/lib/components/shared/AiSummarizerPage.tsx +12 -0
- package/src/lib/components/shared/BackMatterPanel.tsx +143 -0
- package/src/lib/components/shared/BodyPanel.tsx +214 -0
- package/src/lib/components/shared/HoverCardProvider.tsx +407 -0
- package/src/lib/components/shared/Imprint.tsx +24 -0
- package/src/lib/components/shared/LabeledElement.tsx +133 -0
- package/src/lib/components/shared/LeftPanel.tsx +65 -0
- package/src/lib/components/shared/NavigationContext.ts +64 -0
- package/src/lib/components/shared/NavigationProvider.tsx +368 -0
- package/src/lib/components/shared/OpenGraphImage.tsx +75 -0
- package/src/lib/components/shared/PassageSkeleton.tsx +10 -0
- package/src/lib/components/shared/RestrictionWarning.tsx +177 -0
- package/src/lib/components/shared/SourceReader.tsx +83 -0
- package/src/lib/components/shared/SuggestRevisionForm.tsx +99 -0
- package/src/lib/components/shared/TableOfContents.tsx +280 -0
- package/src/lib/components/shared/ThreeColumnRenderer.tsx +54 -0
- package/src/lib/components/shared/TranslationHeader.tsx +86 -0
- package/src/lib/components/shared/TranslationHoverCard.tsx +84 -0
- package/src/lib/components/shared/TranslationSkeleton.tsx +16 -0
- package/src/lib/components/shared/TranslationTable.tsx +155 -0
- package/src/lib/components/shared/bibliography/BibliographyBody.tsx +28 -0
- package/src/lib/components/shared/bibliography/BibliographyList.tsx +63 -0
- package/src/lib/components/shared/bibliography/index.ts +1 -0
- package/src/lib/components/shared/generate-metadata.ts +44 -0
- package/src/lib/components/shared/glossary/GlossaryInstanceBody.tsx +144 -0
- package/src/lib/components/shared/glossary/GlossaryPaginationProvider.tsx +317 -0
- package/src/lib/components/shared/glossary/GlossarySkeleton.tsx +19 -0
- package/src/lib/components/shared/glossary/GlossaryTermList.tsx +58 -0
- package/src/lib/components/shared/glossary/index.ts +3 -0
- package/src/lib/components/shared/hooks/useGlossaryInstanceListener.tsx +42 -0
- package/src/lib/components/shared/hooks/useScrollInTab.tsx +43 -0
- package/src/lib/components/shared/hooks/useScrollPositionRestore.ts +274 -0
- package/src/lib/components/shared/hooks/useTohToggle.tsx +52 -0
- package/src/lib/components/shared/index.ts +11 -0
- package/src/lib/components/shared/ssr.ts +2 -0
- package/src/lib/components/shared/titles/FramedCard.tsx +132 -0
- package/src/lib/components/shared/titles/LongTitle.tsx +20 -0
- package/src/lib/components/shared/titles/LongTitles.tsx +28 -0
- package/src/lib/components/shared/titles/Title.tsx +54 -0
- package/src/lib/components/shared/titles/TitleDetails.tsx +47 -0
- package/src/lib/components/shared/titles/TitleForm.tsx +37 -0
- package/src/lib/components/shared/titles/Titles.tsx +114 -0
- package/src/lib/components/shared/titles/TitlesCard.tsx +113 -0
- package/src/lib/components/shared/titles/index.ts +8 -0
- package/src/lib/components/shared/types.ts +79 -0
- package/src/lib/components/ssr.ts +2 -0
- package/src/lib/exporters/abbreviation.spec.ts +31 -0
- package/src/lib/exporters/abbreviation.ts +22 -0
- package/src/lib/exporters/annotation.ts +193 -0
- package/src/lib/exporters/audio.spec.ts +77 -0
- package/src/lib/exporters/audio.ts +27 -0
- package/src/lib/exporters/blockquote.spec.ts +48 -0
- package/src/lib/exporters/blockquote.ts +24 -0
- package/src/lib/exporters/code.spec.ts +93 -0
- package/src/lib/exporters/code.ts +26 -0
- package/src/lib/exporters/end-note-link.spec.ts +104 -0
- package/src/lib/exporters/end-note-link.ts +35 -0
- package/src/lib/exporters/export.ts +12 -0
- package/src/lib/exporters/glossary-instance.spec.ts +85 -0
- package/src/lib/exporters/glossary-instance.ts +31 -0
- package/src/lib/exporters/has-abbreviation.spec.ts +31 -0
- package/src/lib/exporters/has-abbreviation.ts +21 -0
- package/src/lib/exporters/heading.spec.ts +80 -0
- package/src/lib/exporters/heading.ts +28 -0
- package/src/lib/exporters/image.spec.ts +48 -0
- package/src/lib/exporters/image.ts +25 -0
- package/src/lib/exporters/indent.spec.ts +58 -0
- package/src/lib/exporters/indent.ts +18 -0
- package/src/lib/exporters/index.ts +1 -0
- package/src/lib/exporters/internal-link.spec.ts +90 -0
- package/src/lib/exporters/internal-link.ts +35 -0
- package/src/lib/exporters/italic.spec.ts +84 -0
- package/src/lib/exporters/italic.ts +55 -0
- package/src/lib/exporters/leading-space.spec.ts +28 -0
- package/src/lib/exporters/leading-space.ts +16 -0
- package/src/lib/exporters/line-group.spec.ts +48 -0
- package/src/lib/exporters/line-group.ts +24 -0
- package/src/lib/exporters/line.spec.ts +48 -0
- package/src/lib/exporters/line.ts +24 -0
- package/src/lib/exporters/link.spec.ts +123 -0
- package/src/lib/exporters/link.ts +67 -0
- package/src/lib/exporters/list-item.spec.ts +48 -0
- package/src/lib/exporters/list-item.ts +24 -0
- package/src/lib/exporters/list.spec.ts +82 -0
- package/src/lib/exporters/list.ts +31 -0
- package/src/lib/exporters/mantra.spec.ts +51 -0
- package/src/lib/exporters/mantra.ts +25 -0
- package/src/lib/exporters/mention.ts +41 -0
- package/src/lib/exporters/paragraph.spec.ts +173 -0
- package/src/lib/exporters/paragraph.ts +32 -0
- package/src/lib/exporters/quote.spec.ts +56 -0
- package/src/lib/exporters/quote.ts +25 -0
- package/src/lib/exporters/span.spec.ts +118 -0
- package/src/lib/exporters/span.ts +44 -0
- package/src/lib/exporters/table-body-data.spec.ts +48 -0
- package/src/lib/exporters/table-body-data.ts +24 -0
- package/src/lib/exporters/table-body-header.spec.ts +48 -0
- package/src/lib/exporters/table-body-header.ts +24 -0
- package/src/lib/exporters/table-body-row.spec.ts +48 -0
- package/src/lib/exporters/table-body-row.ts +24 -0
- package/src/lib/exporters/table.spec.ts +48 -0
- package/src/lib/exporters/table.ts +24 -0
- package/src/lib/exporters/trailer.spec.ts +48 -0
- package/src/lib/exporters/trailer.ts +24 -0
- package/src/lib/exporters/util.ts +62 -0
- package/src/lib/passage.ts +182 -0
- package/src/lib/titles.ts +80 -0
- package/src/lib/transformers/abbreviation.spec.ts +87 -0
- package/src/lib/transformers/abbreviation.ts +30 -0
- package/src/lib/transformers/annotate.ts +146 -0
- package/src/lib/transformers/audio.spec.ts +55 -0
- package/src/lib/transformers/audio.ts +29 -0
- package/src/lib/transformers/blockquote.spec.ts +48 -0
- package/src/lib/transformers/blockquote.ts +41 -0
- package/src/lib/transformers/code.spec.ts +52 -0
- package/src/lib/transformers/code.ts +22 -0
- package/src/lib/transformers/deprecated.ts +7 -0
- package/src/lib/transformers/end-note-link.spec.ts +56 -0
- package/src/lib/transformers/end-note-link.ts +76 -0
- package/src/lib/transformers/glossary-instance.spec.ts +55 -0
- package/src/lib/transformers/glossary-instance.ts +40 -0
- package/src/lib/transformers/has-abbreviation.spec.ts +50 -0
- package/src/lib/transformers/has-abbreviation.ts +30 -0
- package/src/lib/transformers/heading.spec.ts +62 -0
- package/src/lib/transformers/heading.ts +30 -0
- package/src/lib/transformers/image.spec.ts +51 -0
- package/src/lib/transformers/image.ts +28 -0
- package/src/lib/transformers/indent.spec.ts +53 -0
- package/src/lib/transformers/indent.ts +17 -0
- package/src/lib/transformers/index.ts +33 -0
- package/src/lib/transformers/inline-title.spec.ts +59 -0
- package/src/lib/transformers/inline-title.ts +34 -0
- package/src/lib/transformers/internal-link.spec.ts +67 -0
- package/src/lib/transformers/internal-link.ts +65 -0
- package/src/lib/transformers/italic.ts +22 -0
- package/src/lib/transformers/leading-space.spec.ts +55 -0
- package/src/lib/transformers/leading-space.ts +17 -0
- package/src/lib/transformers/line-group.spec.ts +48 -0
- package/src/lib/transformers/line-group.ts +37 -0
- package/src/lib/transformers/line.spec.ts +54 -0
- package/src/lib/transformers/line.ts +27 -0
- package/src/lib/transformers/link.spec.ts +61 -0
- package/src/lib/transformers/link.ts +27 -0
- package/src/lib/transformers/list-item.spec.ts +48 -0
- package/src/lib/transformers/list-item.ts +37 -0
- package/src/lib/transformers/list.spec.ts +58 -0
- package/src/lib/transformers/list.ts +42 -0
- package/src/lib/transformers/mantra.spec.ts +58 -0
- package/src/lib/transformers/mantra.ts +28 -0
- package/src/lib/transformers/mention.ts +70 -0
- package/src/lib/transformers/paragraph.spec.ts +46 -0
- package/src/lib/transformers/paragraph.ts +26 -0
- package/src/lib/transformers/quote.spec.ts +42 -0
- package/src/lib/transformers/quote.ts +3 -0
- package/src/lib/transformers/quoted.ts +3 -0
- package/src/lib/transformers/recurse.ts +76 -0
- package/src/lib/transformers/reference.ts +3 -0
- package/src/lib/transformers/span.spec.ts +68 -0
- package/src/lib/transformers/span.ts +78 -0
- package/src/lib/transformers/split-at.ts +58 -0
- package/src/lib/transformers/split-block.ts +110 -0
- package/src/lib/transformers/split-content.ts +67 -0
- package/src/lib/transformers/split-insert.ts +76 -0
- package/src/lib/transformers/split-marks.ts +42 -0
- package/src/lib/transformers/split-node.ts +138 -0
- package/src/lib/transformers/table-body-data.spec.ts +44 -0
- package/src/lib/transformers/table-body-data.ts +29 -0
- package/src/lib/transformers/table-body-header.spec.ts +44 -0
- package/src/lib/transformers/table-body-header.ts +29 -0
- package/src/lib/transformers/table-body-row.spec.ts +44 -0
- package/src/lib/transformers/table-body-row.ts +29 -0
- package/src/lib/transformers/table.spec.ts +47 -0
- package/src/lib/transformers/table.ts +29 -0
- package/src/lib/transformers/trailer.spec.ts +43 -0
- package/src/lib/transformers/trailer.ts +26 -0
- package/src/lib/transformers/transformer.ts +25 -0
- package/src/lib/transformers/unknown.ts +8 -0
- package/src/lib/transformers/util.ts +20 -0
- package/src/lib/types.ts +10 -0
- package/src/ssr.ts +1 -0
- package/tsconfig.json +20 -0
- package/tsconfig.lib.json +29 -0
- package/tsconfig.spec.json +22 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BODY_MATTER_FILTER,
|
|
3
|
+
createBuildGraphQLClient,
|
|
4
|
+
FRONT_MATTER_FILTER,
|
|
5
|
+
getTranslationBlocks,
|
|
6
|
+
getTranslationTitles,
|
|
7
|
+
} from '@eightyfourthousand/client-graphql/ssr';
|
|
8
|
+
import { ReaderBodyPanel } from './ReaderBodyPanel';
|
|
9
|
+
import { isUuid } from '@eightyfourthousand/lib-utils';
|
|
10
|
+
import { notFound } from 'next/navigation';
|
|
11
|
+
|
|
12
|
+
const INITIAL_PASSAGES = 250;
|
|
13
|
+
|
|
14
|
+
export const ReaderBodyPage = async ({
|
|
15
|
+
params,
|
|
16
|
+
}: {
|
|
17
|
+
params: Promise<{ slug: string }>;
|
|
18
|
+
}) => {
|
|
19
|
+
const { slug } = await params;
|
|
20
|
+
|
|
21
|
+
if (!isUuid(slug)) {
|
|
22
|
+
return notFound();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const client = createBuildGraphQLClient();
|
|
26
|
+
|
|
27
|
+
const { blocks: frontMatter } = await getTranslationBlocks({
|
|
28
|
+
client,
|
|
29
|
+
uuid: slug,
|
|
30
|
+
type: FRONT_MATTER_FILTER,
|
|
31
|
+
maxPassages: INITIAL_PASSAGES,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const { blocks: body } = await getTranslationBlocks({
|
|
35
|
+
client,
|
|
36
|
+
uuid: slug,
|
|
37
|
+
type: BODY_MATTER_FILTER,
|
|
38
|
+
maxPassages: INITIAL_PASSAGES,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const titles = await getTranslationTitles({ client, uuid: slug });
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<ReaderBodyPanel titles={titles} frontMatter={frontMatter} body={body} />
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import {
|
|
5
|
+
BODY_MATTER_FILTER,
|
|
6
|
+
FRONT_MATTER_FILTER,
|
|
7
|
+
Titles as TitlesData,
|
|
8
|
+
} from '@eightyfourthousand/data-access';
|
|
9
|
+
import { BodyPanel } from '../shared/BodyPanel';
|
|
10
|
+
import { Titles, TitlesVariant } from '../shared/titles';
|
|
11
|
+
import { TitlesRenderer, TranslationRenderer } from '../shared/types';
|
|
12
|
+
import { TranslationEditorContent } from '../editor';
|
|
13
|
+
import { TranslationReader } from './TranslationReader';
|
|
14
|
+
|
|
15
|
+
const TITLE_VARIANTS_FOR_TABS: { [key: string]: TitlesVariant } = {
|
|
16
|
+
translation: 'english',
|
|
17
|
+
source: 'tibetan',
|
|
18
|
+
front: 'english',
|
|
19
|
+
compare: 'comparison',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const ReaderBodyPanel = ({
|
|
23
|
+
titles,
|
|
24
|
+
frontMatter,
|
|
25
|
+
body,
|
|
26
|
+
}: {
|
|
27
|
+
titles: TitlesData;
|
|
28
|
+
frontMatter: TranslationEditorContent;
|
|
29
|
+
body: TranslationEditorContent;
|
|
30
|
+
cursor?: string;
|
|
31
|
+
}) => {
|
|
32
|
+
const renderTitles = useCallback(
|
|
33
|
+
({ titles, imprint, name }: TitlesRenderer) => (
|
|
34
|
+
<Titles
|
|
35
|
+
titles={titles}
|
|
36
|
+
imprint={imprint}
|
|
37
|
+
variant={
|
|
38
|
+
(TITLE_VARIANTS_FOR_TABS[name] || 'english') as TitlesVariant
|
|
39
|
+
}
|
|
40
|
+
/>
|
|
41
|
+
),
|
|
42
|
+
[],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const renderTranslation = useCallback(
|
|
46
|
+
({ content, name, className }: TranslationRenderer) => (
|
|
47
|
+
<TranslationReader
|
|
48
|
+
content={content}
|
|
49
|
+
name={name}
|
|
50
|
+
className={className}
|
|
51
|
+
filter={name === 'front' ? FRONT_MATTER_FILTER : BODY_MATTER_FILTER}
|
|
52
|
+
panel="main"
|
|
53
|
+
/>
|
|
54
|
+
),
|
|
55
|
+
[],
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<BodyPanel
|
|
60
|
+
titles={titles}
|
|
61
|
+
frontMatter={frontMatter}
|
|
62
|
+
body={body}
|
|
63
|
+
renderTitles={renderTitles}
|
|
64
|
+
renderTranslation={renderTranslation}
|
|
65
|
+
limitWhenNoTranslation={true}
|
|
66
|
+
/>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { ReactNode, use } from 'react';
|
|
4
|
+
import { NavigationProvider, ThreeColumnRenderer } from '../shared';
|
|
5
|
+
import {
|
|
6
|
+
LeftPanel,
|
|
7
|
+
MainPanel,
|
|
8
|
+
MainPanelHeader,
|
|
9
|
+
RightPanel,
|
|
10
|
+
} from '@eightyfourthousand/design-system';
|
|
11
|
+
import { EditorHeader } from '../editor/EditorHeader';
|
|
12
|
+
|
|
13
|
+
export const ReaderLayout = ({
|
|
14
|
+
withHeader = false,
|
|
15
|
+
left,
|
|
16
|
+
main,
|
|
17
|
+
right,
|
|
18
|
+
params,
|
|
19
|
+
}: {
|
|
20
|
+
withHeader?: boolean;
|
|
21
|
+
left: ReactNode;
|
|
22
|
+
main: ReactNode;
|
|
23
|
+
right: ReactNode;
|
|
24
|
+
params: Promise<{ slug: string }>;
|
|
25
|
+
}) => {
|
|
26
|
+
const { slug } = use(params);
|
|
27
|
+
return (
|
|
28
|
+
<NavigationProvider uuid={slug}>
|
|
29
|
+
<ThreeColumnRenderer withHeader={withHeader}>
|
|
30
|
+
<LeftPanel>{left}</LeftPanel>
|
|
31
|
+
<MainPanelHeader>
|
|
32
|
+
<EditorHeader />
|
|
33
|
+
</MainPanelHeader>
|
|
34
|
+
<MainPanel>{main}</MainPanel>
|
|
35
|
+
<RightPanel>{right}</RightPanel>
|
|
36
|
+
</ThreeColumnRenderer>
|
|
37
|
+
</NavigationProvider>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { LeftPanel } from '../shared/LeftPanel';
|
|
4
|
+
import { Toc, Work } from '@eightyfourthousand/data-access';
|
|
5
|
+
|
|
6
|
+
export const ReaderLeftPanel = ({ toc, work }: { toc?: Toc; work: Work }) => {
|
|
7
|
+
return <LeftPanel toc={toc} work={work} limitWhenNoTranslation={true} />;
|
|
8
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBuildGraphQLClient,
|
|
3
|
+
getTranslationMetadataByUuid,
|
|
4
|
+
getTranslationToc,
|
|
5
|
+
} from '@eightyfourthousand/client-graphql/ssr';
|
|
6
|
+
import { ReaderLeftPanel } from './ReaderLeftPanel';
|
|
7
|
+
import { isUuid } from '@eightyfourthousand/lib-utils';
|
|
8
|
+
import { notFound } from 'next/navigation';
|
|
9
|
+
|
|
10
|
+
export const ReaderLeftPanelPage = async ({
|
|
11
|
+
params,
|
|
12
|
+
}: {
|
|
13
|
+
params: Promise<{ slug: string }>;
|
|
14
|
+
}) => {
|
|
15
|
+
const { slug } = await params;
|
|
16
|
+
|
|
17
|
+
if (!isUuid(slug)) {
|
|
18
|
+
return notFound();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const client = createBuildGraphQLClient();
|
|
22
|
+
const work = await getTranslationMetadataByUuid({ client, uuid: slug });
|
|
23
|
+
|
|
24
|
+
if (!work) {
|
|
25
|
+
return notFound();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const toc = await getTranslationToc({ client, uuid: slug });
|
|
29
|
+
|
|
30
|
+
return <ReaderLeftPanel toc={toc} work={work} />;
|
|
31
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { TranslationEditor } from '../editor';
|
|
4
|
+
import { PaginationProvider } from '../editor/PaginationProvider';
|
|
5
|
+
import { TranslationRenderer, useNavigation } from '../shared';
|
|
6
|
+
|
|
7
|
+
export const TranslationReader = ({
|
|
8
|
+
content,
|
|
9
|
+
className,
|
|
10
|
+
filter,
|
|
11
|
+
panel,
|
|
12
|
+
name,
|
|
13
|
+
}: TranslationRenderer) => {
|
|
14
|
+
const { uuid } = useNavigation();
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<PaginationProvider
|
|
18
|
+
uuid={uuid}
|
|
19
|
+
panel={panel}
|
|
20
|
+
tab={name}
|
|
21
|
+
filter={filter}
|
|
22
|
+
content={content}
|
|
23
|
+
isEditable={false}
|
|
24
|
+
>
|
|
25
|
+
<TranslationEditor className={className} />
|
|
26
|
+
</PaginationProvider>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { notFound } from 'next/navigation';
|
|
4
|
+
|
|
5
|
+
export const AiSummarizerPage = () => {
|
|
6
|
+
const src = process.env.NEXT_PUBLIC_AI_SUMMARIZER_URL;
|
|
7
|
+
if (!src) {
|
|
8
|
+
return notFound();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return <iframe src={src} className="size-full" title="AI Summarizer" />;
|
|
12
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@eightyfourthousand/design-system';
|
|
4
|
+
import { TranslationEditorContent } from '../editor';
|
|
5
|
+
import { TranslationRenderer } from './types';
|
|
6
|
+
import { BibliographyEntries } from '@eightyfourthousand/data-access';
|
|
7
|
+
import type { GlossaryTermsPage } from '@eightyfourthousand/client-graphql';
|
|
8
|
+
import { ReactElement, useRef } from 'react';
|
|
9
|
+
import { useNavigation } from './NavigationProvider';
|
|
10
|
+
import { GlossaryTermList, GlossaryPaginationProvider } from './glossary';
|
|
11
|
+
import { BibliographyList } from './bibliography';
|
|
12
|
+
import { cn, useIsMobile } from '@eightyfourthousand/lib-utils';
|
|
13
|
+
import { useScrollPositionRestore } from './hooks/useScrollPositionRestore';
|
|
14
|
+
|
|
15
|
+
export const BackMatterPanel = ({
|
|
16
|
+
workUuid,
|
|
17
|
+
endnotes,
|
|
18
|
+
glossary,
|
|
19
|
+
bibliography,
|
|
20
|
+
abbreviations,
|
|
21
|
+
renderTranslation,
|
|
22
|
+
}: {
|
|
23
|
+
workUuid: string;
|
|
24
|
+
endnotes: TranslationEditorContent;
|
|
25
|
+
glossary: GlossaryTermsPage;
|
|
26
|
+
bibliography: BibliographyEntries;
|
|
27
|
+
abbreviations: TranslationEditorContent;
|
|
28
|
+
renderTranslation: (
|
|
29
|
+
params: TranslationRenderer,
|
|
30
|
+
) => ReactElement<TranslationRenderer>;
|
|
31
|
+
}) => {
|
|
32
|
+
const { panels, updatePanel } = useNavigation();
|
|
33
|
+
const isMobile = useIsMobile();
|
|
34
|
+
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
|
35
|
+
useScrollPositionRestore(
|
|
36
|
+
'right',
|
|
37
|
+
scrollContainerRef,
|
|
38
|
+
panels.right.tab,
|
|
39
|
+
!!panels.right.hash,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const hasGlossary =
|
|
43
|
+
glossary.terms.length > 0 || glossary.hasMoreAfter;
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Tabs
|
|
47
|
+
value={panels.right.tab || 'endnotes'}
|
|
48
|
+
onValueChange={(tabName) => {
|
|
49
|
+
const tab = tabName as
|
|
50
|
+
| 'endnotes'
|
|
51
|
+
| 'glossary'
|
|
52
|
+
| 'bibliography'
|
|
53
|
+
| 'abbreviations';
|
|
54
|
+
updatePanel({ name: 'right', state: { open: true, tab } });
|
|
55
|
+
}}
|
|
56
|
+
defaultValue="endnotes"
|
|
57
|
+
className="w-full gap-0 @container/sidebar"
|
|
58
|
+
>
|
|
59
|
+
<div className="sticky top-0 pt-1 pb-2 z-10 w-full rounded-t bg-background overflow-x-auto text-center">
|
|
60
|
+
<TabsList
|
|
61
|
+
className={cn(
|
|
62
|
+
'w-fit px-6 inline-flex mx-auto rounded-none',
|
|
63
|
+
isMobile && 'ps-12',
|
|
64
|
+
)}
|
|
65
|
+
>
|
|
66
|
+
{endnotes.length > 0 && (
|
|
67
|
+
<TabsTrigger value="endnotes">Notes</TabsTrigger>
|
|
68
|
+
)}
|
|
69
|
+
{hasGlossary && (
|
|
70
|
+
<TabsTrigger value="glossary">Glossary</TabsTrigger>
|
|
71
|
+
)}
|
|
72
|
+
{bibliography.length > 0 && (
|
|
73
|
+
<TabsTrigger value="bibliography">Biblio</TabsTrigger>
|
|
74
|
+
)}
|
|
75
|
+
{abbreviations.length > 0 && (
|
|
76
|
+
<TabsTrigger value="abbreviations">Abbr</TabsTrigger>
|
|
77
|
+
)}
|
|
78
|
+
</TabsList>
|
|
79
|
+
</div>
|
|
80
|
+
<div className="px-2">
|
|
81
|
+
<div
|
|
82
|
+
ref={scrollContainerRef}
|
|
83
|
+
className="overflow-auto md:h-[calc(100vh-8.5rem)] h-[calc(100vh-4rem)] rounded bg-surface"
|
|
84
|
+
data-panel="right"
|
|
85
|
+
>
|
|
86
|
+
<div className="rounded ps-10 pe-4 max-w-readable mx-auto">
|
|
87
|
+
{endnotes.length > 0 && (
|
|
88
|
+
<TabsContent
|
|
89
|
+
value="endnotes"
|
|
90
|
+
forceMount
|
|
91
|
+
className="data-[state=inactive]:hidden"
|
|
92
|
+
>
|
|
93
|
+
{renderTranslation({
|
|
94
|
+
content: endnotes,
|
|
95
|
+
className: 'block',
|
|
96
|
+
name: 'endnotes',
|
|
97
|
+
panel: 'right',
|
|
98
|
+
})}
|
|
99
|
+
</TabsContent>
|
|
100
|
+
)}
|
|
101
|
+
{hasGlossary && (
|
|
102
|
+
<TabsContent
|
|
103
|
+
value="glossary"
|
|
104
|
+
forceMount
|
|
105
|
+
className="pb-8 data-[state=inactive]:hidden"
|
|
106
|
+
>
|
|
107
|
+
<GlossaryPaginationProvider
|
|
108
|
+
workUuid={workUuid}
|
|
109
|
+
initialPage={glossary}
|
|
110
|
+
>
|
|
111
|
+
<GlossaryTermList />
|
|
112
|
+
</GlossaryPaginationProvider>
|
|
113
|
+
</TabsContent>
|
|
114
|
+
)}
|
|
115
|
+
{bibliography.length > 0 && (
|
|
116
|
+
<TabsContent
|
|
117
|
+
value="bibliography"
|
|
118
|
+
forceMount
|
|
119
|
+
className="pb-8 data-[state=inactive]:hidden"
|
|
120
|
+
>
|
|
121
|
+
<BibliographyList content={bibliography} />
|
|
122
|
+
</TabsContent>
|
|
123
|
+
)}
|
|
124
|
+
{abbreviations.length > 0 && (
|
|
125
|
+
<TabsContent
|
|
126
|
+
value="abbreviations"
|
|
127
|
+
forceMount
|
|
128
|
+
className="data-[state=inactive]:hidden"
|
|
129
|
+
>
|
|
130
|
+
{renderTranslation({
|
|
131
|
+
content: abbreviations,
|
|
132
|
+
className: 'block',
|
|
133
|
+
name: 'abbreviations',
|
|
134
|
+
panel: 'right',
|
|
135
|
+
})}
|
|
136
|
+
</TabsContent>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</Tabs>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Tabs,
|
|
5
|
+
TabsContent,
|
|
6
|
+
TabsList,
|
|
7
|
+
TabsTrigger,
|
|
8
|
+
} from '@eightyfourthousand/design-system';
|
|
9
|
+
import {
|
|
10
|
+
TranslationEditorContent,
|
|
11
|
+
TranslationEditorContentItem,
|
|
12
|
+
} from '../editor';
|
|
13
|
+
import { Title } from '@eightyfourthousand/data-access';
|
|
14
|
+
import { TitlesRenderer, TranslationRenderer } from './types';
|
|
15
|
+
import { ReactElement, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
16
|
+
import { cn } from '@eightyfourthousand/lib-utils';
|
|
17
|
+
import { useNavigation } from './NavigationProvider';
|
|
18
|
+
import { SourceReader } from './SourceReader';
|
|
19
|
+
import { Imprint } from './Imprint';
|
|
20
|
+
import { TitleDetails } from './titles';
|
|
21
|
+
import {
|
|
22
|
+
capturePassageAnchor,
|
|
23
|
+
findScrollParent,
|
|
24
|
+
usePassageAnchorRestore,
|
|
25
|
+
useScrollPositionRestore,
|
|
26
|
+
} from './hooks/useScrollPositionRestore';
|
|
27
|
+
|
|
28
|
+
export const BodyPanel = ({
|
|
29
|
+
titles,
|
|
30
|
+
frontMatter,
|
|
31
|
+
body,
|
|
32
|
+
renderTitles,
|
|
33
|
+
renderTranslation,
|
|
34
|
+
limitWhenNoTranslation = false,
|
|
35
|
+
}: {
|
|
36
|
+
titles: Title[];
|
|
37
|
+
frontMatter: TranslationEditorContent;
|
|
38
|
+
body: TranslationEditorContent;
|
|
39
|
+
renderTitles: (params: TitlesRenderer) => ReactElement<TitlesRenderer>;
|
|
40
|
+
renderTranslation: (
|
|
41
|
+
params: TranslationRenderer,
|
|
42
|
+
) => ReactElement<TranslationRenderer>;
|
|
43
|
+
limitWhenNoTranslation?: boolean;
|
|
44
|
+
}) => {
|
|
45
|
+
const {
|
|
46
|
+
panels,
|
|
47
|
+
imprint,
|
|
48
|
+
showOuterContent,
|
|
49
|
+
updatePanel,
|
|
50
|
+
setHasTranslationContent,
|
|
51
|
+
} = useNavigation();
|
|
52
|
+
const tabsRef = useRef<HTMLDivElement>(null);
|
|
53
|
+
const scrollContainerRef = useRef<HTMLElement | null>(null);
|
|
54
|
+
const hasTranslationContent = useMemo(() => {
|
|
55
|
+
if (!limitWhenNoTranslation) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(body)) {
|
|
59
|
+
return body.length > 0;
|
|
60
|
+
}
|
|
61
|
+
return Boolean(body);
|
|
62
|
+
}, [body, limitWhenNoTranslation]);
|
|
63
|
+
const activeTab =
|
|
64
|
+
panels.main.tab || (hasTranslationContent ? 'translation' : 'source');
|
|
65
|
+
const safeTab =
|
|
66
|
+
!hasTranslationContent &&
|
|
67
|
+
(activeTab === 'translation' || activeTab === 'compare')
|
|
68
|
+
? 'source'
|
|
69
|
+
: activeTab;
|
|
70
|
+
|
|
71
|
+
const hasAlignments = useMemo(() => {
|
|
72
|
+
if (!hasTranslationContent) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
const passages = body as TranslationEditorContentItem[];
|
|
76
|
+
return passages.some(
|
|
77
|
+
(item) => Object.keys(item.attrs?.alignments || {}).length > 0,
|
|
78
|
+
);
|
|
79
|
+
}, [body, hasTranslationContent]);
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!limitWhenNoTranslation) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
setHasTranslationContent(hasTranslationContent);
|
|
86
|
+
}, [hasTranslationContent, limitWhenNoTranslation, setHasTranslationContent]);
|
|
87
|
+
|
|
88
|
+
const tabsRefCallback = useCallback((node: HTMLDivElement | null) => {
|
|
89
|
+
tabsRef.current = node;
|
|
90
|
+
// Only track scroll for visible instances (skip the hidden mobile duplicate)
|
|
91
|
+
scrollContainerRef.current =
|
|
92
|
+
node && node.offsetParent !== null ? findScrollParent(node) : null;
|
|
93
|
+
}, []);
|
|
94
|
+
|
|
95
|
+
const passageAnchorRef = usePassageAnchorRestore(
|
|
96
|
+
scrollContainerRef,
|
|
97
|
+
safeTab,
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
useScrollPositionRestore(
|
|
101
|
+
'main',
|
|
102
|
+
scrollContainerRef,
|
|
103
|
+
safeTab,
|
|
104
|
+
!!panels.main.hash,
|
|
105
|
+
passageAnchorRef,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
const theTitles = useMemo(
|
|
109
|
+
() => (
|
|
110
|
+
<div className="mt-16 mb-8">
|
|
111
|
+
{renderTitles({
|
|
112
|
+
titles,
|
|
113
|
+
imprint,
|
|
114
|
+
name: safeTab,
|
|
115
|
+
})}
|
|
116
|
+
</div>
|
|
117
|
+
),
|
|
118
|
+
|
|
119
|
+
[titles, imprint, renderTitles, safeTab],
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<Tabs
|
|
124
|
+
ref={tabsRefCallback}
|
|
125
|
+
value={safeTab}
|
|
126
|
+
onValueChange={(tabName) => {
|
|
127
|
+
const tab = tabName as 'translation' | 'source' | 'compare' | 'front';
|
|
128
|
+
// Capture a passage anchor when leaving translation or compare.
|
|
129
|
+
// These tabs contain passage elements whose UUID lets us realign
|
|
130
|
+
// scroll position after the tab switch — immune to the scrollTop
|
|
131
|
+
// clamping that happens when hidden content changes scroll height.
|
|
132
|
+
const current = safeTab;
|
|
133
|
+
const passageTabs = ['translation', 'compare'];
|
|
134
|
+
if (scrollContainerRef.current && passageTabs.includes(current)) {
|
|
135
|
+
passageAnchorRef.current = capturePassageAnchor(
|
|
136
|
+
scrollContainerRef.current,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
updatePanel({ name: 'main', state: { open: true, tab } });
|
|
140
|
+
}}
|
|
141
|
+
defaultValue={hasTranslationContent ? 'translation' : 'source'}
|
|
142
|
+
className="px-12 w-full"
|
|
143
|
+
>
|
|
144
|
+
<div className="sticky top-0.75 -mt-28 z-10 w-full overflow-x-auto text-center">
|
|
145
|
+
<TabsList className="w-fit inline-flex">
|
|
146
|
+
<TabsTrigger value="front">Front</TabsTrigger>
|
|
147
|
+
{hasTranslationContent && (
|
|
148
|
+
<TabsTrigger value="translation">Translation</TabsTrigger>
|
|
149
|
+
)}
|
|
150
|
+
{hasTranslationContent && hasAlignments && (
|
|
151
|
+
<TabsTrigger value="compare">Compare</TabsTrigger>
|
|
152
|
+
)}
|
|
153
|
+
<TabsTrigger value="source">Source</TabsTrigger>
|
|
154
|
+
</TabsList>
|
|
155
|
+
</div>
|
|
156
|
+
{showOuterContent ? theTitles : null}
|
|
157
|
+
<TabsContent
|
|
158
|
+
value="front"
|
|
159
|
+
forceMount
|
|
160
|
+
className={cn(safeTab !== 'front' && 'hidden')}
|
|
161
|
+
>
|
|
162
|
+
<div className="w-full max-w-readable mx-auto">
|
|
163
|
+
{showOuterContent ? (
|
|
164
|
+
<div className="mb-12">
|
|
165
|
+
{imprint && <TitleDetails imprint={imprint} />}
|
|
166
|
+
<Imprint imprint={imprint} />
|
|
167
|
+
</div>
|
|
168
|
+
) : null}
|
|
169
|
+
{renderTranslation({
|
|
170
|
+
content: frontMatter,
|
|
171
|
+
className: 'block',
|
|
172
|
+
name: 'front',
|
|
173
|
+
panel: 'main',
|
|
174
|
+
})}
|
|
175
|
+
</div>
|
|
176
|
+
</TabsContent>
|
|
177
|
+
{/* Single editor instance shared between Translation and Compare tabs.
|
|
178
|
+
Passage node views reactively show/hide the Tibetan source column
|
|
179
|
+
based on the active tab from NavigationContext. */}
|
|
180
|
+
{hasTranslationContent && (
|
|
181
|
+
<TabsContent
|
|
182
|
+
value="translation"
|
|
183
|
+
forceMount
|
|
184
|
+
className={cn(
|
|
185
|
+
safeTab !== 'translation' && safeTab !== 'compare' && 'hidden',
|
|
186
|
+
)}
|
|
187
|
+
>
|
|
188
|
+
<div
|
|
189
|
+
className={cn(
|
|
190
|
+
'w-full mx-auto',
|
|
191
|
+
safeTab === 'compare'
|
|
192
|
+
? '2xl:max-w-7xl max-w-5xl mt-8'
|
|
193
|
+
: 'max-w-readable',
|
|
194
|
+
)}
|
|
195
|
+
>
|
|
196
|
+
{renderTranslation({
|
|
197
|
+
content: body,
|
|
198
|
+
className: 'block',
|
|
199
|
+
name: 'translation',
|
|
200
|
+
panel: 'main',
|
|
201
|
+
})}
|
|
202
|
+
</div>
|
|
203
|
+
</TabsContent>
|
|
204
|
+
)}
|
|
205
|
+
<TabsContent
|
|
206
|
+
value="source"
|
|
207
|
+
forceMount
|
|
208
|
+
className="pb-2 data-[state=inactive]:hidden"
|
|
209
|
+
>
|
|
210
|
+
<SourceReader />
|
|
211
|
+
</TabsContent>
|
|
212
|
+
</Tabs>
|
|
213
|
+
);
|
|
214
|
+
};
|