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

Fix notes field breaking table in classifications editor preview #3055

Merged
Changes from all commits
Commits
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
55 changes: 29 additions & 26 deletions site/gatsby-site/src/components/taxa/Taxonomy.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,28 +112,27 @@
${singleColumn ? 'grid-cols-[1fr_3fr]' : 'lg:grid-cols-[repeat(4,_auto)]'}
`}
>
{canEdit && (
<div key={'NOTES'} className="tw-classification-container">
<div className="tw-field">
<Tooltip content={'Admin notes'}>
<p>{'Notes'}</p>
</Tooltip>
</div>
<Markdown>{taxonomy.notes}</Markdown>
</div>
)}
{(showAllClassifications ? taxonomy.classificationsArray : topClassifications)
.filter(
(field) => !(field.renderAs === 'description_toggle' && field.value == 'No')
{['dummy-notes']
.concat(
(showAllClassifications
? taxonomy.classificationsArray
: topClassifications.slice(canEdit ? 1 : 0)

Check warning on line 119 in site/gatsby-site/src/components/taxa/Taxonomy.js

View check run for this annotation

Codecov / codecov/patch

site/gatsby-site/src/components/taxa/Taxonomy.js#L118-L119

Added lines #L118 - L119 were not covered by tests
)
.filter(
(field) => !(field.renderAs === 'description_toggle' && field.value == 'No')
)
.map((field) => {

Check warning on line 124 in site/gatsby-site/src/components/taxa/Taxonomy.js

View check run for this annotation

Codecov / codecov/patch

site/gatsby-site/src/components/taxa/Taxonomy.js#L124

Added line #L124 was not covered by tests
if (field.renderAs === 'description_toggle') {
return { ...field, value: field.longDescription };

Check warning on line 126 in site/gatsby-site/src/components/taxa/Taxonomy.js

View check run for this annotation

Codecov / codecov/patch

site/gatsby-site/src/components/taxa/Taxonomy.js#L126

Added line #L126 was not covered by tests
}

return field;

Check warning on line 129 in site/gatsby-site/src/components/taxa/Taxonomy.js

View check run for this annotation

Codecov / codecov/patch

site/gatsby-site/src/components/taxa/Taxonomy.js#L129

Added line #L129 was not covered by tests
})
)
.map((field) => {
if (field.renderAs === 'description_toggle') {
return { ...field, value: field.longDescription };
}

return field;
})
.filter((field) => canEdit || field !== 'dummy-notes')
.map((field, i) => {
const showNotes = field === 'dummy-notes';

Check warning on line 134 in site/gatsby-site/src/components/taxa/Taxonomy.js

View check run for this annotation

Codecov / codecov/patch

site/gatsby-site/src/components/taxa/Taxonomy.js#L134

Added line #L134 was not covered by tests

const isFirst = singleColumn ? i == 0 : i < 2;

const isLast = singleColumn
Expand All @@ -154,11 +153,15 @@
${isLast ? 'border-b-0' : ''}
`}
>
<Tooltip content={field.shortDescription}>
<p>
{field.name} {field.renderAs}
</p>
</Tooltip>
{showNotes ? (
<p>Notes</p>

Check warning on line 157 in site/gatsby-site/src/components/taxa/Taxonomy.js

View check run for this annotation

Codecov / codecov/patch

site/gatsby-site/src/components/taxa/Taxonomy.js#L157

Added line #L157 was not covered by tests
) : (
<Tooltip content={field.shortDescription}>

Check warning on line 159 in site/gatsby-site/src/components/taxa/Taxonomy.js

View check run for this annotation

Codecov / codecov/patch

site/gatsby-site/src/components/taxa/Taxonomy.js#L159

Added line #L159 was not covered by tests
<p>
{field.name} {field.renderAs}
</p>
</Tooltip>
)}
</div>
<Markdown
className={`
Expand All @@ -172,7 +175,7 @@
${isLast ? 'border-b-0' : ''}
`}
>
{field.value}
{showNotes ? taxonomy.notes : field.value}

Check warning on line 178 in site/gatsby-site/src/components/taxa/Taxonomy.js

View check run for this annotation

Codecov / codecov/patch

site/gatsby-site/src/components/taxa/Taxonomy.js#L178

Added line #L178 was not covered by tests
</Markdown>
</>
);
Expand Down
Loading