Skip to content

Commit

Permalink
Narrower sidebar and over-optimizefilter statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
agreenspan24 committed Nov 4, 2021
1 parent 69cb5c9 commit 5d6c287
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 13 additions & 11 deletions src/components/AssignmentTexter/AssignmentContactsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ class AssignmentContactsList extends React.Component {
search: "",
currentPage: 0,
filterEl: null,
filterStatuses: Object.keys(messageStatusLabels),
filterStatuses: {
needsResponse: true,
convo: true,
closed: true
},
counts
};
}
Expand Down Expand Up @@ -92,12 +96,10 @@ class AssignmentContactsList extends React.Component {
closeMenu = () => this.setState({ filterEl: null });

handleFilterUpdate = status => {
const filterStatuses = [...this.state.filterStatuses];
const statusIndex = filterStatuses.indexOf(status);

statusIndex === -1
? filterStatuses.push(status)
: filterStatuses.splice(statusIndex, 1);
const filterStatuses = {
...this.state.filterStatuses,
[status]: !this.state.filterStatuses[status]
};

this.setState(
{
Expand All @@ -115,7 +117,7 @@ class AssignmentContactsList extends React.Component {
getFilteredContacts = contacts => {
return contacts.filter(
c =>
this.state.filterStatuses.includes(c.messageStatus) &&
this.state.filterStatuses[c.messageStatus] &&
this.getContactName(c)
.toLowerCase()
.includes(this.state.search.toLowerCase())
Expand Down Expand Up @@ -206,10 +208,10 @@ class AssignmentContactsList extends React.Component {
onClose={this.closeMenu}
keepMounted
>
{Object.keys(messageStatusLabels).map(status => (
{Object.keys(this.state.filterStatuses).map(status => (
<MenuItem
key={status}
selected={this.state.filterStatuses.includes(status)}
selected={this.state.filterStatuses[status]}
onClick={() => this.handleFilterUpdate(status)}
>
{messageStatusLabels[status]} ({this.state.counts[status] || 0})
Expand Down Expand Up @@ -276,7 +278,7 @@ const inlineStyles = {
pagination: {
display: "flex",
justifyContent: "center",
padding: 12,
padding: "12px 0",
borderRight: "1px solid #C1C3CC"
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/AssignmentTexter/StyleControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ export const flexStyles = StyleSheet.create({
overflowY: "scroll"
},
sectionLeftSideBox: {
flex: "1 0 280px",
maxWidth: 280,
flex: "1 0 260px",
maxWidth: 260,
overflow: "hidden scroll"
},
superSectionMessagePage: {
Expand Down

0 comments on commit 5d6c287

Please sign in to comment.