Skip to content

Commit

Permalink
Merge pull request #147 from open-schools/fix/SCHOOL-840/saving-setti…
Browse files Browse the repository at this point in the history
…ngs-when-page-reloaded

saving-settings-when-page-reloaded
  • Loading branch information
zavarin-michael authored Jul 1, 2024
2 parents 5f99fef + 88c1747 commit 18d54cd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
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

0 comments on commit 18d54cd

Please sign in to comment.