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

saving-settings-when-page-reloaded #147

Merged
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
15 changes: 8 additions & 7 deletions apps/schools/domains/common/components/bubbleFilter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import styles from './styles/styles.module.scss'
import { BubbleFilterProps, BubbleFilterListItem } from '@domains/common/components/bubbleFilter/interface'
import { CloseOutlined } from '@ant-design/icons'

export const BubbleFilter: React.FC<BubbleFilterProps> = React.memo(({ text, items }) => {
const listItems = items.map((item: BubbleFilterListItem) =>
item.count && item.count > 0 ? (
export const BubbleFilter: React.FC<BubbleFilterProps> = React.memo(({ text, items, statuses }) => {
const listItems = items.map((item: BubbleFilterListItem) => {
const isSelected = statuses?.includes(item.key) ?? false
return item.count && item.count > 0 ? (
<Row
className={item.isSelected ? styles.bubbleContainerSelected : styles.bubbleContainer}
onClick={item.isSelected ? () => {} : item.onClick}
className={isSelected ? styles.bubbleContainerSelected : styles.bubbleContainer}
onClick={isSelected ? () => {} : item.onClick}
style={{ backgroundColor: item.isSelected ? item.color : '' }}
key={item.key}
>
Expand All @@ -21,8 +22,8 @@ export const BubbleFilter: React.FC<BubbleFilterProps> = React.memo(({ text, ite
<div className={styles.bubbleText}>{item.text}</div>
{item.isSelected && <CloseOutlined onClick={item.onExit} className={styles.closeIcon} />}
</Row>
) : null,
)
) : null
})

return (
<Row className={styles.container}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export interface BubbleFilterListItem {
export interface BubbleFilterProps {
items: BubbleFilterListItem[]
text?: string
statuses?: string[] | null
}
6 changes: 5 additions & 1 deletion apps/schools/domains/query/components/queryList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ export function QueryList() {
<Typography.Title level={1}>Заявки</Typography.Title>
</div>
<SearchInput onSearchChange={handleSearchChange} />
<BubbleFilter items={Object.values(bubbleFilterItems)} text={`${countAllQueries} заявок`} />
<BubbleFilter
text={`${countAllQueries} заявок`}
items={Object.values(bubbleFilterItems)}
statuses={statuses}
/>
<Table<RowType, TableType>
loading={isTableLoading}
customType={'tableWithoutSearch'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function TicketList() {
<Typography.Title level={1}>Обращения</Typography.Title>
</div>
<SearchInput onSearchChange={handleInputChange} />
<BubbleFilter items={Object.values(bubbleFilterItems)} text={`Статусы обращений`} />
<BubbleFilter items={Object.values(bubbleFilterItems)} text={`Статусы обращений`} statuses={statuses} />
<div className={styles.tableTicketList}>
<Table<RowType, TableType>
loading={isTableLoading}
Expand Down
Loading