Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix filter in assigne-to dropdown #1827

Merged
merged 1 commit into from
Jul 20, 2023
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
41 changes: 27 additions & 14 deletions client/apps/Planning/PlanningListSubNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import * as actions from '../../actions';

import {Button, ButtonGroup, Dropdown, SubNav, Tooltip, IconButton} from 'superdesk-ui-framework/react';
import {FilterSubnavDropdown} from '../../components/Main';

import {Dropdown as DropdownFromPlanning, IDropdownItem} from '../../components/UI/SubNav/Dropdown';

import {SubNavDatePicker} from './SubNavDatePicker';
import {IUser} from 'superdesk-api';

Expand Down Expand Up @@ -144,9 +147,10 @@ class PlanningListSubNavComponent extends React.Component<IProps, IState> {
render() {
let newOption = {_id: null, display_name: 'ALL'};
let list = [newOption, ...this.props.users];
const userList = list.map((user) => ({
const userList: Array<IDropdownItem> = list.map((user) => ({
id: user._id,
label: user.display_name,
onSelect: () => {
action: () => {
this.filterCoverageUser(user);
}
}));
Expand Down Expand Up @@ -188,19 +192,28 @@ class PlanningListSubNavComponent extends React.Component<IProps, IState> {
<SubNav className="subnav-event-planning" zIndex={1}>
<ButtonGroup align="inline">
<FilterSubnavDropdown viewSize={this.state.viewSize} />
{this.props.activefilter == PLANNING_VIEW.EVENTS ? ' ' : (
<div>
<span className="sd-margin-l--1 sd-opacity--75 ">{gettext('Assigned to:')}</span>
<Dropdown items={userList}>
<span className="sd-margin-l--1 sd-margin-r--3">
{this.props.users.find(
(user) => user._id == this.props.coverageUser
)?.display_name ?? gettext('ALL')}
<span className="dropdown__caret" />

{this.props.activefilter == PLANNING_VIEW.EVENTS
? ' '
: (
<>
<span className="sd-margin-l--1 sd-opacity--75 ">
{gettext('Assigned to:')}
</span>
</Dropdown>
</div>
)}

<DropdownFromPlanning
items={userList}
buttonLabel={
this.props.users.find(
(user) => user._id == this.props.coverageUser
)?.display_name ?? gettext('ALL')
}
scrollable={true}
searchable={true}
/>
</>
)
}
</ButtonGroup>
<ButtonGroup className="hideOnMobile" align="end">
{this.props.listViewType === LIST_VIEW_TYPE.LIST ? (
Expand Down
2 changes: 1 addition & 1 deletion client/components/UI/SubNav/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export class Dropdown extends React.Component<IProps, IState> {
{(this.props.searchable !== true || this.props.items.length < 3) ?
null :
(
<div style={{paddingLeft: 10, paddingRight: 10}}>
<div style={{paddingLeft: 10, paddingRight: 10, paddingBottom: '1rem'}}>
<input
type="text"
value={this.state.filterValue}
Expand Down