mirror of
https://github.com/plankanban/planka.git
synced 2025-08-04 04:55:25 +02:00
fix: Improve current board context indication
This commit is contained in:
parent
d40b4d3224
commit
5beafca07e
3 changed files with 36 additions and 2 deletions
|
@ -6,8 +6,12 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { Icon } from 'semantic-ui-react';
|
||||||
|
|
||||||
import selectors from '../../../selectors';
|
import selectors from '../../../selectors';
|
||||||
|
import { BoardContexts } from '../../../constants/Enums';
|
||||||
|
import { BoardContextIcons } from '../../../constants/Icons';
|
||||||
import Filters from './Filters';
|
import Filters from './Filters';
|
||||||
import RightSide from './RightSide';
|
import RightSide from './RightSide';
|
||||||
import BoardMemberships from '../../board-memberships/BoardMemberships';
|
import BoardMemberships from '../../board-memberships/BoardMemberships';
|
||||||
|
@ -15,7 +19,15 @@ import BoardMemberships from '../../board-memberships/BoardMemberships';
|
||||||
import styles from './BoardActions.module.scss';
|
import styles from './BoardActions.module.scss';
|
||||||
|
|
||||||
const BoardActions = React.memo(() => {
|
const BoardActions = React.memo(() => {
|
||||||
|
const boardContext = useSelector((state) => selectors.selectCurrentBoard(state).context);
|
||||||
|
|
||||||
|
const withContextTitle = boardContext !== BoardContexts.BOARD;
|
||||||
|
|
||||||
const withMemberships = useSelector((state) => {
|
const withMemberships = useSelector((state) => {
|
||||||
|
if (withContextTitle) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const boardMemberships = selectors.selectMembershipsForCurrentBoard(state);
|
const boardMemberships = selectors.selectMembershipsForCurrentBoard(state);
|
||||||
|
|
||||||
if (boardMemberships.length > 0) {
|
if (boardMemberships.length > 0) {
|
||||||
|
@ -25,9 +37,19 @@ const BoardActions = React.memo(() => {
|
||||||
return selectors.selectIsCurrentUserManagerForCurrentProject(state);
|
return selectors.selectIsCurrentUserManagerForCurrentProject(state);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [t] = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<div className={styles.actions}>
|
<div className={styles.actions}>
|
||||||
|
{withContextTitle && (
|
||||||
|
<div className={styles.action}>
|
||||||
|
<div className={styles.contextTitle}>
|
||||||
|
<Icon name={BoardContextIcons[boardContext]} className={styles.contextTitleIcon} />
|
||||||
|
{t(`common.${boardContext}`)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{withMemberships && (
|
{withMemberships && (
|
||||||
<div className={styles.action}>
|
<div className={styles.action}>
|
||||||
<BoardMemberships />
|
<BoardMemberships />
|
||||||
|
|
|
@ -31,6 +31,18 @@
|
||||||
height: 46px;
|
height: 46px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.contextTitle {
|
||||||
|
background: rgba(0, 0, 0, 0.08);
|
||||||
|
border-radius: 3px;
|
||||||
|
color: #fff;
|
||||||
|
line-height: 34px;
|
||||||
|
padding: 2px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contextTitleIcon {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.wrapper {
|
.wrapper {
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { usePopup } from '../../../../lib/popup';
|
||||||
import selectors from '../../../../selectors';
|
import selectors from '../../../../selectors';
|
||||||
import entryActions from '../../../../entry-actions';
|
import entryActions from '../../../../entry-actions';
|
||||||
import { BoardContexts, BoardViews } from '../../../../constants/Enums';
|
import { BoardContexts, BoardViews } from '../../../../constants/Enums';
|
||||||
import { BoardContextIcons, BoardViewIcons } from '../../../../constants/Icons';
|
import { BoardViewIcons } from '../../../../constants/Icons';
|
||||||
import ActionsStep from './ActionsStep';
|
import ActionsStep from './ActionsStep';
|
||||||
|
|
||||||
import styles from './RightSide.module.scss';
|
import styles from './RightSide.module.scss';
|
||||||
|
@ -56,7 +56,7 @@ const RightSide = React.memo(() => {
|
||||||
<div className={styles.action}>
|
<div className={styles.action}>
|
||||||
<ActionsPopup>
|
<ActionsPopup>
|
||||||
<button type="button" className={styles.button}>
|
<button type="button" className={styles.button}>
|
||||||
<Icon fitted name={BoardContextIcons[board.context]} />
|
<Icon fitted name="ellipsis vertical" />
|
||||||
</button>
|
</button>
|
||||||
</ActionsPopup>
|
</ActionsPopup>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue