Skip to content

Commit

Permalink
#1341 prevent tags panel overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
matej-vavrek committed Feb 15, 2024
1 parent 50ef828 commit 779e80e
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions js/components/preview/ResizableLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ export const ResizableLayout = ({ gridRef, hideProjects, showHistory, onShowHist
: twoRowHeight
: oneRowHeight;

const tagDetailListHeight = preTagList.length * listTagHeight + tagDetailListLayoutHeight;
// limit default tag panel height to not overflow screen by showing of area of max 10 tags
const tagDetailListHeight = (preTagList.length > 10 ? 10 : preTagList.length) * listTagHeight + tagDetailListLayoutHeight;
const tagDetailGridHeight =
Math.ceil(preTagList.length / defaultTagDetailColumnNumber) * absoluteMaxTagLength + tagDetailGridLayoutHeight;
Math.ceil((preTagList.length > 10 ? 10 : preTagList.length) / defaultTagDetailColumnNumber) * absoluteMaxTagLength + tagDetailGridLayoutHeight;

useEffect(() => {
if (sidesOpen.LHS) {
Expand Down Expand Up @@ -201,12 +202,20 @@ export const ResizableLayout = ({ gridRef, hideProjects, showHistory, onShowHist
},
[gridRef, tagDetailsHeight]
);

return (
<div className={classes.root}>
{sidesOpen.LHS && (
<>
<div className={classes.lhs} style={{ width: lhsWidth }}>
<div style={{ height: tagDetailsHeight, overflow: 'auto' }}>
<div style={{
overflow: 'auto',
height: tagDetailsHeight === undefined
? tagDetailView?.tagDetailView === true || tagDetailView === true
? tagDetailGridHeight
: tagDetailListHeight
: tagDetailsHeight
}}>
<TagDetails />
</div>
<Resizer orientation="horizontal" onResize={onTagDetailsResize} />
Expand All @@ -221,9 +230,9 @@ export const ResizableLayout = ({ gridRef, hideProjects, showHistory, onShowHist
height:
tagDetailsHeight === undefined
? tagDetailView?.tagDetailView === true || tagDetailView === true
? screenHeight - tagDetailGridHeight + 'px'
: screenHeight - tagDetailListHeight + 'px'
: screenHeight - tagDetailsHeight - 20 + 'px'
? screenHeight - tagDetailGridHeight - 20
: screenHeight - tagDetailListHeight - 20
: screenHeight - tagDetailsHeight - 20
}}
>
<HitNavigator hideProjects={hideProjects} />
Expand Down

0 comments on commit 779e80e

Please sign in to comment.