Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production release #589

Merged
merged 27 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a6686cc
adds support for multiple initials in author names
kamicut Mar 18, 2024
c5b7e71
remove extra space
kamicut Mar 18, 2024
f214d90
Merge pull request #577 from NASA-IMPACT/fix/827-remove-extra-commas
wrynearson Mar 18, 2024
d5341b2
re-add space in between multiple authors
wrynearson Mar 19, 2024
529ea1c
Merge pull request #578 from NASA-IMPACT/827-add-space
wrynearson Mar 19, 2024
2076940
add accessibility statement
kamicut Mar 19, 2024
08c6a0b
Merge pull request #579 from NASA-IMPACT/feature/acc-statement
wrynearson Mar 19, 2024
b24bf3d
use proper author format in citation
kamicut Mar 20, 2024
075084d
add DOI logic
kamicut Mar 21, 2024
fd59d11
fix instructions
kamicut Mar 26, 2024
a89ef35
Merge pull request #581 from NASA-IMPACT/fix/825-citation-format
wrynearson Mar 26, 2024
c32fd8a
remove parentheses around inline citations
wrynearson Apr 10, 2024
7f54228
Merge pull request #582 from NASA-IMPACT/784/remove_citation_parentheses
wrynearson Apr 10, 2024
79e035f
Update quickstart.md
bwbaker1 Jun 7, 2024
2128ca3
Replace input/output variables list with table
vgeorge Jun 20, 2024
8f7054a
Update app/assets/scripts/components/documents/single-view/common/var…
vgeorge Jun 20, 2024
7ab2099
Merge pull request #584 from NASA-IMPACT/enhance/add-variables-table
vgeorge Jun 20, 2024
1c09e6b
Simplify staging deploy workflow
vgeorge Jun 25, 2024
059c1d1
Add check for dist folder
vgeorge Jun 25, 2024
f4e30e7
List dist
vgeorge Jun 25, 2024
6d05d70
Remove step
vgeorge Jun 25, 2024
6101377
Remove helper step
vgeorge Jun 25, 2024
402dab1
Show only published ATBDs in the documents view
sunu Jul 22, 2024
aedb713
Fix captions in export
frozenhelium Aug 5, 2024
0bc4656
Merge pull request #587 from NASA-IMPACT/show-only-published-docs-in-…
wrynearson Aug 6, 2024
418fc75
Merge pull request #583 from NASA-IMPACT/bwbaker1-patch-1
wrynearson Aug 12, 2024
f27bf4d
Merge pull request #590 from NASA-IMPACT/fix/pdf-caption
wrynearson Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 1 addition & 35 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy Staging - Surge.sh
on:
push:
branches:
- 'develop'
- 'develop'

env:
NODE: 14
Expand Down Expand Up @@ -34,46 +34,12 @@ jobs:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Cache dist
uses: actions/cache@v2
id: cache-dist
with:
path: dist
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.workflow }}-${{ github.sha }}

- name: Install
run: yarn install

- name: Build staging
run: yarn stage

deploy:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Restore node_modules
uses: actions/cache@v2
id: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}

- name: Restore dist cache
uses: actions/cache@v2
id: cache-dist
with:
path: dist
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.workflow }}-${{ github.sha }}

- name: Use Node.js ${{ env.NODE }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE }}

- name: Deploy Staging to Surge
run: |
cp ./dist/index.html ./dist/200.html
Expand Down
12 changes: 11 additions & 1 deletion app/assets/scripts/components/common/page-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const PageFooterSelf = styled.footer`

const Colophon = styled.p`
display: grid;
grid-template-columns: minmax(min-content, max-content) 1fr;
grid-template-columns: minmax(min-content, max-content) 1fr 1fr;
grid-gap: ${glsp(1)};
font-size: 0.875rem;
line-height: 1rem;
Expand All @@ -49,6 +49,10 @@ const CreditsLink = styled.a`
}
`;

const AccessibilityLink = styled.a`
font-weight: ${themeVal('type.base.regular')};
`;

const VersionInfo = styled.span`
margin-left: auto;
opacity: 0.64;
Expand All @@ -70,6 +74,12 @@ function PageFooter() {
</span>
<time dateTime={nowDate.getFullYear()}>{nowDate.getFullYear()}</time>
</CreditsLink>
<AccessibilityLink
href='https://www.nasa.gov/accessibility/'
title='Accessibility Statement'
>
<span>Accessibility Statement</span>
</AccessibilityLink>
<Tip
tag={VersionInfo}
delay={1000}
Expand Down
43 changes: 22 additions & 21 deletions app/assets/scripts/components/documents/citation.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { FormHelperMessage } from '@devseed-ui/form';

import getDocumentIdKey from './get-document-id-key';
import { documentView } from '../../utils/url-creator';
import { formatAuthors } from '../../utils/references';
import config from '../../config';
const { baseUrl } = config;

// Symbol to define that the description should come from the strings file.
export const formStringSymbol = Symbol.for('form string');
Expand All @@ -16,8 +19,8 @@ export const citationFields = [
description: formStringSymbol,
helper: (
<FormHelperMessage>
Separate values with <em>and</em> (e.g., John Doe <em>and</em> Jane
Doe).
Separate values with <em>and</em> (e.g. Doe, John <em>and</em> Doe,
Jane).
</FormHelperMessage>
)
},
Expand All @@ -27,8 +30,8 @@ export const citationFields = [
description: formStringSymbol,
helper: (
<FormHelperMessage>
Separate values with <em>and</em> (e.g., John Doe <em>and</em> Jane
Doe).
Separate values with <em>and</em> (e.g. Doe, John <em>and</em> Doe,
Jane).
</FormHelperMessage>
)
},
Expand Down Expand Up @@ -114,7 +117,8 @@ function getCitationDocUrl(atbd) {
return citation.online_resource;
}

return `${window.location.origin}${documentView(atbd)}`;
const publicUrl = baseUrl || window.location.origin;
return `${publicUrl}${documentView(atbd)}`;
}

function getCitationDocVersion(atbd) {
Expand Down Expand Up @@ -151,26 +155,23 @@ export function createBibtexCitation(atbd) {
}

/**
* Creates a comma separated citation from the given atbd.
* Creates a citation from the given atbd.
* Format is:
* Authors. (Publication Date). Title, version. Publisher. (DOC URL or DOI).
*
* @param {object} atbd The document for which to create a citation
* @returns string
*/
export function createStringCitation(atbd) {
const { title, citation } = atbd;
const { dateStr } = getCitationPublicationDate(atbd);
const citationVersion = getCitationDocVersion(atbd);
const { year } = getCitationPublicationDate(atbd);
const authors = formatAuthors(atbd.citation.creators, 'citation');
const title = atbd.title;
const url = getCitationDocUrl(atbd);

return [
title,
citation.creators,
citation.editors,
citation.publisher,
dateStr,
citationVersion,
url
]
.filter(Boolean)
.join(', ');
const doi = atbd.doi;
let docRef = doi ? doi : url;
const publisher = atbd.citation.publisher;
const returnStr = `${authors}. (${year}). ${title}, ${getCitationDocVersion(
atbd
)}. ${publisher}. (${docRef})`;
return returnStr;
}
5 changes: 3 additions & 2 deletions app/assets/scripts/components/documents/hub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { Link } from '../../../styles/clean/link';

import { useAtbds } from '../../../context/atbds-list';
import CreateDocumentButton from '../../documents/create-document-button';
import { PUBLISHED } from '../../documents/status';

export const DocList = styled.ol`
grid-column: content-start / content-end;
Expand All @@ -36,10 +37,10 @@ export const DocListItem = styled.li`
`;

function Documents() {
const { fetchAtbds, atbds } = useAtbds();
const { fetchAtbds, atbds } = useAtbds({ status: PUBLISHED });

useEffect(() => {
fetchAtbds();
fetchAtbds({ status: PUBLISHED });
}, [fetchAtbds]);

// We only want to handle errors when the atbd request fails. Mutation errors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import {
sortReferences
} from '../../../utils/references';
import { applyNumberCaptionsToDocument } from '../../../utils/apply-number-captions-to-document';
import { VariableItem } from '../single-view/document-body';
import { variableNodeType } from '../../../types';
import { VariablesTable } from '../single-view/common/variables-table';

const ReferencesList = styled.ol`
&& {
Expand Down Expand Up @@ -219,28 +218,6 @@ ImplementationDataList.propTypes = {
)
};

function VariablesList({ list }) {
if (!list || list.length === 0) {
return EMPTY_CONTENT_MESSAGE;
}

return (
<DataListContainer>
{list?.map((variable, i) => (
<VariableItem
key={`variable-${i + 1}`}
variable={variable}
element={{ id: `variable-${i}`, label: `Variable #${i + 1}` }}
/>
))}
</DataListContainer>
);
}

VariablesList.propTypes = {
list: T.arrayOf(variableNodeType)
};

function ContactOutput(props) {
const { data } = props;
const { affiliations, contact, roles } = data;
Expand Down Expand Up @@ -721,15 +698,15 @@ function JournalPdfPreview() {
id='algorithm_input_variables'
title='Algorithm Input Variables'
>
<VariablesList list={algorithm_input_variables} />
<VariablesTable variables={algorithm_input_variables} />
</Section>
)}
{algorithmOutputVariablesVisible && (
<Section
id='algorithm_output_variables'
title='Algorithm Output Variables'
>
<VariablesList list={algorithm_output_variables} />
<VariablesTable variables={algorithm_output_variables} />
</Section>
)}
</Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ function PdfPreview() {
setDocument(applyNumberCaptionsToDocument(atbd.data.document));
waitForImages();
}
}, [atbd.status]);
}, [atbd.status, atbd.data]);

// 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
@@ -0,0 +1,91 @@
import React from 'react';
import PropTypes from 'prop-types';
import { EmptySection } from '../document-body';
import SafeReadEditor from '../../../slate/safe-read-editor';
import styled from 'styled-components';
import { VariablePropType } from '../../../../types';

const TableElement = styled.table`
width: 100%;
border-collapse: collapse;
margin: 20px 0;
`;

const Tr = styled.tr`
&:nth-child(even) {
background-color: #f2f2f2;
}
`;

const Th = styled.th`
background-color: rgb(244, 245, 247);
border: 1px solid rgb(193, 199, 208);
padding: 8px;
min-width: 48px;
text-align: left;

> * {
margin: 0;
}
`;

const Td = styled.td`
background-color: rgb(255, 255, 255);
border: 1px solid rgb(193, 199, 208);
padding: 8px;
min-width: 48px;

> * {
margin: 0;
}
`;

const NameTd = styled(Td)`
width: 150px;
`;

const UnitTd = styled(Td)`
width: 100px;
`;

export const VariablesTable = ({ variables }) => {
return (
<TableElement>
<thead>
<Tr>
<Th>Name</Th>
<Th>Long Name</Th>
<Th>Unit</Th>
</Tr>
</thead>
<tbody>
{variables.map((variable) => (
<Tr key={variable.name.children[0].children[0].text}>
<NameTd>
<SafeReadEditor
value={variable.name}
whenEmpty={<EmptySection />}
/>
</NameTd>
<Td>
<SafeReadEditor
value={variable.long_name}
whenEmpty={<EmptySection />}
/>
</Td>
<UnitTd>
<SafeReadEditor
value={variable.unit}
whenEmpty={<EmptySection />}
/>
</UnitTd>
</Tr>
))}
</tbody>
</TableElement>
);
};

VariablesTable.propTypes = {
variables: PropTypes.arrayOf(VariablePropType).isRequired
};
Loading
Loading