Skip to content

Commit

Permalink
feat(web): limit tooltips to 20 insertions max
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-aksamentov committed May 28, 2022
1 parent 939b57b commit d0db03a
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

0 comments on commit d0db03a

Please sign in to comment.