Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
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
75 changes: 41 additions & 34 deletions client/src/components/AddToGroupModal/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect } from "react";
import { List } from "react-virtualized";
import { List, AutoSizer } from "react-virtualized";
import PT from "prop-types";

import Button from "../Button";
Expand Down Expand Up @@ -237,24 +237,27 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
<h3 className={style.subTitle}>
My groups{loadingGroups && " (Loading...)"}
</h3>
<div>
{!loadingGroups && (
<List
className={style.groupsList}
width={listWidth}
height={
filteredMyGroups.length > 10
? 450
: filteredMyGroups.length * 45
}
rowCount={filteredMyGroups.length}
rowHeight={45}
rowRenderer={(params) =>
rowRenderer({ ...params, items: filteredMyGroups })
}
/>
)}
</div>

{!loadingGroups && (
<AutoSizer disableHeight>
{() => (
<List
className={style.groupsList}
width={listWidth + 20}
height={
filteredMyGroups.length > 10
? 450
: filteredMyGroups.length * 45
}
rowCount={filteredMyGroups.length}
rowHeight={45}
rowRenderer={(params) =>
rowRenderer({ ...params, items: filteredMyGroups })
}
/>
)}
</AutoSizer>
)}
{myGroups.filter((g) =>
g.name.toLowerCase().includes(filter.toLowerCase())
).length === 0 &&
Expand All @@ -264,22 +267,26 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
<h3 className={style.subTitle}>
Other Groups{loadingGroups && " (Loading...)"}
</h3>
<div>
<div className={style.clear}>
{!loadingGroups && (
<List
className={style.groupsList}
width={listWidth}
height={
filteredOtherGroups.length > 10
? 450
: filteredOtherGroups.length * 45
}
rowCount={filteredOtherGroups.length}
rowHeight={45}
rowRenderer={(params) =>
rowRenderer({ ...params, items: filteredOtherGroups })
}
/>
<AutoSizer disableHeight>
{() => (
<List
className={style.groupsList}
width={listWidth + 20}
height={
filteredOtherGroups.length > 10
? 250
: filteredOtherGroups.length * 45
}
rowCount={filteredOtherGroups.length}
rowHeight={45}
rowRenderer={(params) =>
rowRenderer({ ...params, items: filteredOtherGroups })
}
/>
)}
</AutoSizer>
)}
</div>
{otherGroups.filter((g) =>
Expand Down
7 changes: 6 additions & 1 deletion client/src/components/AddToGroupModal/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
.searchRow {
display: flex;
position: relative;
margin: 0 30px;
margin: 0 10px;
}

.subTitle {
Expand Down Expand Up @@ -123,3 +123,8 @@
visibility: hidden;
}
}

.clear {
padding-right: 15px;
overflow: auto;
}
2 changes: 1 addition & 1 deletion client/src/components/Modal/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
max-width: $screen-md;
overflow: hidden;
padding: 30px;
min-width: 500px;
min-width: 520px;
position: fixed;
top: 50%;
left: 50%;
Expand Down