Skip to content

Commit

Permalink
Merge pull request #825 from nextstrain/feat/limit-insertions
Browse files Browse the repository at this point in the history
feat(web): limit tooltips to 20 insertions max
  • Loading branch information
rneher authored Jun 2, 2022
2 parents c4ce28e + d0db03a commit 4b7ac6f
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export function ListOfInsertionsNuc({ insertions }: ListOfInsertionsNucProps) {
</tr>
)

const tbody = insertions.map(({ pos, ins }) => (
const insertionsTruncated = insertions.slice(0, 20)
const tbody = insertionsTruncated.map(({ pos, ins }) => (
<tr key={pos}>
<TdNormal className="text-center">{pos + 1}</TdNormal>
<TdNormal className="text-center">{ins.length}</TdNormal>
Expand All @@ -139,6 +140,16 @@ export function ListOfInsertionsNuc({ insertions }: ListOfInsertionsNucProps) {
</tr>
))

if (insertionsTruncated.length < insertions.length) {
tbody.push(
<tr key="trunc">
<td colSpan={3} className="text-center">
{'...truncated'}
</td>
</tr>,
)
}

return { thead, tbody }
}, [insertions, t])

Expand Down Expand Up @@ -173,7 +184,8 @@ export function ListOfInsertionsAa({ insertions }: ListOfInsertionsAaProps) {
</tr>
)

const tbody = insertions.map(({ pos, ins, gene }) => (
const insertionsTruncated = insertions.slice(0, 20)
const tbody = insertionsTruncated.map(({ pos, ins, gene }) => (
<tr key={pos}>
<TdNormal className="text-center">{gene}</TdNormal>
<TdNormal className="text-center">{pos + 1}</TdNormal>
Expand All @@ -184,6 +196,16 @@ export function ListOfInsertionsAa({ insertions }: ListOfInsertionsAaProps) {
</tr>
))

if (insertionsTruncated.length < insertions.length) {
tbody.push(
<tr key="trunc">
<td colSpan={3} className="text-center">
{'...truncated'}
</td>
</tr>,
)
}

return { thead, tbody }
}, [insertions, t])

Expand Down

1 comment on commit 4b7ac6f

@vercel
Copy link

@vercel vercel bot commented on 4b7ac6f Jun 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nextclade – ./

nextclade-nextstrain.vercel.app
nextclade-git-master-nextstrain.vercel.app
nextclade.vercel.app

Please sign in to comment.