Skip to content

Commit

Permalink
Update coverage user and desk selection (#2006)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc authored Jun 27, 2024
1 parent d06ca80 commit 4340a13
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ function getLanguagesForCoverage(
}

interface IState {
userList: Array<IUser>;
selectedDeskId?: string;
}

Expand All @@ -91,7 +90,6 @@ export class EmbeddedCoverageFormComponent extends React.PureComponent<IProps, I
super(props);

this.state = {
userList: this.props.users,
selectedDeskId: null,
};

Expand All @@ -102,7 +100,9 @@ export class EmbeddedCoverageFormComponent extends React.PureComponent<IProps, I
}

onDeskChange(deskId?: IDesk['_id']) {
const newDesk = deskId == null || deskId == '' ? null : this.props.desks.find((desk) => desk._id === deskId);
const newDesk = deskId == null || deskId == ''
? null
: this.props.desks.find((desk) => desk._id === deskId);

const updates: Partial<ICoverageDetails> = {
desk: newDesk,
Expand All @@ -114,11 +114,6 @@ export class EmbeddedCoverageFormComponent extends React.PureComponent<IProps, I
updates.language = newDesk?.desk_language ?? null;
}

this.setState({
selectedDeskId: deskId,
userList: updates.filteredUsers,
});

this.props.update(updates);
}

Expand Down Expand Up @@ -190,7 +185,7 @@ export class EmbeddedCoverageFormComponent extends React.PureComponent<IProps, I
style={{padding: '2rem 0'}}
>
<SelectUser
deskId={this.state.selectedDeskId}
deskId={coverage.desk?._id}
onSelect={(user) => {
this.onUserChange(null, user);
}}
Expand Down

0 comments on commit 4340a13

Please sign in to comment.