Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Fix issue 17 #578

Merged
merged 7 commits into from
Jul 25, 2020
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
126 changes: 68 additions & 58 deletions client/src/components/AddToGroupModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,66 +154,76 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
overlayClassName={style.overlay}
>
<h1 className={style.title}>Add to Group</h1>
<div className={style.searchRow}>
<ZoomIcon className={style.zoomIcon} />
<input
className={style.search}
onChange={({ target }) => {
setFilter(target.value);
setImmediate(() => target.focus());
}}
placeholder="Search or create group"
value={filter}
disabled={loadingGroups}
/>
<Button
className={style.createButton}
onClick={createGroup}
disabled={creatingGroup}
>
{creatingGroup ? "Creating..." : "+ Create"}
</Button>
</div>
<h3 className={style.subTitle}>
My groups{loadingGroups && " (Loading...)"}
</h3>
<div className={style.groups}>
{!loadingGroups &&
myGroups
.filter((g) => g.name.toLowerCase().includes(filter.toLowerCase()))
.map((g) => (
<Group
checked={g.isSelected === true}
group={g}
key={g.id}
onSwitch={() => switchSelected(g)}
/>
))}
</div>
{myGroups.filter((g) =>
g.name.toLowerCase().includes(filter.toLowerCase())
).length === 0 &&
!loadingGroups && <div className={style.message}>No results found</div>}
<h3 className={style.subTitle}>
Other Groups{loadingGroups && " (Loading...)"}
</h3>
<div className={style.groups}>
{!loadingGroups &&
otherGroups
.filter((g) => g.name.toLowerCase().includes(filter.toLowerCase()))
.map((g) => (
<Group
checked={g.isSelected === true}
group={g}
key={g.id}
onSwitch={() => switchSelected(g)}
/>
))}
<div className={style.searchRow}>
<ZoomIcon className={style.zoomIcon} />
<input
className={style.search}
onChange={({ target }) => {
setFilter(target.value);
setImmediate(() => target.focus());
}}
placeholder="Search or create group"
value={filter}
disabled={loadingGroups}
/>
<Button
className={style.createButton}
onClick={createGroup}
disabled={creatingGroup}
>
{creatingGroup ? "Creating..." : "+ Create"}
</Button>
</div>
<h3 className={style.subTitle}>
My groups{loadingGroups && " (Loading...)"}
</h3>
<div>
{!loadingGroups &&
myGroups
.filter((g) =>
g.name.toLowerCase().includes(filter.toLowerCase())
)
.map((g) => (
<Group
checked={g.isSelected === true}
group={g}
key={g.id}
onSwitch={() => switchSelected(g)}
/>
))}
</div>
{myGroups.filter((g) =>
g.name.toLowerCase().includes(filter.toLowerCase())
).length === 0 &&
!loadingGroups && (
<div className={style.message}>No results found</div>
)}
<h3 className={style.subTitle}>
Other Groups{loadingGroups && " (Loading...)"}
</h3>
<div>
{!loadingGroups &&
otherGroups
.filter((g) =>
g.name.toLowerCase().includes(filter.toLowerCase())
)
.map((g) => (
<Group
checked={g.isSelected === true}
group={g}
key={g.id}
onSwitch={() => switchSelected(g)}
/>
))}
</div>
{otherGroups.filter((g) =>
g.name.toLowerCase().includes(filter.toLowerCase())
).length === 0 &&
!loadingGroups && (
<div className={style.message}>No results found</div>
)}
</div>
{otherGroups.filter((g) =>
g.name.toLowerCase().includes(filter.toLowerCase())
).length === 0 &&
!loadingGroups && <div className={style.message}>No results found</div>}
<div className={style.buttons}>
<Button onClick={onCancel} disabled={updatingGroups || creatingGroup}>
Cancel
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/AddToGroupModal/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

.groups {
margin: 0 -30px;
max-height: 150px;
max-height: calc(95vh - 157px);
overflow-y: auto;
}

Expand All @@ -68,10 +68,12 @@
.searchRow {
display: flex;
position: relative;
margin: 0 30px;
}

.subTitle {
@include h3;
margin-left: 30px;
}

.title {
Expand All @@ -88,4 +90,5 @@
.message {
color: $textColor2;
font: 400 12pt/1.25 Inter;
margin-left: 30px;
}
Loading