Skip to content

Commit

Permalink
Update document view to closely match journal view
Browse files Browse the repository at this point in the history
- Center ATBD title
- Rename section "Performance Assessment Validation" to "Performance
  Assessment"
- Update title for "Performance Assessment" subsections to match the
  journal pdf
- Rename "Data Access" to "Algorithm Implementation"
- Update title for "Algorithm Implementation" subsections to match the
  journal pdf
- Rename "Contacts" section to "Contact Details"
- Center author affiliations in the journal pdf export
- Remove numbering from the "References" section in journal pdf export
  • Loading branch information
frozenhelium committed Aug 14, 2024
1 parent 418fc75 commit 8b28786
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ const DocumentHeading = styled.h1`
const AuthorsSection = styled.div`
display: flex;
flex-direction: column;
gap: 2rem;
`;
const AuthorsSectionHeader = styled.div`
align-items: center;
gap: 1.5rem;
text-align: center;
`;

Expand Down Expand Up @@ -594,7 +593,7 @@ function JournalPdfPreview() {
<PreviewContainer ref={contentRef}>
<DocumentHeading> {resolveTitle(atbd.title)} </DocumentHeading>
<AuthorsSection>
<AuthorsSectionHeader>{contacts?.items}</AuthorsSectionHeader>
<div>{contacts?.items}</div>
<div>
{contacts?.affiliations_list.map((affiliation, i) => (
// eslint-disable-next-line react/no-array-index-key
Expand Down Expand Up @@ -815,7 +814,7 @@ function JournalPdfPreview() {
</Section>
)}
{referencesVisible && (
<Section id='references' title='References'>
<Section id='references' title='References' skipNumbering>
<ReferencesList>{referenceList}</ReferencesList>
</Section>
)}
Expand Down
15 changes: 4 additions & 11 deletions app/assets/scripts/components/documents/pdf-preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import DocumentTitle from '../single-view/document-title';
import { DocumentProse } from '../single-view/document-content';
import { ScrollAnchorProvider } from '../single-view/scroll-manager';
import { applyNumberCaptionsToDocument } from '../../../utils/apply-number-captions-to-document';
import { isDefined } from '../../../utils/common';

const TocHeader = styled.h1`
border-bottom: 3px solid #000;
Expand Down Expand Up @@ -65,7 +66,6 @@ function generateTocAndHeadingNumbering(content) {
currentHeading,
currentLevel,
sectionContainer,
parentContainer,
parentHeadingNumber
) {
const currentSubHeadings = [];
Expand Down Expand Up @@ -148,7 +148,6 @@ function generateTocAndHeadingNumbering(content) {
subHeading,
currentLevel + 1,
subHeadingSections,
subHeading.parentNode,
headingNumber
);
});
Expand Down Expand Up @@ -192,13 +191,7 @@ function generateTocAndHeadingNumbering(content) {

const sectionTitle = getTitleElement(heading.id, heading.innerText);
section.append(sectionTitle);
generateSubHeadings(
heading,
2,
section,
heading.parentNode,
headingNumber
);
generateSubHeadings(heading, 2, section, headingNumber);
});
}

Expand Down Expand Up @@ -239,11 +232,11 @@ function PdfPreview() {
setPreviewReady(true);
}

if (atbd.status === 'succeeded') {
if (atbd.status === 'succeeded' && isDefined(atbd.data)) {
setDocument(applyNumberCaptionsToDocument(atbd.data.document));
waitForImages();
}
}, [atbd.status]);
}, [atbd.data, atbd.status]);

// This useEffect is responsible for generating the ToC and numbering
// after the document is transformed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ const htmlAtbdContentSections = [
),
children: [
{
label: 'Assumptions',
label: 'Scientific Theory Assumptions',
id: 'scientific_theory_assumptions',
editorSubsections: (document, { id }) =>
subsectionsFromSlateDocument(
Expand Down Expand Up @@ -557,7 +557,7 @@ const htmlAtbdContentSections = [
),
children: [
{
label: 'Assumptions',
label: 'Mathematical Theory Assumptions',
id: 'mathematical_theory_assumptions',
editorSubsections: (document, { id }) =>
subsectionsFromSlateDocument(
Expand Down Expand Up @@ -695,12 +695,12 @@ const htmlAtbdContentSections = [
)
},
{
label: 'Performance Assessment Validation',
label: 'Performance Assessment',
id: 'validation',
render: AtbdSectionPassThrough,
children: [
{
label: 'Performance Assessment Validation Methods',
label: 'Validation Methods',
id: 'validation_method',
editorSubsections: (document, { id }) =>
subsectionsFromSlateDocument(
Expand All @@ -720,7 +720,7 @@ const htmlAtbdContentSections = [
)
},
{
label: 'Performance Assessment Validation Uncertainties',
label: 'Uncertainties',
id: 'validation_uncert',
editorSubsections: (document, { id }) =>
subsectionsFromSlateDocument(
Expand All @@ -742,7 +742,7 @@ const htmlAtbdContentSections = [
)
},
{
label: 'Performance Assessment Validation Errors',
label: 'Validation Errors',
id: 'validation_err',
editorSubsections: (document, { id }) =>
subsectionsFromSlateDocument(
Expand All @@ -764,12 +764,12 @@ const htmlAtbdContentSections = [
]
},
{
label: 'Data Access',
label: 'Algorithm Implementation',
id: 'data_access',
render: AtbdSectionPassThrough,
children: [
{
label: 'Input Data Data Access',
label: 'Input Data Access',
id: 'data_access_input_data',
render: (props) => (
<FragmentWithOptionalEditor
Expand Down Expand Up @@ -804,7 +804,7 @@ const htmlAtbdContentSections = [
}
},
{
label: 'Output Data Data Access',
label: 'Output Data Access',
id: 'data_access_output_data',
render: (props) => (
<FragmentWithOptionalEditor
Expand Down Expand Up @@ -998,7 +998,7 @@ const htmlAtbdContentSections = [
]
},
{
label: 'Contacts',
label: 'Contact Details',
id: 'contacts',
render: ({ element, children, atbd, printMode }) => (
<AtbdSection
Expand Down Expand Up @@ -1219,7 +1219,7 @@ const pdfAtbdContentSections = [
)
},
{
label: 'Contacts',
label: 'Contact Details',
id: 'contacts',
render: ({ element, children, atbd, printMode }) => (
<AtbdSection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const DocumentHeader = styled.header`
`;

const DocumentHeading = styled(Heading)`
text-align: center;
margin: 0;
`;

Expand Down

0 comments on commit 8b28786

Please sign in to comment.