-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
176 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ui/src/ui/pages/query-tracker/QueryACO/QueryACOSettingsMenu/QueryACOSettingsMenuForm.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.query-aco-settings-menu-form { | ||
&__item { | ||
display: flex; | ||
align-items: center; | ||
|
||
margin-bottom: 12px; | ||
|
||
&-header { | ||
margin: 0 8px 0 0; | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
.../ui/src/ui/pages/query-tracker/QueryACO/QueryACOSettingsMenu/QueryACOSettingsMenuForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React, {FC, useEffect, useMemo} from 'react'; | ||
import {Item, SelectSingle} from '../../../../components/Select/Select'; | ||
import {useDispatch, useSelector} from 'react-redux'; | ||
import cn from 'bem-cn-lite'; | ||
import {getDefaultQueryACO, selectAvailableAco} from '../../module/query_aco/selectors'; | ||
import {getQueryACO, setUserDefaultACO} from '../../module/query_aco/actions'; | ||
|
||
import './QueryACOSettingsMenuForm.scss'; | ||
|
||
const block = cn('query-aco-settings-menu-form'); | ||
|
||
export const QueryACOSettingsMenuForm: FC = () => { | ||
const dispatch = useDispatch(); | ||
const defaultUserACO = useSelector(getDefaultQueryACO); | ||
const ACOList = useSelector(selectAvailableAco); | ||
|
||
useEffect(() => { | ||
dispatch(getQueryACO()); | ||
}, [dispatch]); | ||
|
||
const items = useMemo(() => { | ||
return ACOList.reduce<Item[]>((acc, item) => { | ||
acc.push({value: item, text: item}); | ||
return acc; | ||
}, []); | ||
}, [ACOList]); | ||
|
||
const handleACOChange = (value?: string) => { | ||
if (value) { | ||
dispatch(setUserDefaultACO(value)); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className={block()}> | ||
<SelectSingle | ||
value={defaultUserACO} | ||
items={items} | ||
onChange={handleACOChange} | ||
placeholder="ACO" | ||
/> | ||
</div> | ||
); | ||
}; |
1 change: 1 addition & 0 deletions
1
packages/ui/src/ui/pages/query-tracker/QueryACO/QueryACOSettingsMenu/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './QueryACOSettingsMenuForm'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.