Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Card Archiving Functionality with Documentation Updates #724

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Planka client
# Frontend

The Planka frontend uses a combination of React, Redux, and Saga for state management and side effects, providing a rich and responsive user experience.
7 changes: 7 additions & 0 deletions client/src/actions/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ updateCard.success = (card) => ({
},
});

updateCard.archive_success = (card) => ({
type: ActionTypes.CARD_ARCHIVE__SUCCESS,
payload: {
card,
},
});

updateCard.failure = (id, error) => ({
type: ActionTypes.CARD_UPDATE__FAILURE,
payload: {
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Boards/EditStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Button, Form } from 'semantic-ui-react';
import { Input, Popup } from '../../lib/custom-ui';

import { useForm, useSteps } from '../../hooks';
import DeleteStep from '../DeleteStep';
import ConfirmStep from '../ConfirmStep';

import styles from './EditStep.module.scss';

Expand Down Expand Up @@ -54,7 +54,7 @@ const EditStep = React.memo(({ defaultData, onUpdate, onDelete, onClose }) => {

if (step && step.type === StepTypes.DELETE) {
return (
<DeleteStep
<ConfirmStep
title="common.deleteBoard"
content="common.areYouSureYouWantToDeleteThisBoard"
buttonContent="action.deleteBoard"
Expand Down
27 changes: 25 additions & 2 deletions client/src/components/Card/ActionsStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import LabelsStep from '../LabelsStep';
import DueDateEditStep from '../DueDateEditStep';
import StopwatchEditStep from '../StopwatchEditStep';
import CardMoveStep from '../CardMoveStep';
import DeleteStep from '../DeleteStep';
import ConfirmStep from '../ConfirmStep';

import styles from './ActionsStep.module.scss';
import { CardStatus } from '../../constants/Enums';

const StepTypes = {
USERS: 'USERS',
Expand All @@ -22,6 +23,7 @@ const StepTypes = {
EDIT_STOPWATCH: 'EDIT_STOPWATCH',
MOVE: 'MOVE',
DELETE: 'DELETE',
ARCHIVE: 'ARCHIVE',
};

const ActionsStep = React.memo(
Expand All @@ -48,6 +50,7 @@ const ActionsStep = React.memo(
onLabelMove,
onLabelDelete,
onClose,
onArchive,
}) => {
const [t] = useTranslation();
const [step, openStep, handleBack] = useSteps();
Expand Down Expand Up @@ -82,6 +85,10 @@ const ActionsStep = React.memo(
onClose();
}, [onDuplicate, onClose]);

const handleArchiveClick = useCallback(() => {
openStep(StepTypes.ARCHIVE);
}, [openStep]);

const handleDeleteClick = useCallback(() => {
openStep(StepTypes.DELETE);
}, [openStep]);
Expand Down Expand Up @@ -162,14 +169,24 @@ const ActionsStep = React.memo(
);
case StepTypes.DELETE:
return (
<DeleteStep
<ConfirmStep
title="common.deleteCard"
content="common.areYouSureYouWantToDeleteThisCard"
buttonContent="action.deleteCard"
onConfirm={onDelete}
onBack={handleBack}
/>
);
case StepTypes.ARCHIVE:
return (
<ConfirmStep
title="common.archiveCard_title"
content="common.areYouSureYouWantToArchiveThisCard"
buttonContent="action.archiveCard"
onConfirm={onArchive}
onBack={handleBack}
/>
);
default:
}
}
Expand Down Expand Up @@ -218,6 +235,11 @@ const ActionsStep = React.memo(
context: 'title',
})}
</Menu.Item>
<Menu.Item className={styles.menuItem} onClick={handleArchiveClick}>
{t('action.archiveCard', {
context: 'title',
})}
</Menu.Item>
<Menu.Item className={styles.menuItem} onClick={handleDeleteClick}>
{t('action.deleteCard', {
context: 'title',
Expand Down Expand Up @@ -255,6 +277,7 @@ ActionsStep.propTypes = {
onLabelMove: PropTypes.func.isRequired,
onLabelDelete: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
onArchive: PropTypes.func.isRequired,
};

export default ActionsStep;
9 changes: 9 additions & 0 deletions client/src/components/Card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import DueDate from '../DueDate';
import Stopwatch from '../Stopwatch';

import styles from './Card.module.scss';
import { CardStatus } from '../../constants/Enums';

const Card = React.memo(
({
Expand Down Expand Up @@ -81,6 +82,13 @@ const Card = React.memo(
[onUpdate],
);

const handleArchiveClick = useCallback(() => {
onUpdate({
status: CardStatus.ARCHIVED,
});
onClose();
}, [onUpdate]);

const handleNameEdit = useCallback(() => {
nameEdit.current.open();
}, []);
Expand Down Expand Up @@ -197,6 +205,7 @@ const Card = React.memo(
onLabelUpdate={onLabelUpdate}
onLabelMove={onLabelMove}
onLabelDelete={onLabelDelete}
onArchive={handleArchiveClick}
>
<Button className={classNames(styles.actionsButton, styles.target)}>
<Icon fitted name="pencil" size="small" />
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/CardModal/Activities/ItemComment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Markdown } from '../../../lib/custom-ui';
import getDateFormat from '../../../utils/get-date-format';
import CommentEdit from './CommentEdit';
import User from '../../User';
import DeleteStep from '../../DeleteStep';
import ConfirmStep from '../../ConfirmStep';

import styles from './ItemComment.module.scss';

Expand All @@ -23,7 +23,7 @@ const ItemComment = React.memo(
commentEdit.current.open();
}, []);

const DeletePopup = usePopup(DeleteStep);
const DeletePopup = usePopup(ConfirmStep);

return (
<Comment>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/CardModal/Attachments/EditStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Button, Form } from 'semantic-ui-react';
import { Input, Popup } from '../../../lib/custom-ui';

import { useForm, useSteps } from '../../../hooks';
import DeleteStep from '../../DeleteStep';
import ConfirmStep from '../../ConfirmStep';

import styles from './EditStep.module.scss';

Expand Down Expand Up @@ -54,7 +54,7 @@ const EditStep = React.memo(({ defaultData, onUpdate, onDelete, onClose }) => {

if (step && step.type === StepTypes.DELETE) {
return (
<DeleteStep
<ConfirmStep
title="common.deleteAttachment"
content="common.areYouSureYouWantToDeleteThisAttachment"
buttonContent="action.deleteAttachment"
Expand Down
25 changes: 23 additions & 2 deletions client/src/components/CardModal/CardModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import LabelsStep from '../LabelsStep';
import DueDateEditStep from '../DueDateEditStep';
import StopwatchEditStep from '../StopwatchEditStep';
import CardMoveStep from '../CardMoveStep';
import DeleteStep from '../DeleteStep';
import ConfirmStep from '../ConfirmStep';

import styles from './CardModal.module.scss';
import { CardStatus } from '../../constants/Enums';

const CardModal = React.memo(
({
Expand Down Expand Up @@ -141,6 +142,13 @@ const CardModal = React.memo(
});
}, [isSubscribed, onUpdate]);

const handleArchiveClick = useCallback(() => {
onUpdate({
status: CardStatus.ARCHIVED,
});
onClose();
}, [onUpdate, onClose]);

const handleDuplicateClick = useCallback(() => {
onDuplicate();
onClose();
Expand Down Expand Up @@ -168,7 +176,7 @@ const CardModal = React.memo(
const DueDateEditPopup = usePopup(DueDateEditStep);
const StopwatchEditPopup = usePopup(StopwatchEditStep);
const CardMovePopup = usePopup(CardMoveStep);
const DeletePopup = usePopup(DeleteStep);
const DeletePopup = usePopup(ConfirmStep);

const userIds = users.map((user) => user.id);
const labelIds = labels.map((label) => label.id);
Expand Down Expand Up @@ -506,6 +514,19 @@ const CardModal = React.memo(
<Icon name="copy outline" className={styles.actionIcon} />
{t('action.duplicate')}
</Button>

<DeletePopup
title="common.archiveCard"
content="common.areYouSureYouWantToArchiveThisCard"
buttonContent="action.archiveCard"
onConfirm={handleArchiveClick}
>
<Button fluid className={styles.actionButton}>
<Icon name="archive icon" className={styles.actionIcon} />
{t('action.archive')}
</Button>
</DeletePopup>

<DeletePopup
title="common.deleteCard"
content="common.areYouSureYouWantToDeleteThisCard"
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/CardModal/Tasks/ActionsStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Menu } from 'semantic-ui-react';
import { Popup } from '../../../lib/custom-ui';

import { useSteps } from '../../../hooks';
import DeleteStep from '../../DeleteStep';
import ConfirmStep from '../../ConfirmStep';

import styles from './ActionsStep.module.scss';

Expand All @@ -28,7 +28,7 @@ const ActionsStep = React.memo(({ onNameEdit, onDelete, onClose }) => {

if (step && step.type === StepTypes.DELETE) {
return (
<DeleteStep
<ConfirmStep
title="common.deleteTask"
content="common.areYouSureYouWantToDeleteThisTask"
buttonContent="action.deleteTask"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { useTranslation } from 'react-i18next';
import { Button } from 'semantic-ui-react';
import { Popup } from '../../lib/custom-ui';

import styles from './DeleteStep.module.scss';
import styles from './ConfirmStep.module.scss';

const DeleteStep = React.memo(({ title, content, buttonContent, onConfirm, onBack }) => {
const ConfirmStep = React.memo(({ title, content, buttonContent, onConfirm, onBack }) => {
const [t] = useTranslation();

return (
Expand All @@ -24,16 +24,16 @@ const DeleteStep = React.memo(({ title, content, buttonContent, onConfirm, onBac
);
});

DeleteStep.propTypes = {
ConfirmStep.propTypes = {
title: PropTypes.string.isRequired,
content: PropTypes.string.isRequired,
buttonContent: PropTypes.string.isRequired,
onConfirm: PropTypes.func.isRequired,
onBack: PropTypes.func,
};

DeleteStep.defaultProps = {
ConfirmStep.defaultProps = {
onBack: undefined,
};

export default DeleteStep;
export default ConfirmStep;
3 changes: 3 additions & 0 deletions client/src/components/ConfirmStep/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ConfirmStep from './ConfirmStep';

export default ConfirmStep;
3 changes: 0 additions & 3 deletions client/src/components/DeleteStep/index.js

This file was deleted.

4 changes: 2 additions & 2 deletions client/src/components/LabelsStep/EditStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Popup } from '../../lib/custom-ui';
import { useForm, useSteps } from '../../hooks';
import LabelColors from '../../constants/LabelColors';
import Editor from './Editor';
import DeleteStep from '../DeleteStep';
import ConfirmStep from '../ConfirmStep';

import styles from './EditStep.module.scss';

Expand Down Expand Up @@ -46,7 +46,7 @@ const EditStep = React.memo(({ defaultData, onUpdate, onDelete, onBack }) => {

if (step && step.type === StepTypes.DELETE) {
return (
<DeleteStep
<ConfirmStep
title="common.deleteLabel"
content="common.areYouSureYouWantToDeleteThisLabel"
buttonContent="action.deleteLabel"
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/List/ActionsStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Menu } from 'semantic-ui-react';
import { Popup } from '../../lib/custom-ui';

import { useSteps } from '../../hooks';
import DeleteStep from '../DeleteStep';
import ConfirmStep from '../ConfirmStep';

import styles from './ActionsStep.module.scss';

Expand Down Expand Up @@ -33,7 +33,7 @@ const ActionsStep = React.memo(({ onNameEdit, onCardAdd, onDelete, onClose }) =>

if (step && step.type === StepTypes.DELETE) {
return (
<DeleteStep
<ConfirmStep
title="common.deleteList"
content="common.areYouSureYouWantToDeleteThisList"
buttonContent="action.deleteList"
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Memberships/ActionsStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Button } from 'semantic-ui-react';

import { useSteps } from '../../hooks';
import User from '../User';
import DeleteStep from '../DeleteStep';
import ConfirmStep from '../ConfirmStep';

import styles from './ActionsStep.module.scss';

Expand Down Expand Up @@ -71,7 +71,7 @@ const ActionsStep = React.memo(
}
case StepTypes.DELETE:
return (
<DeleteStep
<ConfirmStep
title={membership.user.isCurrent ? leaveConfirmationTitle : deleteConfirmationTitle}
content={
membership.user.isCurrent ? leaveConfirmationContent : deleteConfirmationContent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { Button, Divider, Header, Tab } from 'semantic-ui-react';
import { usePopup } from '../../../lib/popup';

import InformationEdit from './InformationEdit';
import DeleteStep from '../../DeleteStep';
import ConfirmStep from '../../ConfirmStep';

import styles from './GeneralPane.module.scss';

const GeneralPane = React.memo(({ name, onUpdate, onDelete }) => {
const [t] = useTranslation();

const DeletePopup = usePopup(DeleteStep);
const DeletePopup = usePopup(ConfirmStep);

return (
<Tab.Pane attached={false} className={styles.wrapper}>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/UsersModal/Item/ActionsStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UserInformationEditStep from '../../UserInformationEditStep';
import UserUsernameEditStep from '../../UserUsernameEditStep';
import UserEmailEditStep from '../../UserEmailEditStep';
import UserPasswordEditStep from '../../UserPasswordEditStep';
import DeleteStep from '../../DeleteStep';
import ConfirmStep from '../../ConfirmStep';

import styles from './ActionsStep.module.scss';

Expand Down Expand Up @@ -110,7 +110,7 @@ const ActionsStep = React.memo(
);
case StepTypes.DELETE:
return (
<DeleteStep
<ConfirmStep
title="common.deleteUser"
content="common.areYouSureYouWantToDeleteThisUser"
buttonContent="action.deleteUser"
Expand Down
1 change: 1 addition & 0 deletions client/src/constants/ActionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export default {
CARD_DELETE__SUCCESS: 'CARD_DELETE__SUCCESS',
CARD_DELETE__FAILURE: 'CARD_DELETE__FAILURE',
CARD_DELETE_HANDLE: 'CARD_DELETE_HANDLE',
CARD_ARCHIVE__SUCCESS: 'CARD_ARCHIVE__SUCCESS',

/* Tasks */

Expand Down
Loading