-
-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add status filters on overview page (#840)
* feat: use status legend as filters * fix: overview is considered a queue as well with its own status * feat: adjust styles for status tabs on overview page * fix: remove unecessary styles * refactor: use existing hook instead
- Loading branch information
1 parent
6ecc79d
commit 4d0ae3d
Showing
4 changed files
with
69 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,32 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { queueStatsStatusList } from '../../constants/queue-stats-status'; | ||
import { toCamelCase } from '../../utils/toCamelCase'; | ||
import s from './StatusLegend.module.css'; | ||
import { NavLink } from 'react-router-dom'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { toCamelCase } from '../../utils/toCamelCase'; | ||
import cn from 'clsx'; | ||
import { useQuery } from '../../hooks/useQuery'; | ||
|
||
export const StatusLegend = () => { | ||
const { t } = useTranslation(); | ||
const query = useQuery(); | ||
|
||
return ( | ||
<ul className={s.legend}> | ||
{queueStatsStatusList.map((status) => ( | ||
<li key={status} className={s[toCamelCase(status)]}> | ||
{t(`QUEUE.STATUS.${status.toUpperCase()}`)} | ||
</li> | ||
))} | ||
{queueStatsStatusList.map((status) => { | ||
const displayStatus = t(`QUEUE.STATUS.${status.toUpperCase()}`).toLocaleUpperCase(); | ||
|
||
return (<li key={status} className={cn(s[toCamelCase(status)], { | ||
[s.isSelected]: query.get('status') === status, | ||
})}> | ||
<NavLink | ||
to={`/?status=${status}`} | ||
key={`overview-${status}`} | ||
> | ||
<span title={displayStatus}>{displayStatus}</span> | ||
</NavLink> | ||
</li>); | ||
})} | ||
</ul> | ||
); | ||
}; |
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