Skip to content

Commit

Permalink
update based on feedback
Browse files Browse the repository at this point in the history
Signed-off-by: sharpd <davidsharp7@gmail.com>
  • Loading branch information
davidsharp7 committed Mar 1, 2024
1 parent f4e2617 commit cb4a1e3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
14 changes: 7 additions & 7 deletions web/src/components/datasets/DatasetTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const DatasetTags: React.FC<IProps> = (props) => {
options[selectedIndex] === 'Add a Tag' ? setDialogOpen(true) : setOpenTagDesc(true)
}
const [snackbarOpen, setSnackbarOpen] = useState(false)
const theme = createTheme(useTheme())

const handleMenuItemClick = (
_event: React.MouseEvent<HTMLLIElement, MouseEvent>,
Expand Down Expand Up @@ -145,7 +146,6 @@ const DatasetTags: React.FC<IProps> = (props) => {
}

const formatTags = (tags: string[], tag_desc: Tag[]) => {
const theme = createTheme(useTheme())
return tags.map((tag) => {
const tagDescription = tag_desc.find((tagItem) => tagItem.name === tag)
const tooltipTitle = tagDescription?.description || 'No Tag Description'
Expand All @@ -170,8 +170,8 @@ const DatasetTags: React.FC<IProps> = (props) => {
<>
<Snackbar
open={snackbarOpen}
autoHideDuration={500}
style={{ zIndex: 9999 }}
autoHideDuration={1000}
style={{ zIndex: theme.zIndex.snackbar }}
onClose={() => setSnackbarOpen(false)}
message={'Tag updated.'}
anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
Expand All @@ -182,13 +182,13 @@ const DatasetTags: React.FC<IProps> = (props) => {
<ButtonGroup
variant='contained'
ref={anchorRef}
aria-label='Tags Nested Menu'
sx={{ height: '30px', width: '20px', marginLeft: '5px' }}
aria-label='tags-nested-menu'
sx={{ height: '32px', width: '20px', marginLeft: '8px' }}
>
<MQTooltip placement='left' title={options[selectedIndex]}>
<Button
variant='outlined'
sx={{ height: '30px', width: '20px' }}
sx={{ height: '32px', width: '20px' }}
onClick={handleButtonClick}
>
{selectedIndex === 0 ? <AddIcon /> : <EditNoteIcon />}
Expand All @@ -199,7 +199,7 @@ const DatasetTags: React.FC<IProps> = (props) => {
size='small'
aria-controls={openDropDown ? 'split-button-menu' : undefined}
aria-expanded={openDropDown ? 'true' : undefined}
aria-label='Tags Menu'
aria-label='tags-menu'
aria-haspopup='menu'
onClick={handleDropDownToggle}
>
Expand Down
3 changes: 3 additions & 0 deletions web/src/helpers/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export const theme = createTheme({
main: '#454f5b',
},
},
zIndex: {
snackbar: 9999,
},
})

export const THEME_EXTRA = {
Expand Down
8 changes: 5 additions & 3 deletions web/src/store/reducers/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import {
import { Tag } from '../../types/api'
import { addTagsSuccess, fetchTagsSuccess } from '../actionCreators'

export type ITagsState = { tags: Tag[] }
export type ITagsState = { isLoading: boolean; tags: Tag[]; init: boolean }

export const initialState: ITagsState = {
isLoading: false,
init: false,
tags: [],
}

Expand All @@ -21,9 +23,9 @@ export default (state: ITagsState = initialState, action: ITagsAction): ITagsSta
const { type, payload } = action
switch (type) {
case FETCH_TAGS:
return { ...state }
return { ...state, isLoading: true }
case FETCH_TAGS_SUCCESS:
return { ...state, tags: payload.tags }
return { ...state, isLoading: false, init: true, tags: payload.tags }
case ADD_TAGS:
return { ...state }
case ADD_TAGS_SUCCESS:
Expand Down

0 comments on commit cb4a1e3

Please sign in to comment.