Compare commits

...
128 Commits
Author SHA1 Message Date
Maksim Eltyshev 33765dfe8a chore: Update version 2022-12-26 22:56:13 +01:00
Maksim Eltyshev d21dee05a3 fix: Show completed tasks greyed out 2022-12-26 22:55:04 +01:00
Maksim Eltyshev 1dacd6e700 fix: Prevent scroll when focusing 2022-12-26 22:51:17 +01:00
Maksim Eltyshev 7e07a75124 fix: Improve quality of resized images 2022-12-26 22:43:21 +01:00
Maksim Eltyshev 6ffa817b53 ref: Remove board types, refactoring 2022-12-26 21:10:50 +01:00
Maksim Eltyshev 2b131f76c1 fix: Proper image error handling during migration 2022-12-24 16:24:50 +01:00
Maksim Eltyshev 2bc82d557a fix: Fix image size for animated attachments 2022-12-24 02:59:03 +01:00
Maksim Eltyshev 7c99aeb9e1 chore: Update version 2022-12-24 01:04:46 +01:00
Maksim Eltyshev 8d477af498 fix: Fix active tab style 2022-12-24 01:03:36 +01:00
Maksim Eltyshev 32507f2799 fix: Add missing translation key 2022-12-24 01:00:57 +01:00
Maksim Eltyshev 0a5210dd21 feat: Preserve original format of images, change interpolation kernel
Closes #349
2022-12-24 00:47:59 +01:00
Maksim Eltyshev b82a601f46 fix: Increase height of scroll area in popups 2022-12-21 22:57:04 +01:00
Maksim Eltyshev c658665ee8 meta: Update import from Trello 2022-12-17 00:09:43 +01:00
Maksim Eltyshev a37bad4867 chore: Update version 2022-12-16 23:55:19 +01:00
Christoph Enne 738ed19e7f feat: Trello board JSON import (#352)
Closes #27, closes #105
2022-12-17 03:48:06 +05:00
Maksim Eltyshev 9ce8b2ab9c chore: Update version 2022-12-16 17:06:35 +01:00
Maksim Eltyshev a8d312922a fix: Fix error on initial loading
Closes #347
2022-12-16 17:05:03 +01:00
Maksim Eltyshev 90c8b4d548 chore: Update version 2022-12-15 01:39:00 +01:00
Maksim Eltyshev 4941b51fa4 fix: Prevent popup from overflowing 2022-12-15 01:38:03 +01:00
Maksim Eltyshev a858419f3c fix: Fix router synchronization with redux store 2022-12-15 01:34:48 +01:00
Maksim Eltyshev e28c06b85a fix: Fix type of omit flag 2022-11-30 03:15:02 +01:00
Maksim Eltyshev fa2d73a2c5 chore: Update version 2022-11-30 02:55:25 +01:00
Maksim Eltyshev 80706bbdd5 meta: Update link to container registry 2022-11-30 02:53:06 +01:00
Maksim Eltyshev db4e5a89f9 fix: Improve building 2022-11-30 02:50:38 +01:00
Maksim Eltyshev 0266e4bfe2 meta: Import from Trello 2022-11-28 14:07:55 +01:00
Maksim Eltyshev 02c26cfb4d ci: Update alpine version 2022-11-21 20:11:45 +01:00
Maksim Eltyshev ef096499a2 chore: Update alpine and vips version 2022-11-21 18:11:00 +01:00
Maksim Eltyshev a007e1d065 chore: Update version 2022-11-21 17:13:11 +01:00
Maksim Eltyshev c181731870 fix: Fix card repositioning
Closes #340
2022-11-21 17:07:51 +01:00
dependabot[bot] 54c57a08c3 chore(deps): Bump minimatch and recursive-readdir in /client (#338)
Bumps [minimatch](https://github.com/isaacs/minimatch) and [recursive-readdir](https://github.com/jergason/recursive-readdir). These dependencies needed to be updated together.

Updates `minimatch` from 3.0.4 to 3.1.2
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

Updates `recursive-readdir` from 2.2.2 to 2.2.3
- [Release notes](https://github.com/jergason/recursive-readdir/releases)
- [Changelog](https://github.com/jergason/recursive-readdir/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jergason/recursive-readdir/commits/v2.2.3)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
- dependency-name: recursive-readdir
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 05:23:28 +05:00
dependabot[bot] 65abd7c9ab chore(deps): Bump socket.io-parser from 3.3.2 to 3.3.3 in /client (#326)
Bumps [socket.io-parser](https://github.com/socketio/socket.io-parser) from 3.3.2 to 3.3.3.
- [Release notes](https://github.com/socketio/socket.io-parser/releases)
- [Changelog](https://github.com/socketio/socket.io-parser/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io-parser/compare/3.3.2...3.3.3)

---
updated-dependencies:
- dependency-name: socket.io-parser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 05:23:17 +05:00
dependabot[bot] 5fc811d2ef chore(deps): Bump socket.io-parser from 3.3.2 to 3.3.3 in /server (#322)
Bumps [socket.io-parser](https://github.com/socketio/socket.io-parser) from 3.3.2 to 3.3.3.
- [Release notes](https://github.com/socketio/socket.io-parser/releases)
- [Changelog](https://github.com/socketio/socket.io-parser/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io-parser/compare/3.3.2...3.3.3)

---
updated-dependencies:
- dependency-name: socket.io-parser
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-21 05:23:04 +05:00
Maksim Eltyshev 5afd4af897 ref: Little refactoring 2022-11-21 01:12:32 +01:00
Maksim Eltyshev ac0a3d9ae7 fix: Fix client build 2022-11-21 01:06:41 +01:00
Maksim Eltyshev b0d23373c0 chore: Update dependencies 2022-11-21 00:54:05 +01:00
Rafly Maulana 5381d45e50 meta: Share global eslint config, move prettier config (#339) 2022-11-21 00:22:01 +05:00
Maksim Eltyshev a43af8eac5 chore: Update version 2022-11-20 15:34:04 +01:00
Maksim Eltyshev 409a7cde6b fix: Fix notifications popup styles 2022-11-20 15:30:07 +01:00
Maksim Eltyshev f62cba9bcd fix: Fix board actions for mobile 2022-11-20 15:14:49 +01:00
Maksim Eltyshev 9495234066 ref: Little refactoring 2022-11-20 15:05:21 +01:00
Rafly Maulana 5dcbad7b5a feat: Add markdown editor in card description (#333) 2022-11-20 18:48:42 +05:00
Maksim Eltyshev 064b37050c fix: Hide label actions based on role 2022-11-10 15:28:43 +01:00
Rafly Maulana bf8b8474ec meta: Fix documentation for installing Planka without Docker (#324) 2022-11-10 18:56:55 +05:00
Rafly Maulana 37a9c9bb42 meta: Add documentation for installing Planka without Docker (#323) 2022-11-10 18:48:38 +05:00
Maksim Eltyshev 00fccbaa3d fix: Fix z-indexes 2022-11-02 21:54:30 +01:00
Maksim Eltyshev b3323308c1 fix: Lock postgres version
Closes #312
2022-10-20 12:22:35 +02:00
Jacob Weisz 9108dc5b3e meta: Fix readme typo (#309) 2022-10-12 22:46:00 +05:00
Maksim Eltyshev 513f9a8ee5 chore: Update version 2022-10-03 13:13:59 +02:00
Maksim Eltyshev e051f624a8 ref: Little change for consistency 2022-10-03 13:12:16 +02:00
Maksim Eltyshev 172f4fcf34 fix: Fix missing board memberships loading 2022-10-03 13:04:52 +02:00
Maksim Eltyshev 9f16881965 fix: Socket bug fixes and improvements 2022-10-03 12:11:19 +02:00
Connor Lanigan 4e876922f8 feat: Prefill label creation with search term (#307) 2022-10-03 14:08:39 +05:00
Connor Lanigan d82d928e29 fix: Update German translation (#306) 2022-10-03 14:06:51 +05:00
Maksim Eltyshev 94dc83706c chore: Update version 2022-09-30 11:52:19 +02:00
Jacques Lorentz b08e731419 fix: Front-end base url with path (#303)
Closes #43, closes #111, closes #272
2022-09-30 14:48:58 +05:00
Maksim Eltyshev 1ce0fac281 chore: Update version 2022-09-28 18:46:37 +02:00
Maksim Eltyshev e3d00c8791 fix: Disable quick timer actions for viewers 2022-09-28 18:38:03 +02:00
Maksim Eltyshev e1a0b635ea ref: Little refactoring 2022-09-28 18:30:03 +02:00
Maksim Eltyshev cc7959bb15 chore: Update version 2022-09-16 15:08:51 +05:00
Maksim Eltyshev 56044e6d8a ref: Fix filename 2022-09-16 15:08:09 +05:00
Maksim Eltyshev e5bd73f33e fix: Prevent popup from leaving window 2022-09-16 14:39:41 +05:00
Maksim Eltyshev e65ab6ece7 fix: Fix flag for English 2022-09-15 09:07:57 +05:00
Maksim Eltyshev 14cc55a8c0 feat: Highlight active timer, add quick actions 2022-09-15 00:20:05 +05:00
Maksim Eltyshev b4306d0a4b fix: Fix font of timer numbers 2022-09-14 21:22:08 +05:00
Maksim Eltyshev 283c850ebf feat: Add about pane 2022-09-14 16:52:50 +05:00
Maksim Eltyshev 62de71bd97 fix: Visually highlight card cover 2022-09-13 16:55:22 +05:00
Maksim Eltyshev 447f88880d chore: Update version 2022-09-07 18:43:32 +05:00
Maksim Eltyshev 8109936ce2 feat: Invalidate access token on logout 2022-09-07 18:39:33 +05:00
Maksim Eltyshev 640908320a ref: Remove unused style 2022-09-03 23:03:34 +05:00
Maksim Eltyshev 236c1020b3 chore: Update version 2022-09-03 22:48:19 +05:00
Maksim Eltyshev 3df07c10fa fix: Use password strength estimator
Closes #294
2022-09-03 22:47:06 +05:00
Steven Correia 543a992d98 fix: Fix proxy forwarding (#295) 2022-09-03 20:00:23 +05:00
Maksim Eltyshev 9cde4e63f9 chore: Update version 2022-09-02 18:03:44 +05:00
Maksim Eltyshev 95738ee7d3 fix: Add missing validation for password 2022-09-02 17:59:12 +05:00
Maksim Eltyshev bb7cdf5dd4 chore: Update version 2022-09-02 17:05:48 +05:00
Maksim Eltyshev 253af55790 fix: Add password requirements when creating user
Closes #293
2022-09-02 17:04:51 +05:00
Maksim Eltyshev 62c3cca9a7 fix: Fix password length validation 2022-08-30 15:13:17 +02:00
Maksim Eltyshev b476a19b79 chore: Update version 2022-08-30 13:50:45 +02:00
Maksim Eltyshev 3379c65a87 fix: Prevent tabnabbing in markdown 2022-08-30 13:47:50 +02:00
Maksim Eltyshev 1a6fc40804 chore: Update version 2022-08-26 19:13:10 +02:00
Maksim Eltyshev 42092efcd2 fix: Remove dots in translations 2022-08-26 19:11:32 +02:00
Maksim Eltyshev 5c91bddfe7 feat: Stronger password policy 2022-08-26 18:59:44 +02:00
Maksim Eltyshev fd8f40f1b0 chore: Update version 2022-08-26 16:05:47 +02:00
Maksim Eltyshev 5b64d465e2 fix: Use move-file instead of rename 2022-08-26 16:02:47 +02:00
Maksim Eltyshev 212fb8ac8c fix: Add missing border radius 2022-08-26 02:47:43 +02:00
Maksim Eltyshev cece2254d7 fix: Change mechanics of file uploading 2022-08-26 02:45:27 +02:00
Maksim Eltyshev c940805f14 chore: Fix version 2022-08-24 15:44:01 +02:00
Maksim Eltyshev 052ab7f653 chore: Update version 2022-08-24 15:37:27 +02:00
Maksim Eltyshev 5a38805588 feat: Add Italian translation. Thanks to @belf88 2022-08-24 15:27:12 +02:00
Maksim Eltyshev 2dbbead2e9 fix: Add missing border radiuses 2022-08-23 21:19:43 +02:00
Maksim Eltyshev 039eee0aac ref: Little refactoring 2022-08-23 21:06:50 +02:00
Maksim Eltyshev 07867fc0b2 fix: Use custom logger only for production 2022-08-23 20:45:42 +02:00
Maksim Eltyshev 55d07b4560 meta: Fixes in readme 2022-08-23 01:14:11 +02:00
Maksim Eltyshev 289d2bf5ae meta: Fix ignore files for logs 2022-08-23 00:51:33 +02:00
Steven Correia 6429e22d59 feat: Modify logger to log to file that supports fail2ban (#284) 2022-08-23 03:42:56 +05:00
Maksim Eltyshev 21ef850913 fix: Fix missed function name 2022-08-22 16:27:14 +02:00
Maksim Eltyshev e4769220da chore: Update version 2022-08-19 14:04:26 +02:00
Maksim Eltyshev 378e02c0a4 Merge branch 'master' of https://github.com/plankanban/planka 2022-08-19 14:01:24 +02:00
Maksim Eltyshev 51fa7df69c feat: Permissions for board members
Closes #262
2022-08-19 14:00:40 +02:00
Maksim Eltyshev 68806b9080 meta: Add sponsor button 2022-08-18 16:51:59 +05:00
Maksim Eltyshev d80a538857 fix: Little improvements in users modal 2022-08-17 02:00:24 +02:00
Maksim Eltyshev 78669da01d feat: Add search by users, members and labels 2022-08-17 00:53:08 +02:00
Maksim Eltyshev 3a7720974b chore: Update version 2022-08-09 22:34:16 +02:00
Maksim Eltyshev eea94e0ee2 ref: Little change for consistency 2022-08-09 22:31:43 +02:00
Maksim Eltyshev 4555dafd75 meta: Add vscode config 2022-08-09 19:36:08 +02:00
Maksim Eltyshev 95ebb27042 ref: Prettify env sample 2022-08-09 19:17:19 +02:00
Maksim Eltyshev d38e555293 fix: Provide default value for token expiration 2022-08-09 19:09:07 +02:00
SimonTagne 7786533a90 feat: Improve security of access tokens (#279)
Closes #275
2022-08-09 21:03:21 +05:00
SimonTagne dab38cbc18 ref: Ignore public js linting (#278) 2022-08-08 17:58:41 +05:00
Maksim Eltyshev 3714bbc06f ref: Refactoring 2022-08-04 13:31:14 +02:00
Maksim Eltyshev 1f569bdb61 chore: Update version 2022-08-04 00:41:57 +02:00
Maksim Eltyshev ac1df5201d fix: Fix path traversal vulnerability 2022-08-04 00:37:30 +02:00
Maksim Eltyshev fbe24c0fc0 chore: Update version 2022-08-03 13:28:41 +02:00
Maksim Eltyshev 79daed6afa docs: Add security policy
Closes #276
2022-08-03 16:15:40 +05:00
Maksim Eltyshev a9111bf7ba feat: Add Korean translation. Thanks to @chooya 2022-08-03 12:21:01 +02:00
Maksim Eltyshev 2d50211892 fix: Fix label style 2022-08-01 00:18:22 +02:00
Maksim Eltyshev 139971eca9 chore: Update version 2022-07-29 17:50:11 +02:00
Maksim Eltyshev 34db8947b6 feat: Toggle actions details, little redesign 2022-07-29 17:40:18 +02:00
Maksim Eltyshev 82e4f73c1f ref: Fix variable names 2022-07-29 17:11:38 +02:00
Maksim Eltyshev 560bddbe18 fix: Fix styles 2022-07-26 13:53:30 +02:00
Maksim Eltyshev 9c192f4b5c fix: Fix select behaviour 2022-07-26 12:49:40 +02:00
Maksim Eltyshev a148a3aae5 feat: Add language selector
Closes #212
2022-07-26 12:26:42 +02:00
Maksim Eltyshev 7c1b885d2a chore: Update version 2022-07-24 17:17:59 +02:00
Maksim Eltyshev a3f33d0361 fix: Fix core locale loading 2022-07-24 17:13:28 +02:00
Maksim Eltyshev fe62180cda chore: Update dependencies 2022-07-24 17:04:26 +02:00
Maksim Eltyshev 58abd0691f chore: Update version 2022-07-21 11:42:56 +02:00
Maksim Eltyshev ad67b9ba24 feat: Add tasks reordering
Closes #50, closes #232
2022-07-21 11:31:05 +02:00
Maksim Eltyshev ddf9a32ea9 chore: Update version 2022-06-24 17:20:44 +02:00
539 changed files with 27804 additions and 21731 deletions
+23 -4
View File
@@ -1,10 +1,29 @@
*/node_modules
*/.gitignore
*/README.md
*/.gitignore
*/node_modules
**/.DS_Store
**/.gitkeep
server/**/.gitkeep
server/.env
server/.editorconfig
server/.eslintignore
server/.npmrc
server/test
server/logs
server/.tmp
server/views/*
server/public/*
server/views/*
!server/public/user-avatars
server/public/user-avatars/*
!server/public/project-background-images
server/public/project-background-images/*
server/private/*
!server/private/attachments
server/private/attachments/*
client/build
+13
View File
@@ -0,0 +1,13 @@
# These are supported funding model platforms
github: meltyshev
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -9,7 +9,7 @@ on:
workflow_dispatch:
env:
ALPINE_VERSION: 3.15
ALPINE_VERSION: 3.16
jobs:
build-and-push-docker-base-image:
+7 -1
View File
@@ -2,5 +2,11 @@ node_modules
docker-compose.override.yml
.idea
.vscode
.DS_Store
# Prevent another lockfile than package-lock.json (npm) from being created
# If some case you are using pnpm or yarn, don't forget to generate npm lockfile
# before commiting your code by running:
# `npm i --package-lock-only`
pnpm-lock.yaml
yarn.lock
+5
View File
@@ -0,0 +1,5 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
+18
View File
@@ -0,0 +1,18 @@
{
"editor.tabSize": 2,
"editor.formatOnSave": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"eslint.format.enable": true,
"eslint.workingDirectories": [
"./client",
"./server"
],
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascriptreact]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
}
}
+22 -14
View File
@@ -1,32 +1,40 @@
FROM node:lts AS client-builder
FROM ghcr.io/plankanban/planka:base-latest as server-dependencies
WORKDIR /app
COPY client/package.json client/package-lock.json ./
COPY server/package.json server/package-lock.json .
RUN npm install npm@latest --global \
&& npm install
&& npm clean-install --omit=dev
FROM node:lts AS client
WORKDIR /app
COPY client/package.json client/package-lock.json .
RUN npm install npm@latest --global \
&& npm clean-install --omit=dev
COPY client .
RUN npm run build
RUN DISABLE_ESLINT_PLUGIN=true npm run build
FROM ghcr.io/plankanban/planka:base-latest
RUN apk del vips-dependencies --purge
USER node
WORKDIR /app
COPY server/.npmrc server/package.json server/package-lock.json ./
COPY --chown=node:node docker-start.sh start.sh
COPY --chown=node:node server .
RUN npm install npm@latest --global \
&& npm install --production \
&& apk del vips-dependencies --purge
RUN mv .env.sample .env
COPY docker-start.sh start.sh
COPY server .
COPY --from=server-dependencies --chown=node:node /app/node_modules node_modules
RUN cp .env.sample .env
COPY --from=client-builder /app/build public
COPY --from=client-builder /app/build/index.html views
COPY --from=client --chown=node:node /app/build public
COPY --from=client --chown=node:node /app/build/index.html views/index.ejs
VOLUME /app/public/user-avatars
VOLUME /app/public/project-background-images
+2 -2
View File
@@ -1,7 +1,7 @@
FROM node:lts-alpine
ARG ALPINE_VERSION=3.15
ARG VIPS_VERSION=8.12.2
ARG ALPINE_VERSION=3.16
ARG VIPS_VERSION=8.13.3
RUN apk -U upgrade \
&& apk add \
+221 -2
View File
@@ -21,9 +21,14 @@ A Trello-like kanban board built with React and Redux.
## Deploy
### Docker Compose
There are 2 types of installation:
1. [Dockerized](#1-docker-compose)
2. [Without Docker](#2-without-docker)
[![](https://d207aa93qlcgug.cloudfront.net/1.95.5.qa/img/nav/docker-logo-loggedout.png)](https://hub.docker.com/r/meltyshev/planka)
### 1. Docker Compose
[![](https://d207aa93qlcgug.cloudfront.net/1.95.5.qa/img/nav/docker-logo-loggedout.png)](https://github.com/plankanban/planka/pkgs/container/planka)
- Make sure you have [Docker](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/) installed and operational.
- Create `docker-compose.yml` based on [the example](https://raw.githubusercontent.com/plankanban/planka/master/docker-compose.yml). This is the ONLY file you will need. You can create this file on your own machine by copy and pasting the content.
@@ -44,6 +49,220 @@ docker-compose up -d
Demo user: demo@demo.demo demo
### 2. Without Docker
Installing without Docker is a bit more complicated, here's what you need to do:
1. Clone this repository into a directory of your choice. (e.g. `/var/www/planka`)
```bash
mkdir -p /var/www/planka
cd /var/www/planka
git clone https://github.com/plankanban/planka.git .
```
2. Install dependencies for client and build it.
```bash
cd client
npm install
npm run build
```
**Note**: You can use `yarn` or `pnpm` instead of `npm`.
3. Copy the `build` directory to the `server/public` directory.
```bash
cp -r build ../server/public
cp build/index.html ../server/views/index.ejs
```
4. Install dependencies for server.
```bash
cd ../server
npm install
```
5. Configure environment variables.
```bash
cp .env.sample .env
# Edit .env file (You could use nano, vim, etc.)
nano .env
```
**Note**: Before continuing, make sure you have your selected database created and running.
6. Copy start script from the root directory to the `server` directory.
```bash
cp ../docker-start.sh start.sh
```
7. Start the server.
```bash
./start.sh
```
**Note**: You can use `pm2` or `systemd` to run the server in the background.
## Additional information
### Nginx configuration
Here is an example of Nginx configuration for Planka, make sure to replace `<domain>` with your domain name, and make sure to configure the SSL.
```nginx
upstream planka {
server localhost:1337;
keepalive 32;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name <domain>;
access_log /var/log/nginx/planka-access.log;
error_log /var/log/nginx/planka-error.log error;
# SSL Configuration - Replace the example <domain> with your domain
ssl_certificate /etc/letsencrypt/live/<domain>/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<domain>/privkey.pem;
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
ssl_prefer_server_ciphers on;
client_max_body_size 120M;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Max-Age 3600;
add_header Access-Control-Expose-Headers Content-Length;
add_header Access-Control-Allow-Headers Range;
# Make sure to allow socket.io connections
location ~* \.io {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
client_max_body_size 50M;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
client_body_timeout 60;
send_timeout 300;
lingering_timeout 5;
proxy_connect_timeout 1d;
proxy_send_timeout 1d;
proxy_read_timeout 1d;
proxy_pass http://planka;
}
location / {
client_max_body_size 50M;
proxy_set_header Connection "";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_cache_revalidate on;
proxy_cache_min_uses 2;
proxy_cache_use_stale timeout;
proxy_cache_lock on;
proxy_http_version 1.1;
proxy_pass http://planka;
}
}
```
### Logging
Planka currently allows you to expose the application's logfile directory to the host machine via a shared volume. This feature is not enabled by default.
To expose the logfile director to the host machine, add the item `./logs/:/app/logs/` under `services.planka.volumes`.
Note that the directory to the left of the semicolon is regarding the host machine while the directory to the right of the semicolon is regarding the Docker container.
For example, in the above step, `./logs/:/app/logs/` will create the folder `logs` in the same directory where the `docker-compose.yml` file lives.
### Rotating Logs
Logrotate is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large.
#### Setup logrotate for Planka logs
Create a file in `/etc/logrotate.d` named `planka` with the following contents:
```
/path/to/planka/logs/planka.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
}
```
Ensure to replace logfile directory with your installation’s `/logs/planka.log` location.
Restart the logrotate service.
### Fail2ban
Fail2ban is a service that uses iptables to automatically drop connections for a pre-defined amount of time from IPs that continuously failed to authenticate to the configured services.
#### Setup a filter and a jail for Planka
A filter defines regex rules to identify when users fail to authenticate on Planka's user interface.
Create a file in `/etc/fail2ban/filter.d` named `planka.conf` with the following contents:
```conf
[Definition]
failregex = ^(.*) Invalid (email or username:|password!) (\"(.*)\"!)? ?\(IP: <ADDR>\)$
ignoreregex =
```
The jail file defines how to handle the failed authentication attempts found by the Planka filter.
Create a file in `/etc/fail2ban/jail.d` named `planka.local` with the following contents:
```conf
[planka]
enabled = true
port = http,https
filter = planka
logpath = /path/to/planka/logs/planka.log
maxretry = 5
bantime = 900
```
Ensure to replace `logpath`'s value with your installation’s `/logs/planka.log` location. If you are using ports other than 80 and 443 for your Web server you should replace those too. The bantime and findtime are defined in seconds.
Restart the fail2ban service. You can check the status of your Planka jail by running:
```bash
fail2ban-client status planka
```
### Import from Trello
It's already available in Planka, or you can also use the great tool [trello2planka](https://github.com/christophenne/trello2planka) to do the import.
## Development
Clone the repository and install dependencies:
+13
View File
@@ -0,0 +1,13 @@
# Security Policy
## Supported Versions
Most recent release.
## Reporting a Vulnerability
Please report any security issues you discovered to meltyshev@gmail.com. If the issue is confirmed, we will release a patch as soon as possible depending on complexity.
**Do NOT create public issues on GitHub for security vulnerabilities.**
Thank you for your contribution!
+56
View File
@@ -0,0 +1,56 @@
const fs = require('fs');
const path = require('path');
const BASE_URL_PLACEHOLDER = 'BASE_URL_PLACEHOLDER';
const replaceInFile = (file, search, replace) => {
fs.readFile(file, 'utf8', (readError, data) => {
if (readError) {
throw new Error(`${readError}`);
}
const res = data.replaceAll(search, replace);
fs.writeFile(file, res, 'utf8', (writeError) => {
if (writeError) {
throw new Error(`${writeError}`);
}
});
});
};
const replaceBaseUrl = (compiler) => {
compiler.hooks.assetEmitted.tap('ReplaceBaseUrlPlaceholder', (file, info) => {
if (info.content.indexOf(BASE_URL_PLACEHOLDER) >= 0) {
if (/\.css$/.exec(info.targetPath)) {
// For CSS 'url(...)' import we can use relative import
const relPath = path.relative(path.dirname(info.targetPath), info.outputPath);
replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, `${relPath}/`);
} else if (/\.js$/.exec(info.targetPath)) {
// For JS 'import ... from "some-asset"' we can get the variable injected in the window object
// eslint-disable-next-line no-template-curly-in-string
replaceInFile(info.targetPath, `"${BASE_URL_PLACEHOLDER}"`, '`${window.BASE_URL}/`');
} else if (/index\.html$/.exec(info.targetPath)) {
// For the main html file, we set a placeholder for sails to inject the correct value as runtime
replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, '<%= BASE_URL %>');
}
}
});
};
module.exports = function override(config, env) {
if (env === 'production') {
const plugins = config.plugins.map((plugin) => {
if (plugin.constructor.name === 'InterpolateHtmlPlugin') {
const newPlugin = plugin;
newPlugin.replacements.PUBLIC_URL = BASE_URL_PLACEHOLDER;
return newPlugin;
}
return plugin;
});
return {
...config,
output: { ...config.output, publicPath: BASE_URL_PLACEHOLDER },
plugins: [...plugins, { apply: replaceBaseUrl }],
};
}
return config;
};
+12463 -12037
View File
File diff suppressed because it is too large Load Diff
+47 -55
View File
@@ -2,11 +2,11 @@
"name": "planka-client",
"private": true,
"scripts": {
"build": "react-scripts build",
"build": "react-app-rewired build",
"eject": "react-scripts eject",
"lint": "eslint --ext js,jsx src",
"start": "react-scripts start",
"test": "react-scripts test"
"lint": "eslint --ext js,jsx src config-overrides.js",
"start": "react-app-rewired start",
"test": "react-app-rewired test"
},
"browserslist": {
"production": [
@@ -34,15 +34,13 @@
},
"requireConfigFile": false
},
"plugins": [
"prettier"
],
"extends": [
"airbnb",
"airbnb/hooks",
"plugin:prettier/recommended"
"../package.json"
],
"rules": {
"no-unused-vars": "warn",
"import/no-extraneous-dependencies": [
"error",
{
@@ -51,72 +49,66 @@
"**/*.test.js"
]
}
],
"prettier/prettier": [
"error",
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}
]
}
},
"dependencies": {
"classnames": "^2.2.6",
"connected-react-router": "^6.9.2",
"date-fns": "^2.28.0",
"dequal": "^2.0.2",
"history": "^4.10.1",
"i18next": "^21.6.16",
"i18next-browser-languagedetector": "^6.1.4",
"@juggle/resize-observer": "^3.4.0",
"classnames": "^2.3.2",
"date-fns": "^2.29.3",
"dequal": "^2.0.3",
"easymde": "^2.18.0",
"history": "^5.3.0",
"i18next": "^22.0.6",
"i18next-browser-languagedetector": "^7.0.1",
"initials": "^3.1.2",
"js-cookie": "^3.0.1",
"lodash": "^4.17.20",
"node-sass": "^7.0.1",
"photoswipe": "^5.2.7",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"node-sass": "^8.0.0",
"photoswipe": "^5.3.3",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-beautiful-dnd": "^13.0.0",
"react-datepicker": "^4.7.0",
"react-dom": "^17.0.2",
"react-dropzone": "^12.0.5",
"react-i18next": "^11.16.6",
"react": "^18.2.0",
"react-app-rewired": "^2.2.1",
"react-beautiful-dnd": "^13.1.1",
"react-datepicker": "^4.8.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-i18next": "^12.0.0",
"react-input-mask": "^2.0.4",
"react-markdown": "^8.0.2",
"react-photoswipe-gallery": "^2.2.1",
"react-redux": "^7.2.8",
"react-router-dom": "^5.3.1",
"react-markdown": "^8.0.3",
"react-photoswipe-gallery": "^2.2.2",
"react-redux": "^8.0.5",
"react-router-dom": "^6.4.3",
"react-scripts": "5.0.1",
"react-textarea-autosize": "^8.3.3",
"redux": "^4.1.2",
"react-simplemde-editor": "^5.2.0",
"react-textarea-autosize": "^8.4.0",
"redux": "^4.2.0",
"redux-logger": "^3.0.6",
"redux-orm": "^0.16.2",
"redux-saga": "^1.1.3",
"redux-saga": "^1.2.1",
"remark-breaks": "^3.0.2",
"remark-gfm": "^3.0.1",
"reselect": "^4.1.5",
"reselect": "^4.1.7",
"sails.io.js": "^1.2.1",
"semantic-ui-react": "^2.1.2",
"socket.io-client": "^2.3.1",
"semantic-ui-react": "^2.1.3",
"socket.io-client": "^2.5.0",
"validator": "^13.7.0",
"whatwg-fetch": "^3.5.0"
"whatwg-fetch": "^3.6.2",
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"babel-preset-airbnb": "^5.0.0",
"chai": "^4.3.6",
"enzyme": "^3.11.0",
"eslint": "^8.13.0",
"chai": "^4.3.7",
"eslint": "^8.28.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0",
"jest-enzyme": "^7.1.2",
"prettier": "2.6.2",
"react-test-renderer": "^17.0.2"
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"react-test-renderer": "^18.2.0"
}
}
+1
View File
@@ -26,6 +26,7 @@
-->
<title>Planka</title>
</head>
<script>window.BASE_URL = "%PUBLIC_URL%";</script>
<body id="app">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
-22
View File
@@ -1,22 +0,0 @@
import ActionTypes from '../constants/ActionTypes';
export const handleActionCreate = (action) => ({
type: ActionTypes.ACTION_CREATE_HANDLE,
payload: {
action,
},
});
export const handleActionUpdate = (action) => ({
type: ActionTypes.ACTION_UPDATE_HANDLE,
payload: {
action,
},
});
export const handleActionDelete = (action) => ({
type: ActionTypes.ACTION_DELETE_HANDLE,
payload: {
action,
},
});
-26
View File
@@ -1,26 +0,0 @@
import ActionTypes from '../constants/ActionTypes';
// eslint-disable-next-line import/prefer-default-export
export const fetchActions = (cardId) => ({
type: ActionTypes.ACTIONS_FETCH,
payload: {
cardId,
},
});
fetchActions.success = (cardId, actions, users) => ({
type: ActionTypes.ACTIONS_FETCH__SUCCESS,
payload: {
cardId,
actions,
users,
},
});
fetchActions.failure = (cardId, error) => ({
type: ActionTypes.ACTIONS_FETCH__FAILURE,
payload: {
cardId,
error,
},
});
+79
View File
@@ -0,0 +1,79 @@
import ActionTypes from '../constants/ActionTypes';
const fetchActivities = (cardId) => ({
type: ActionTypes.ACTIVITIES_FETCH,
payload: {
cardId,
},
});
fetchActivities.success = (cardId, activities, users) => ({
type: ActionTypes.ACTIVITIES_FETCH__SUCCESS,
payload: {
cardId,
activities,
users,
},
});
fetchActivities.failure = (cardId, error) => ({
type: ActionTypes.ACTIVITIES_FETCH__FAILURE,
payload: {
cardId,
error,
},
});
const toggleActivitiesDetails = (cardId, isVisible) => ({
type: ActionTypes.ACTIVITIES_DETAILS_TOGGLE,
payload: {
cardId,
isVisible,
},
});
toggleActivitiesDetails.success = (cardId, activities, users) => ({
type: ActionTypes.ACTIVITIES_DETAILS_TOGGLE__SUCCESS,
payload: {
cardId,
activities,
users,
},
});
toggleActivitiesDetails.failure = (cardId, error) => ({
type: ActionTypes.ACTIVITIES_DETAILS_TOGGLE__FAILURE,
payload: {
cardId,
error,
},
});
const handleActivityCreate = (activity) => ({
type: ActionTypes.ACTIVITY_CREATE_HANDLE,
payload: {
activity,
},
});
const handleActivityUpdate = (activity) => ({
type: ActionTypes.ACTIVITY_UPDATE_HANDLE,
payload: {
activity,
},
});
const handleActivityDelete = (activity) => ({
type: ActionTypes.ACTIVITY_DELETE_HANDLE,
payload: {
activity,
},
});
export default {
fetchActivities,
toggleActivitiesDetails,
handleActivityCreate,
handleActivityUpdate,
handleActivityDelete,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createAttachment = (attachment) => ({
const createAttachment = (attachment) => ({
type: ActionTypes.ATTACHMENT_CREATE,
payload: {
attachment,
@@ -23,14 +23,14 @@ createAttachment.failure = (localId, error) => ({
},
});
export const handleAttachmentCreate = (attachment) => ({
const handleAttachmentCreate = (attachment) => ({
type: ActionTypes.ATTACHMENT_CREATE_HANDLE,
payload: {
attachment,
},
});
export const updateAttachment = (id, data) => ({
const updateAttachment = (id, data) => ({
type: ActionTypes.ATTACHMENT_UPDATE,
payload: {
id,
@@ -53,14 +53,14 @@ updateAttachment.failure = (id, error) => ({
},
});
export const handleAttachmentUpdate = (attachment) => ({
const handleAttachmentUpdate = (attachment) => ({
type: ActionTypes.ATTACHMENT_UPDATE_HANDLE,
payload: {
attachment,
},
});
export const deleteAttachment = (id) => ({
const deleteAttachment = (id) => ({
type: ActionTypes.ATTACHMENT_DELETE,
payload: {
id,
@@ -82,9 +82,18 @@ deleteAttachment.failure = (id, error) => ({
},
});
export const handleAttachmentDelete = (attachment) => ({
const handleAttachmentDelete = (attachment) => ({
type: ActionTypes.ATTACHMENT_DELETE_HANDLE,
payload: {
attachment,
},
});
export default {
createAttachment,
handleAttachmentCreate,
updateAttachment,
handleAttachmentUpdate,
deleteAttachment,
handleAttachmentDelete,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createBoardMembership = (boardMembership) => ({
const createBoardMembership = (boardMembership) => ({
type: ActionTypes.BOARD_MEMBERSHIP_CREATE,
payload: {
boardMembership,
@@ -23,7 +23,7 @@ createBoardMembership.failure = (localId, error) => ({
},
});
export const handleBoardMembershipCreate = (
const handleBoardMembershipCreate = (
boardMembership,
project,
board,
@@ -38,6 +38,7 @@ export const handleBoardMembershipCreate = (
cardLabels,
tasks,
attachments,
deletedNotifications,
) => ({
type: ActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE,
payload: {
@@ -55,6 +56,7 @@ export const handleBoardMembershipCreate = (
cardLabels,
tasks,
attachments,
deletedNotifications,
},
});
@@ -67,7 +69,37 @@ handleBoardMembershipCreate.fetchProject = (id, currentUserId, currentBoardId) =
},
});
export const deleteBoardMembership = (id) => ({
const updateBoardMembership = (id, data) => ({
type: ActionTypes.BOARD_MEMBERSHIP_UPDATE,
payload: {
id,
data,
},
});
updateBoardMembership.success = (boardMembership) => ({
type: ActionTypes.BOARD_MEMBERSHIP_UPDATE__SUCCESS,
payload: {
boardMembership,
},
});
updateBoardMembership.failure = (id, error) => ({
type: ActionTypes.BOARD_MEMBERSHIP_UPDATE__FAILURE,
payload: {
id,
error,
},
});
const handleBoardMembershipUpdate = (boardMembership) => ({
type: ActionTypes.BOARD_MEMBERSHIP_UPDATE_HANDLE,
payload: {
boardMembership,
},
});
const deleteBoardMembership = (id) => ({
type: ActionTypes.BOARD_MEMBERSHIP_DELETE,
payload: {
id,
@@ -89,9 +121,18 @@ deleteBoardMembership.failure = (id, error) => ({
},
});
export const handleBoardMembershipDelete = (boardMembership) => ({
const handleBoardMembershipDelete = (boardMembership) => ({
type: ActionTypes.BOARD_MEMBERSHIP_DELETE_HANDLE,
payload: {
boardMembership,
},
});
export default {
createBoardMembership,
handleBoardMembershipCreate,
updateBoardMembership,
handleBoardMembershipUpdate,
deleteBoardMembership,
handleBoardMembershipDelete,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createBoard = (board) => ({
const createBoard = (board) => ({
type: ActionTypes.BOARD_CREATE,
payload: {
board,
@@ -24,14 +24,14 @@ createBoard.failure = (localId, error) => ({
},
});
export const handleBoardCreate = (board) => ({
const handleBoardCreate = (board) => ({
type: ActionTypes.BOARD_CREATE_HANDLE,
payload: {
board,
},
});
export const fetchBoard = (id) => ({
const fetchBoard = (id) => ({
type: ActionTypes.BOARD_FETCH,
payload: {
id,
@@ -75,7 +75,7 @@ fetchBoard.failure = (id, error) => ({
},
});
export const updateBoard = (id, data) => ({
const updateBoard = (id, data) => ({
type: ActionTypes.BOARD_UPDATE,
payload: {
id,
@@ -98,14 +98,14 @@ updateBoard.failure = (id, error) => ({
},
});
export const handleBoardUpdate = (board) => ({
const handleBoardUpdate = (board) => ({
type: ActionTypes.BOARD_UPDATE_HANDLE,
payload: {
board,
},
});
export const deleteBoard = (id) => ({
const deleteBoard = (id) => ({
type: ActionTypes.BOARD_DELETE,
payload: {
id,
@@ -127,9 +127,19 @@ deleteBoard.failure = (id, error) => ({
},
});
export const handleBoardDelete = (board) => ({
const handleBoardDelete = (board) => ({
type: ActionTypes.BOARD_DELETE_HANDLE,
payload: {
board,
},
});
export default {
createBoard,
handleBoardCreate,
fetchBoard,
updateBoard,
handleBoardUpdate,
deleteBoard,
handleBoardDelete,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createCard = (card) => ({
const createCard = (card) => ({
type: ActionTypes.CARD_CREATE,
payload: {
card,
@@ -23,14 +23,14 @@ createCard.failure = (localId, error) => ({
},
});
export const handleCardCreate = (card) => ({
const handleCardCreate = (card) => ({
type: ActionTypes.CARD_CREATE_HANDLE,
payload: {
card,
},
});
export const updateCard = (id, data) => ({
const updateCard = (id, data) => ({
type: ActionTypes.CARD_UPDATE,
payload: {
id,
@@ -53,14 +53,14 @@ updateCard.failure = (id, error) => ({
},
});
export const handleCardUpdate = (card) => ({
const handleCardUpdate = (card) => ({
type: ActionTypes.CARD_UPDATE_HANDLE,
payload: {
card,
},
});
export const deleteCard = (id) => ({
const deleteCard = (id) => ({
type: ActionTypes.CARD_DELETE,
payload: {
id,
@@ -82,9 +82,18 @@ deleteCard.failure = (id, error) => ({
},
});
export const handleCardDelete = (card) => ({
const handleCardDelete = (card) => ({
type: ActionTypes.CARD_DELETE_HANDLE,
payload: {
card,
},
});
export default {
createCard,
handleCardCreate,
updateCard,
handleCardUpdate,
deleteCard,
handleCardDelete,
};
-69
View File
@@ -1,69 +0,0 @@
import ActionTypes from '../constants/ActionTypes';
export const createCommentAction = (action) => ({
type: ActionTypes.COMMENT_ACTION_CREATE,
payload: {
action,
},
});
createCommentAction.success = (localId, action) => ({
type: ActionTypes.COMMENT_ACTION_CREATE__SUCCESS,
payload: {
localId,
action,
},
});
createCommentAction.failure = (localId, error) => ({
type: ActionTypes.COMMENT_ACTION_CREATE__FAILURE,
payload: {
localId,
error,
},
});
export const updateCommentAction = (id, data) => ({
type: ActionTypes.COMMENT_ACTION_UPDATE,
payload: {
id,
data,
},
});
updateCommentAction.success = (action) => ({
type: ActionTypes.COMMENT_ACTION_UPDATE__SUCCESS,
payload: {
action,
},
});
updateCommentAction.failure = (id, error) => ({
type: ActionTypes.COMMENT_ACTION_UPDATE__FAILURE,
payload: {
id,
error,
},
});
export const deleteCommentAction = (id) => ({
type: ActionTypes.COMMENT_ACTION_DELETE,
payload: {
id,
},
});
deleteCommentAction.success = (action) => ({
type: ActionTypes.COMMENT_ACTION_DELETE__SUCCESS,
payload: {
action,
},
});
deleteCommentAction.failure = (id, error) => ({
type: ActionTypes.COMMENT_ACTION_DELETE__FAILURE,
payload: {
id,
error,
},
});
+75
View File
@@ -0,0 +1,75 @@
import ActionTypes from '../constants/ActionTypes';
const createCommentActivity = (activity) => ({
type: ActionTypes.COMMENT_ACTIVITY_CREATE,
payload: {
activity,
},
});
createCommentActivity.success = (localId, activity) => ({
type: ActionTypes.COMMENT_ACTIVITY_CREATE__SUCCESS,
payload: {
localId,
activity,
},
});
createCommentActivity.failure = (localId, error) => ({
type: ActionTypes.COMMENT_ACTIVITY_CREATE__FAILURE,
payload: {
localId,
error,
},
});
const updateCommentActivity = (id, data) => ({
type: ActionTypes.COMMENT_ACTIVITY_UPDATE,
payload: {
id,
data,
},
});
updateCommentActivity.success = (activity) => ({
type: ActionTypes.COMMENT_ACTIVITY_UPDATE__SUCCESS,
payload: {
activity,
},
});
updateCommentActivity.failure = (id, error) => ({
type: ActionTypes.COMMENT_ACTIVITY_UPDATE__FAILURE,
payload: {
id,
error,
},
});
const deleteCommentActivity = (id) => ({
type: ActionTypes.COMMENT_ACTIVITY_DELETE,
payload: {
id,
},
});
deleteCommentActivity.success = (activity) => ({
type: ActionTypes.COMMENT_ACTIVITY_DELETE__SUCCESS,
payload: {
activity,
},
});
deleteCommentActivity.failure = (id, error) => ({
type: ActionTypes.COMMENT_ACTIVITY_DELETE__FAILURE,
payload: {
id,
error,
},
});
export default {
createCommentActivity,
updateCommentActivity,
deleteCommentActivity,
};
+18 -4
View File
@@ -1,7 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
// eslint-disable-next-line import/prefer-default-export
export const initializeCore = (
const initializeCore = (
user,
board,
users,
@@ -16,7 +15,7 @@ export const initializeCore = (
cardLabels,
tasks,
attachments,
actions,
activities,
notifications,
) => ({
type: ActionTypes.CORE_INITIALIZE,
@@ -35,7 +34,22 @@ export const initializeCore = (
cardLabels,
tasks,
attachments,
actions,
activities,
notifications,
},
});
const logout = () => ({
type: ActionTypes.LOGOUT,
payload: {},
});
logout.invalidateAccessToken = () => ({
type: ActionTypes.LOGOUT__ACCESS_TOKEN_INVALIDATE,
payload: {},
});
export default {
initializeCore,
logout,
};
-22
View File
@@ -1,22 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const handleActionCreate = (action) => ({
type: EntryActionTypes.ACTION_CREATE_HANDLE,
payload: {
action,
},
});
export const handleActionUpdate = (action) => ({
type: EntryActionTypes.ACTION_UPDATE_HANDLE,
payload: {
action,
},
});
export const handleActionDelete = (action) => ({
type: EntryActionTypes.ACTION_DELETE_HANDLE,
payload: {
action,
},
});
-7
View File
@@ -1,7 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
// eslint-disable-next-line import/prefer-default-export
export const fetchActionsInCurrentCard = () => ({
type: EntryActionTypes.ACTIONS_IN_CURRENT_CARD_FETCH,
payload: {},
});
@@ -1,29 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const createMembershipInCurrentBoard = (data) => ({
type: EntryActionTypes.MEMBERSHIP_IN_CURRENT_BOARD_CREATE,
payload: {
data,
},
});
export const handleBoardMembershipCreate = (boardMembership) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE,
payload: {
boardMembership,
},
});
export const deleteBoardMembership = (id) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_DELETE,
payload: {
id,
},
});
export const handleBoardMembershipDelete = (boardMembership) => ({
type: EntryActionTypes.BOARD_MEMBERSHIP_DELETE_HANDLE,
payload: {
boardMembership,
},
});
@@ -1,23 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const createCommentActionInCurrentCard = (data) => ({
type: EntryActionTypes.COMMENT_ACTION_IN_CURRENT_CARD_CREATE,
payload: {
data,
},
});
export const updateCommentAction = (id, data) => ({
type: EntryActionTypes.COMMENT_ACTION_UPDATE,
payload: {
id,
data,
},
});
export const deleteCommentAction = (id) => ({
type: EntryActionTypes.COMMENT_ACTION_DELETE,
payload: {
id,
},
});
-7
View File
@@ -1,7 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
// eslint-disable-next-line import/prefer-default-export
export const initializeCore = () => ({
type: EntryActionTypes.CORE_INITIALIZE,
payload: {},
});
-18
View File
@@ -1,18 +0,0 @@
export * from './socket';
export * from './login';
export * from './core';
export * from './modal';
export * from './user';
export * from './project';
export * from './project-manager';
export * from './board';
export * from './board-membership';
export * from './label';
export * from './list';
export * from './card';
export * from './task';
export * from './attachment';
export * from './actions';
export * from './action';
export * from './comment-action';
export * from './notification';
-18
View File
@@ -1,18 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const authenticate = (data) => ({
type: EntryActionTypes.AUTHENTICATE,
payload: {
data,
},
});
export const clearAuthenticateError = () => ({
type: EntryActionTypes.AUTHENTICATE_ERROR_CLEAR,
payload: {},
});
export const logout = () => ({
type: EntryActionTypes.LOGOUT,
payload: {},
});
-22
View File
@@ -1,22 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const handleNotificationCreate = (notification) => ({
type: EntryActionTypes.NOTIFICATION_CREATE_HANDLE,
payload: {
notification,
},
});
export const deleteNotification = (id) => ({
type: EntryActionTypes.NOTIFICATION_DELETE,
payload: {
id,
},
});
export const handleNotificationDelete = (notification) => ({
type: EntryActionTypes.NOTIFICATION_DELETE_HANDLE,
payload: {
notification,
},
});
@@ -1,29 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const createManagerInCurrentProject = (data) => ({
type: EntryActionTypes.MANAGER_IN_CURRENT_PROJECT_CREATE,
payload: {
data,
},
});
export const handleProjectManagerCreate = (projectManager) => ({
type: EntryActionTypes.PROJECT_MANAGER_CREATE_HANDLE,
payload: {
projectManager,
},
});
export const deleteProjectManager = (id) => ({
type: EntryActionTypes.PROJECT_MANAGER_DELETE,
payload: {
id,
},
});
export const handleProjectManagerDelete = (projectManager) => ({
type: EntryActionTypes.PROJECT_MANAGER_DELETE_HANDLE,
payload: {
projectManager,
},
});
-11
View File
@@ -1,11 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const handleSocketDisconnect = () => ({
type: EntryActionTypes.SOCKET_DISCONNECT_HANDLE,
payload: {},
});
export const handleSocketReconnect = () => ({
type: EntryActionTypes.SOCKET_RECONNECT_HANDLE,
payload: {},
});
-44
View File
@@ -1,44 +0,0 @@
import EntryActionTypes from '../../constants/EntryActionTypes';
export const createTaskInCurrentCard = (data) => ({
type: EntryActionTypes.TASK_IN_CURRENT_CARD_CREATE,
payload: {
data,
},
});
export const handleTaskCreate = (task) => ({
type: EntryActionTypes.TASK_CREATE_HANDLE,
payload: {
task,
},
});
export const updateTask = (id, data) => ({
type: EntryActionTypes.TASK_UPDATE,
payload: {
id,
data,
},
});
export const handleTaskUpdate = (task) => ({
type: EntryActionTypes.TASK_UPDATE_HANDLE,
payload: {
task,
},
});
export const deleteTask = (id) => ({
type: EntryActionTypes.TASK_DELETE,
payload: {
id,
},
});
export const handleTaskDelete = (task) => ({
type: EntryActionTypes.TASK_DELETE_HANDLE,
payload: {
task,
},
});
+39 -19
View File
@@ -1,19 +1,39 @@
export * from './router';
export * from './socket';
export * from './login';
export * from './core';
export * from './modal';
export * from './user';
export * from './project';
export * from './project-manager';
export * from './board';
export * from './board-membership';
export * from './label';
export * from './list';
export * from './card';
export * from './task';
export * from './attachment';
export * from './actions';
export * from './action';
export * from './comment-action';
export * from './notification';
import router from './router';
import socket from './socket';
import login from './login';
import core from './core';
import modals from './modals';
import users from './users';
import projects from './projects';
import projectManagers from './project-managers';
import boards from './boards';
import boardMemberships from './board-memberships';
import labels from './labels';
import lists from './lists';
import cards from './cards';
import tasks from './tasks';
import attachments from './attachments';
import activities from './activities';
import commentActivities from './comment-activities';
import notifications from './notifications';
export default {
...router,
...socket,
...login,
...core,
...modals,
...users,
...projects,
...projectManagers,
...boards,
...boardMemberships,
...labels,
...lists,
...cards,
...tasks,
...attachments,
...activities,
...commentActivities,
...notifications,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createLabel = (label) => ({
const createLabel = (label) => ({
type: ActionTypes.LABEL_CREATE,
payload: {
label,
@@ -23,14 +23,14 @@ createLabel.failure = (localId, error) => ({
},
});
export const handleLabelCreate = (label) => ({
const handleLabelCreate = (label) => ({
type: ActionTypes.LABEL_CREATE_HANDLE,
payload: {
label,
},
});
export const updateLabel = (id, data) => ({
const updateLabel = (id, data) => ({
type: ActionTypes.LABEL_UPDATE,
payload: {
id,
@@ -53,14 +53,14 @@ updateLabel.failure = (id, error) => ({
},
});
export const handleLabelUpdate = (label) => ({
const handleLabelUpdate = (label) => ({
type: ActionTypes.LABEL_UPDATE_HANDLE,
payload: {
label,
},
});
export const deleteLabel = (id) => ({
const deleteLabel = (id) => ({
type: ActionTypes.LABEL_DELETE,
payload: {
id,
@@ -82,14 +82,14 @@ deleteLabel.failure = (id, error) => ({
},
});
export const handleLabelDelete = (label) => ({
const handleLabelDelete = (label) => ({
type: ActionTypes.LABEL_DELETE_HANDLE,
payload: {
label,
},
});
export const addLabelToCard = (id, cardId) => ({
const addLabelToCard = (id, cardId) => ({
type: ActionTypes.LABEL_TO_CARD_ADD,
payload: {
id,
@@ -113,14 +113,14 @@ addLabelToCard.failure = (id, cardId, error) => ({
},
});
export const handleLabelToCardAdd = (cardLabel) => ({
const handleLabelToCardAdd = (cardLabel) => ({
type: ActionTypes.LABEL_TO_CARD_ADD_HANDLE,
payload: {
cardLabel,
},
});
export const removeLabelFromCard = (id, cardId) => ({
const removeLabelFromCard = (id, cardId) => ({
type: ActionTypes.LABEL_FROM_CARD_REMOVE,
payload: {
id,
@@ -144,14 +144,14 @@ removeLabelFromCard.failure = (id, cardId, error) => ({
},
});
export const handleLabelFromCardRemove = (cardLabel) => ({
const handleLabelFromCardRemove = (cardLabel) => ({
type: ActionTypes.LABEL_FROM_CARD_REMOVE_HANDLE,
payload: {
cardLabel,
},
});
export const addLabelToBoardFilter = (id, boardId) => ({
const addLabelToBoardFilter = (id, boardId) => ({
type: ActionTypes.LABEL_TO_BOARD_FILTER_ADD,
payload: {
id,
@@ -159,10 +159,25 @@ export const addLabelToBoardFilter = (id, boardId) => ({
},
});
export const removeLabelFromBoardFilter = (id, boardId) => ({
const removeLabelFromBoardFilter = (id, boardId) => ({
type: ActionTypes.LABEL_FROM_BOARD_FILTER_REMOVE,
payload: {
id,
boardId,
},
});
export default {
createLabel,
handleLabelCreate,
updateLabel,
handleLabelUpdate,
deleteLabel,
handleLabelDelete,
addLabelToCard,
handleLabelToCardAdd,
removeLabelFromCard,
handleLabelFromCardRemove,
addLabelToBoardFilter,
removeLabelFromBoardFilter,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createList = (list) => ({
const createList = (list) => ({
type: ActionTypes.LIST_CREATE,
payload: {
list,
@@ -23,14 +23,14 @@ createList.failure = (localId, error) => ({
},
});
export const handleListCreate = (list) => ({
const handleListCreate = (list) => ({
type: ActionTypes.LIST_CREATE_HANDLE,
payload: {
list,
},
});
export const updateList = (id, data) => ({
const updateList = (id, data) => ({
type: ActionTypes.LIST_UPDATE,
payload: {
id,
@@ -53,14 +53,14 @@ updateList.failure = (id, error) => ({
},
});
export const handleListUpdate = (list) => ({
const handleListUpdate = (list) => ({
type: ActionTypes.LIST_UPDATE_HANDLE,
payload: {
list,
},
});
export const deleteList = (id) => ({
const deleteList = (id) => ({
type: ActionTypes.LIST_DELETE,
payload: {
id,
@@ -82,9 +82,18 @@ deleteList.failure = (id, error) => ({
},
});
export const handleListDelete = (list) => ({
const handleListDelete = (list) => ({
type: ActionTypes.LIST_DELETE_HANDLE,
payload: {
list,
},
});
export default {
createList,
handleListCreate,
updateList,
handleListUpdate,
deleteList,
handleListDelete,
};
+6 -6
View File
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const authenticate = (data) => ({
const authenticate = (data) => ({
type: ActionTypes.AUTHENTICATE,
payload: {
data,
@@ -21,12 +21,12 @@ authenticate.failure = (error) => ({
},
});
export const clearAuthenticateError = () => ({
const clearAuthenticateError = () => ({
type: ActionTypes.AUTHENTICATE_ERROR_CLEAR,
payload: {},
});
export const logout = () => ({
type: ActionTypes.LOGOUT,
payload: {},
});
export default {
authenticate,
clearAuthenticateError,
};
@@ -1,13 +1,18 @@
import ActionTypes from '../constants/ActionTypes';
export const openModal = (type) => ({
const openModal = (type) => ({
type: ActionTypes.MODAL_OPEN,
payload: {
type,
},
});
export const closeModal = () => ({
const closeModal = () => ({
type: ActionTypes.MODAL_CLOSE,
payload: {},
});
export default {
openModal,
closeModal,
};
@@ -1,16 +1,16 @@
import ActionTypes from '../constants/ActionTypes';
export const handleNotificationCreate = (notification, users, cards, actions) => ({
const handleNotificationCreate = (notification, users, cards, activities) => ({
type: ActionTypes.NOTIFICATION_CREATE_HANDLE,
payload: {
notification,
users,
cards,
actions,
activities,
},
});
export const deleteNotification = (id) => ({
const deleteNotification = (id) => ({
type: ActionTypes.NOTIFICATION_DELETE,
payload: {
id,
@@ -32,9 +32,15 @@ deleteNotification.failure = (id, error) => ({
},
});
export const handleNotificationDelete = (notification) => ({
const handleNotificationDelete = (notification) => ({
type: ActionTypes.NOTIFICATION_DELETE_HANDLE,
payload: {
notification,
},
});
export default {
handleNotificationCreate,
deleteNotification,
handleNotificationDelete,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createProjectManager = (projectManager) => ({
const createProjectManager = (projectManager) => ({
type: ActionTypes.PROJECT_MANAGER_CREATE,
payload: {
projectManager,
@@ -23,7 +23,7 @@ createProjectManager.failure = (localId, error) => ({
},
});
export const handleProjectManagerCreate = (
const handleProjectManagerCreate = (
projectManager,
project,
board,
@@ -38,6 +38,7 @@ export const handleProjectManagerCreate = (
cardLabels,
tasks,
attachments,
deletedNotifications,
) => ({
type: ActionTypes.PROJECT_MANAGER_CREATE_HANDLE,
payload: {
@@ -55,6 +56,7 @@ export const handleProjectManagerCreate = (
cardLabels,
tasks,
attachments,
deletedNotifications,
},
});
@@ -67,7 +69,7 @@ handleProjectManagerCreate.fetchProject = (id, currentUserId, currentBoardId) =>
},
});
export const deleteProjectManager = (id, isCurrentUser, isCurrentProject) => ({
const deleteProjectManager = (id, isCurrentUser, isCurrentProject) => ({
type: ActionTypes.PROJECT_MANAGER_DELETE,
payload: {
id,
@@ -91,7 +93,7 @@ deleteProjectManager.failure = (id, error) => ({
},
});
export const handleProjectManagerDelete = (projectManager, isCurrentUser, isCurrentProject) => ({
const handleProjectManagerDelete = (projectManager, isCurrentUser, isCurrentProject) => ({
type: ActionTypes.PROJECT_MANAGER_DELETE_HANDLE,
payload: {
projectManager,
@@ -99,3 +101,10 @@ export const handleProjectManagerDelete = (projectManager, isCurrentUser, isCurr
isCurrentProject,
},
});
export default {
createProjectManager,
handleProjectManagerCreate,
deleteProjectManager,
handleProjectManagerDelete,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createProject = (data) => ({
const createProject = (data) => ({
type: ActionTypes.PROJECT_CREATE,
payload: {
data,
@@ -22,7 +22,7 @@ createProject.failure = (error) => ({
},
});
export const handleProjectCreate = (project, users, projectManagers, boards, boardMemberships) => ({
const handleProjectCreate = (project, users, projectManagers, boards, boardMemberships) => ({
type: ActionTypes.PROJECT_CREATE_HANDLE,
payload: {
project,
@@ -33,7 +33,7 @@ export const handleProjectCreate = (project, users, projectManagers, boards, boa
},
});
export const updateProject = (id, data) => ({
const updateProject = (id, data) => ({
type: ActionTypes.PROJECT_UPDATE,
payload: {
id,
@@ -56,14 +56,14 @@ updateProject.failure = (id, error) => ({
},
});
export const handleProjectUpdate = (project) => ({
const handleProjectUpdate = (project) => ({
type: ActionTypes.PROJECT_UPDATE_HANDLE,
payload: {
project,
},
});
export const updateProjectBackgroundImage = (id) => ({
const updateProjectBackgroundImage = (id) => ({
type: ActionTypes.PROJECT_BACKGROUND_IMAGE_UPDATE,
payload: {
id,
@@ -85,7 +85,7 @@ updateProjectBackgroundImage.failure = (id, error) => ({
},
});
export const deleteProject = (id) => ({
const deleteProject = (id) => ({
type: ActionTypes.PROJECT_DELETE,
payload: {
id,
@@ -107,9 +107,19 @@ deleteProject.failure = (id, error) => ({
},
});
export const handleProjectDelete = (project) => ({
const handleProjectDelete = (project) => ({
type: ActionTypes.PROJECT_DELETE_HANDLE,
payload: {
project,
},
});
export default {
createProject,
handleProjectCreate,
updateProject,
handleProjectUpdate,
updateProjectBackgroundImage,
deleteProject,
handleProjectDelete,
};
+7 -4
View File
@@ -1,7 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
// eslint-disable-next-line import/prefer-default-export
export const handleLocationChange = (
const handleLocationChange = (
board,
users,
projects,
@@ -13,7 +12,7 @@ export const handleLocationChange = (
cardLabels,
tasks,
attachments,
notifications,
deletedNotifications,
) => ({
type: ActionTypes.LOCATION_CHANGE_HANDLE,
payload: {
@@ -28,7 +27,7 @@ export const handleLocationChange = (
cardLabels,
tasks,
attachments,
notifications,
deletedNotifications,
},
});
@@ -38,3 +37,7 @@ handleLocationChange.fetchBoard = (id) => ({
id,
},
});
export default {
handleLocationChange,
};
+9 -4
View File
@@ -1,11 +1,11 @@
import ActionTypes from '../constants/ActionTypes';
export const handleSocketDisconnect = () => ({
const handleSocketDisconnect = () => ({
type: ActionTypes.SOCKET_DISCONNECT_HANDLE,
payload: {},
});
export const handleSocketReconnect = (
const handleSocketReconnect = (
user,
board,
users,
@@ -20,7 +20,7 @@ export const handleSocketReconnect = (
cardLabels,
tasks,
attachments,
actions,
activities,
notifications,
) => ({
type: ActionTypes.SOCKET_RECONNECT_HANDLE,
@@ -39,7 +39,7 @@ export const handleSocketReconnect = (
cardLabels,
tasks,
attachments,
actions,
activities,
notifications,
},
});
@@ -51,3 +51,8 @@ handleSocketReconnect.fetchCore = (currentUserId, currentBoardId) => ({
currentBoardId,
},
});
export default {
handleSocketDisconnect,
handleSocketReconnect,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createTask = (task) => ({
const createTask = (task) => ({
type: ActionTypes.TASK_CREATE,
payload: {
task,
@@ -23,14 +23,14 @@ createTask.failure = (localId, error) => ({
},
});
export const handleTaskCreate = (task) => ({
const handleTaskCreate = (task) => ({
type: ActionTypes.TASK_CREATE_HANDLE,
payload: {
task,
},
});
export const updateTask = (id, data) => ({
const updateTask = (id, data) => ({
type: ActionTypes.TASK_UPDATE,
payload: {
id,
@@ -53,14 +53,14 @@ updateTask.failure = (id, error) => ({
},
});
export const handleTaskUpdate = (task) => ({
const handleTaskUpdate = (task) => ({
type: ActionTypes.TASK_UPDATE_HANDLE,
payload: {
task,
},
});
export const deleteTask = (id) => ({
const deleteTask = (id) => ({
type: ActionTypes.TASK_DELETE,
payload: {
id,
@@ -82,9 +82,18 @@ deleteTask.failure = (id, error) => ({
},
});
export const handleTaskDelete = (task) => ({
const handleTaskDelete = (task) => ({
type: ActionTypes.TASK_DELETE_HANDLE,
payload: {
task,
},
});
export default {
createTask,
handleTaskCreate,
updateTask,
handleTaskUpdate,
deleteTask,
handleTaskDelete,
};
@@ -1,6 +1,6 @@
import ActionTypes from '../constants/ActionTypes';
export const createUser = (data) => ({
const createUser = (data) => ({
type: ActionTypes.USER_CREATE,
payload: {
data,
@@ -21,19 +21,19 @@ createUser.failure = (error) => ({
},
});
export const handleUserCreate = (user) => ({
const handleUserCreate = (user) => ({
type: ActionTypes.USER_CREATE_HANDLE,
payload: {
user,
},
});
export const clearUserCreateError = () => ({
const clearUserCreateError = () => ({
type: ActionTypes.USER_CREATE_ERROR_CLEAR,
payload: {},
});
export const updateUser = (id, data) => ({
const updateUser = (id, data) => ({
type: ActionTypes.USER_UPDATE,
payload: {
id,
@@ -56,7 +56,7 @@ updateUser.failure = (id, error) => ({
},
});
export const handleUserUpdate = (user, users, isCurrent) => ({
const handleUserUpdate = (user, users, isCurrent) => ({
type: ActionTypes.USER_UPDATE_HANDLE,
payload: {
user,
@@ -65,7 +65,7 @@ export const handleUserUpdate = (user, users, isCurrent) => ({
},
});
export const updateUserEmail = (id, data) => ({
const updateUserEmail = (id, data) => ({
type: ActionTypes.USER_EMAIL_UPDATE,
payload: {
id,
@@ -88,14 +88,14 @@ updateUserEmail.failure = (id, error) => ({
},
});
export const clearUserEmailUpdateError = (id) => ({
const clearUserEmailUpdateError = (id) => ({
type: ActionTypes.USER_EMAIL_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
export const updateUserPassword = (id, data) => ({
const updateUserPassword = (id, data) => ({
type: ActionTypes.USER_PASSWORD_UPDATE,
payload: {
id,
@@ -103,10 +103,11 @@ export const updateUserPassword = (id, data) => ({
},
});
updateUserPassword.success = (user) => ({
updateUserPassword.success = (user, accessToken) => ({
type: ActionTypes.USER_PASSWORD_UPDATE__SUCCESS,
payload: {
user,
accessToken,
},
});
@@ -118,14 +119,14 @@ updateUserPassword.failure = (id, error) => ({
},
});
export const clearUserPasswordUpdateError = (id) => ({
const clearUserPasswordUpdateError = (id) => ({
type: ActionTypes.USER_PASSWORD_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
export const updateUserUsername = (id, data) => ({
const updateUserUsername = (id, data) => ({
type: ActionTypes.USER_USERNAME_UPDATE,
payload: {
id,
@@ -148,14 +149,14 @@ updateUserUsername.failure = (id, error) => ({
},
});
export const clearUserUsernameUpdateError = (id) => ({
const clearUserUsernameUpdateError = (id) => ({
type: ActionTypes.USER_USERNAME_UPDATE_ERROR_CLEAR,
payload: {
id,
},
});
export const updateUserAvatar = (id) => ({
const updateUserAvatar = (id) => ({
type: ActionTypes.USER_AVATAR_UPDATE,
payload: {
id,
@@ -177,7 +178,7 @@ updateUserAvatar.failure = (id, error) => ({
},
});
export const deleteUser = (id) => ({
const deleteUser = (id) => ({
type: ActionTypes.USER_DELETE,
payload: {
id,
@@ -199,14 +200,14 @@ deleteUser.failure = (id, error) => ({
},
});
export const handleUserDelete = (user) => ({
const handleUserDelete = (user) => ({
type: ActionTypes.USER_DELETE_HANDLE,
payload: {
user,
},
});
export const addUserToCard = (id, cardId, isCurrent) => ({
const addUserToCard = (id, cardId, isCurrent) => ({
type: ActionTypes.USER_TO_CARD_ADD,
payload: {
id,
@@ -231,14 +232,14 @@ addUserToCard.failure = (id, cardId, error) => ({
},
});
export const handleUserToCardAdd = (cardMembership) => ({
const handleUserToCardAdd = (cardMembership) => ({
type: ActionTypes.USER_TO_CARD_ADD_HANDLE,
payload: {
cardMembership,
},
});
export const removeUserFromCard = (id, cardId) => ({
const removeUserFromCard = (id, cardId) => ({
type: ActionTypes.USER_FROM_CARD_REMOVE,
payload: {
id,
@@ -262,14 +263,14 @@ removeUserFromCard.failure = (id, cardId, error) => ({
},
});
export const handleUserFromCardRemove = (cardMembership) => ({
const handleUserFromCardRemove = (cardMembership) => ({
type: ActionTypes.USER_FROM_CARD_REMOVE_HANDLE,
payload: {
cardMembership,
},
});
export const addUserToBoardFilter = (id, boardId) => ({
const addUserToBoardFilter = (id, boardId) => ({
type: ActionTypes.USER_TO_BOARD_FILTER_ADD,
payload: {
id,
@@ -277,10 +278,33 @@ export const addUserToBoardFilter = (id, boardId) => ({
},
});
export const removeUserFromBoardFilter = (id, boardId) => ({
const removeUserFromBoardFilter = (id, boardId) => ({
type: ActionTypes.USER_FROM_BOARD_FILTER_REMOVE,
payload: {
id,
boardId,
},
});
export default {
createUser,
handleUserCreate,
clearUserCreateError,
updateUser,
handleUserUpdate,
updateUserEmail,
clearUserEmailUpdateError,
updateUserPassword,
clearUserPasswordUpdateError,
updateUserUsername,
clearUserUsernameUpdateError,
updateUserAvatar,
deleteUser,
handleUserDelete,
addUserToCard,
handleUserToCardAdd,
removeUserFromCard,
handleUserFromCardRemove,
addUserToBoardFilter,
removeUserFromBoardFilter,
};
+6 -1
View File
@@ -1,9 +1,14 @@
import http from './http';
import socket from './socket';
/* Actions */
const createAccessToken = (data) => http.post('/access-tokens', data);
const createAccessToken = (data, headers) => http.post('/access-tokens', data, headers);
const deleteCurrentAccessToken = (headers) =>
socket.delete('/access-tokens/me', undefined, headers);
export default {
createAccessToken,
deleteCurrentAccessToken,
};
-36
View File
@@ -1,36 +0,0 @@
import socket from './socket';
/* Transformers */
export const transformAction = (action) => ({
...action,
createdAt: new Date(action.createdAt),
});
/* Actions */
const getActions = (cardId, data) =>
socket.get(`/cards/${cardId}/actions`, data).then((body) => ({
...body,
items: body.items.map(transformAction),
}));
/* Event handlers */
const makeHandleActionCreate = (next) => (body) => {
next({
...body,
item: transformAction(body.item),
});
};
const makeHandleActionUpdate = makeHandleActionCreate;
const makeHandleActionDelete = makeHandleActionCreate;
export default {
getActions,
makeHandleActionCreate,
makeHandleActionUpdate,
makeHandleActionDelete,
};
+36
View File
@@ -0,0 +1,36 @@
import socket from './socket';
/* Transformers */
export const transformActivity = (activity) => ({
...activity,
createdAt: new Date(activity.createdAt),
});
/* Actions */
const getActivities = (cardId, data, headers) =>
socket.get(`/cards/${cardId}/actions`, data, headers).then((body) => ({
...body,
items: body.items.map(transformActivity),
}));
/* Event handlers */
const makeHandleActivityCreate = (next) => (body) => {
next({
...body,
item: transformActivity(body.item),
});
};
const makeHandleActivityUpdate = makeHandleActivityCreate;
const makeHandleActivityDelete = makeHandleActivityCreate;
export default {
getActivities,
makeHandleActivityCreate,
makeHandleActivityUpdate,
makeHandleActivityDelete,
};
+6 -6
View File
@@ -10,20 +10,20 @@ export const transformAttachment = (attachment) => ({
/* Actions */
const createAttachment = (cardId, data, requestId) =>
http.post(`/cards/${cardId}/attachments?requestId=${requestId}`, data).then((body) => ({
const createAttachment = (cardId, data, requestId, headers) =>
http.post(`/cards/${cardId}/attachments?requestId=${requestId}`, data, headers).then((body) => ({
...body,
item: transformAttachment(body.item),
}));
const updateAttachment = (id, data) =>
socket.patch(`/attachments/${id}`, data).then((body) => ({
const updateAttachment = (id, data, headers) =>
socket.patch(`/attachments/${id}`, data, headers).then((body) => ({
...body,
item: transformAttachment(body.item),
}));
const deleteAttachment = (id) =>
socket.delete(`/attachments/${id}`).then((body) => ({
const deleteAttachment = (id, headers) =>
socket.delete(`/attachments/${id}`, undefined, headers).then((body) => ({
...body,
item: transformAttachment(body.item),
}));
+8 -3
View File
@@ -2,12 +2,17 @@ import socket from './socket';
/* Actions */
const createBoardMembership = (boardId, data) =>
socket.post(`/boards/${boardId}/memberships`, data);
const createBoardMembership = (boardId, data, headers) =>
socket.post(`/boards/${boardId}/memberships`, data, headers);
const deleteBoardMembership = (id) => socket.delete(`/board-memberships/${id}`);
const updateBoardMembership = (id, data, headers) =>
socket.patch(`/board-memberships/${id}`, data, headers);
const deleteBoardMembership = (id, headers) =>
socket.delete(`/board-memberships/${id}`, undefined, headers);
export default {
createBoardMembership,
updateBoardMembership,
deleteBoardMembership,
};
+11 -5
View File
@@ -1,13 +1,18 @@
import socket from './socket';
import http from './http';
import { transformCard } from './cards';
import { transformAttachment } from './attachments';
/* Actions */
const createBoard = (projectId, data) => socket.post(`/projects/${projectId}/boards`, data);
const createBoard = (projectId, data, headers) =>
socket.post(`/projects/${projectId}/boards`, data, headers);
const getBoard = (id) =>
socket.get(`/boards/${id}`).then((body) => ({
const createBoardWithImport = (projectId, data, requestId, headers) =>
http.post(`/projects/${projectId}/boards?requestId=${requestId}`, data, headers);
const getBoard = (id, headers) =>
socket.get(`/boards/${id}`, undefined, headers).then((body) => ({
...body,
included: {
...body.included,
@@ -16,12 +21,13 @@ const getBoard = (id) =>
},
}));
const updateBoard = (id, data) => socket.patch(`/boards/${id}`, data);
const updateBoard = (id, data, headers) => socket.patch(`/boards/${id}`, data, headers);
const deleteBoard = (id) => socket.delete(`/boards/${id}`);
const deleteBoard = (id, headers) => socket.delete(`/boards/${id}`, undefined, headers);
export default {
createBoard,
createBoardWithImport,
getBoard,
updateBoard,
deleteBoard,
+4 -2
View File
@@ -2,9 +2,11 @@ import socket from './socket';
/* Actions */
const createCardLabel = (cardId, data) => socket.post(`/cards/${cardId}/labels`, data);
const createCardLabel = (cardId, data, headers) =>
socket.post(`/cards/${cardId}/labels`, data, headers);
const deleteCardLabel = (cardId, labelId) => socket.delete(`/cards/${cardId}/labels/${labelId}`);
const deleteCardLabel = (cardId, labelId, headers) =>
socket.delete(`/cards/${cardId}/labels/${labelId}`, undefined, headers);
export default {
createCardLabel,
+4 -3
View File
@@ -2,10 +2,11 @@ import socket from './socket';
/* Actions */
const createCardMembership = (cardId, data) => socket.post(`/cards/${cardId}/memberships`, data);
const createCardMembership = (cardId, data, headers) =>
socket.post(`/cards/${cardId}/memberships`, data, headers);
const deleteCardMembership = (cardId, userId) =>
socket.delete(`/cards/${cardId}/memberships?userId=${userId}`);
const deleteCardMembership = (cardId, userId, headers) =>
socket.delete(`/cards/${cardId}/memberships?userId=${userId}`, undefined, headers);
export default {
createCardMembership,
+15 -27
View File
@@ -35,36 +35,30 @@ export const transformCardData = (data) => ({
/* Actions */
const getCards = (boardId, data) =>
socket.get(`/board/${boardId}/cards`, data).then((body) => ({
const createCard = (listId, data, headers) =>
socket.post(`/lists/${listId}/cards`, transformCardData(data), headers).then((body) => ({
...body,
items: body.items.map(transformCard),
item: transformCard(body.item),
}));
const getCard = (id, headers) =>
socket.get(`/cards/${id}`, undefined, headers).then((body) => ({
...body,
item: transformCard(body.item),
included: {
...body.included,
attachments: body.included.attachments.map(transformAttachment),
},
}));
const createCard = (boardId, data) =>
socket.post(`/boards/${boardId}/cards`, transformCardData(data)).then((body) => ({
const updateCard = (id, data, headers) =>
socket.patch(`/cards/${id}`, transformCardData(data), headers).then((body) => ({
...body,
item: transformCard(body.item),
}));
const getCard = (id) =>
socket.get(`/cards/${id}`).then((body) => ({
...body,
item: transformCard(body.item),
}));
const updateCard = (id, data) =>
socket.patch(`/cards/${id}`, transformCardData(data)).then((body) => ({
...body,
item: transformCard(body.item),
}));
const deleteCard = (id) =>
socket.delete(`/cards/${id}`).then((body) => ({
const deleteCard = (id, headers) =>
socket.delete(`/cards/${id}`, undefined, headers).then((body) => ({
...body,
item: transformCard(body.item),
}));
@@ -78,17 +72,11 @@ const makeHandleCardCreate = (next) => (body) => {
});
};
const makeHandleCardUpdate = (next) => (body) => {
next({
...body,
item: transformCard(body.item),
});
};
const makeHandleCardUpdate = makeHandleCardCreate;
const makeHandleCardDelete = makeHandleCardUpdate;
const makeHandleCardDelete = makeHandleCardCreate;
export default {
getCards,
createCard,
getCard,
updateCard,
-28
View File
@@ -1,28 +0,0 @@
import socket from './socket';
import { transformAction } from './actions';
/* Actions */
const createCommentAction = (cardId, data) =>
socket.post(`/cards/${cardId}/comment-actions`, data).then((body) => ({
...body,
item: transformAction(body.item),
}));
const updateCommentAction = (id, data) =>
socket.patch(`/comment-actions/${id}`, data).then((body) => ({
...body,
item: transformAction(body.item),
}));
const deleteCommentAction = (id) =>
socket.delete(`/comment-actions/${id}`).then((body) => ({
...body,
item: transformAction(body.item),
}));
export default {
createCommentAction,
updateCommentAction,
deleteCommentAction,
};
+28
View File
@@ -0,0 +1,28 @@
import socket from './socket';
import { transformActivity } from './activities';
/* Actions */
const createCommentActivity = (cardId, data, headers) =>
socket.post(`/cards/${cardId}/comment-actions`, data, headers).then((body) => ({
...body,
item: transformActivity(body.item),
}));
const updateCommentActivity = (id, data, headers) =>
socket.patch(`/comment-actions/${id}`, data, headers).then((body) => ({
...body,
item: transformActivity(body.item),
}));
const deleteCommentActivity = (id, headers) =>
socket.delete(`/comment-actions/${id}`, undefined, headers).then((body) => ({
...body,
item: transformActivity(body.item),
}));
export default {
createCommentActivity,
updateCommentActivity,
deleteCommentActivity,
};
+2 -2
View File
@@ -6,7 +6,7 @@ const http = {};
// TODO: add all methods
['POST'].forEach((method) => {
http[method.toLowerCase()] = (url, data) => {
http[method.toLowerCase()] = (url, data, headers) => {
const formData = Object.keys(data).reduce((result, key) => {
result.append(key, data[key]);
@@ -15,8 +15,8 @@ const http = {};
return fetch(`${Config.SERVER_BASE_URL}/api${url}`, {
method,
headers,
body: formData,
...Config.FETCH_OPTIONS,
})
.then((response) =>
response.json().then((body) => ({
+4 -4
View File
@@ -13,8 +13,8 @@ import cardMemberships from './card-memberships';
import cardLabels from './card-labels';
import tasks from './tasks';
import attachments from './attachments';
import actions from './actions';
import commentActions from './comment-actions';
import activities from './activities';
import commentActivities from './comment-activities';
import notifications from './notifications';
export { http, socket };
@@ -33,7 +33,7 @@ export default {
...cardLabels,
...tasks,
...attachments,
...actions,
...commentActions,
...activities,
...commentActivities,
...notifications,
};
+4 -3
View File
@@ -2,11 +2,12 @@ import socket from './socket';
/* Actions */
const createLabel = (boardId, data) => socket.post(`/boards/${boardId}/labels`, data);
const createLabel = (boardId, data, headers) =>
socket.post(`/boards/${boardId}/labels`, data, headers);
const updateLabel = (id, data) => socket.patch(`/labels/${id}`, data);
const updateLabel = (id, data, headers) => socket.patch(`/labels/${id}`, data, headers);
const deleteLabel = (id) => socket.delete(`/labels/${id}`);
const deleteLabel = (id, headers) => socket.delete(`/labels/${id}`, undefined, headers);
export default {
createLabel,
+4 -3
View File
@@ -2,11 +2,12 @@ import socket from './socket';
/* Actions */
const createList = (boardId, data) => socket.post(`/boards/${boardId}/lists`, data);
const createList = (boardId, data, headers) =>
socket.post(`/boards/${boardId}/lists`, data, headers);
const updateList = (id, data) => socket.patch(`/lists/${id}`, data);
const updateList = (id, data, headers) => socket.patch(`/lists/${id}`, data, headers);
const deleteList = (id) => socket.delete(`/lists/${id}`);
const deleteList = (id, headers) => socket.delete(`/lists/${id}`, undefined, headers);
export default {
createList,
+38 -10
View File
@@ -1,33 +1,61 @@
import omit from 'lodash/omit';
import socket from './socket';
import { transformCard } from './cards';
import { transformAction } from './actions';
import { transformActivity } from './activities';
/* Transformers */
export const transformNotification = (notification) => ({
...omit(notification, 'actionId'),
activityId: notification.actionId,
});
/* Actions */
const getNotifications = () =>
socket.get('/notifications').then((body) => ({
const getNotifications = (headers) =>
socket.get('/notifications', undefined, headers).then((body) => ({
...body,
items: body.items.map(transformNotification),
included: {
...body.included,
...omit(body.included, 'actions'),
cards: body.included.cards.map(transformCard),
actions: body.included.actions.map(transformAction),
activities: body.included.actions.map(transformActivity),
},
}));
const getNotification = (id) =>
socket.get(`/notifications/${id}`).then((body) => ({
const getNotification = (id, headers) =>
socket.get(`/notifications/${id}`, undefined, headers).then((body) => ({
...body,
item: transformNotification(body.item),
included: {
...body.included,
...omit(body.included, 'actions'),
cards: body.included.cards.map(transformCard),
actions: body.included.actions.map(transformAction),
activities: body.included.actions.map(transformActivity),
},
}));
const updateNotifications = (ids, data) => socket.patch(`/notifications/${ids.join(',')}`, data);
const updateNotifications = (ids, data, headers) =>
socket.patch(`/notifications/${ids.join(',')}`, data, headers).then((body) => ({
...body,
items: body.items.map(transformNotification),
}));
/* Event handlers */
const makeHandleNotificationCreate = (next) => (body) => {
next({
...body,
item: transformNotification(body.item),
});
};
const makeHandleNotificationUpdate = makeHandleNotificationCreate;
export default {
getNotifications,
getNotification,
updateNotifications,
makeHandleNotificationCreate,
makeHandleNotificationUpdate,
};
+4 -3
View File
@@ -2,10 +2,11 @@ import socket from './socket';
/* Actions */
const createProjectManager = (projectId, data) =>
socket.post(`/projects/${projectId}/managers`, data);
const createProjectManager = (projectId, data, headers) =>
socket.post(`/projects/${projectId}/managers`, data, headers);
const deleteProjectManager = (id) => socket.delete(`/project-managers/${id}`);
const deleteProjectManager = (id, headers) =>
socket.delete(`/project-managers/${id}`, undefined, headers);
export default {
createProjectManager,
+7 -7
View File
@@ -3,18 +3,18 @@ import socket from './socket';
/* Actions */
const getProjects = () => socket.get('/projects');
const getProjects = (headers) => socket.get('/projects', undefined, headers);
const createProject = (data) => socket.post('/projects', data);
const createProject = (data, headers) => socket.post('/projects', data, headers);
const getProject = (id) => socket.get(`/projects/${id}`);
const getProject = (id, headers) => socket.get(`/projects/${id}`, undefined, headers);
const updateProject = (id, data) => socket.patch(`/projects/${id}`, data);
const updateProject = (id, data, headers) => socket.patch(`/projects/${id}`, data, headers);
const updateProjectBackgroundImage = (id, data) =>
http.post(`/projects/${id}/background-image`, data);
const updateProjectBackgroundImage = (id, data, headers) =>
http.post(`/projects/${id}/background-image`, data, headers);
const deleteProject = (id) => socket.delete(`/projects/${id}`);
const deleteProject = (id, headers) => socket.delete(`/projects/${id}`, undefined, headers);
export default {
getProjects,
+4 -2
View File
@@ -5,7 +5,7 @@ import Config from '../constants/Config';
const io = sailsIOClient(socketIOClient);
io.sails.url = Config.SERVER_BASE_URL;
io.sails.url = Config.SERVER_HOST_NAME;
io.sails.autoConnect = false;
io.sails.reconnection = true;
io.sails.useCORSRouteToGetCookie = false;
@@ -13,15 +13,17 @@ io.sails.environment = process.env.NODE_ENV;
const { socket } = io;
socket.path = `${Config.BASE_PATH}/socket.io`;
socket.connect = socket._connect; // eslint-disable-line no-underscore-dangle
['GET', 'POST', 'PUT', 'PATCH', 'DELETE'].forEach((method) => {
socket[method.toLowerCase()] = (url, data) =>
socket[method.toLowerCase()] = (url, data, headers) =>
new Promise((resolve, reject) => {
socket.request(
{
method,
data,
headers,
url: `/api${url}`,
},
(_, { body, error }) => {
+3 -3
View File
@@ -2,11 +2,11 @@ import socket from './socket';
/* Actions */
const createTask = (cardId, data) => socket.post(`/cards/${cardId}/tasks`, data);
const createTask = (cardId, data, headers) => socket.post(`/cards/${cardId}/tasks`, data, headers);
const updateTask = (id, data) => socket.patch(`/tasks/${id}`, data);
const updateTask = (id, data, headers) => socket.patch(`/tasks/${id}`, data, headers);
const deleteTask = (id) => socket.delete(`/tasks/${id}`);
const deleteTask = (id, headers) => socket.delete(`/tasks/${id}`, undefined, headers);
export default {
createTask,
+12 -10
View File
@@ -3,25 +3,27 @@ import socket from './socket';
/* Actions */
const getUsers = () => socket.get('/users');
const getUsers = (headers) => socket.get('/users', undefined, headers);
const createUser = (data) => socket.post('/users', data);
const createUser = (data, headers) => socket.post('/users', data, headers);
const getUser = (id) => socket.get(`/users/${id}`);
const getUser = (id, headers) => socket.get(`/users/${id}`, undefined, headers);
const getCurrentUser = () => socket.get('/users/me');
const getCurrentUser = (headers) => socket.get('/users/me', undefined, headers);
const updateUser = (id, data) => socket.patch(`/users/${id}`, data);
const updateUser = (id, data, headers) => socket.patch(`/users/${id}`, data, headers);
const updateUserEmail = (id, data) => socket.patch(`/users/${id}/email`, data);
const updateUserEmail = (id, data, headers) => socket.patch(`/users/${id}/email`, data, headers);
const updateUserPassword = (id, data) => socket.patch(`/users/${id}/password`, data);
const updateUserPassword = (id, data, headers) =>
socket.patch(`/users/${id}/password`, data, headers);
const updateUserUsername = (id, data) => socket.patch(`/users/${id}/username`, data);
const updateUserUsername = (id, data, headers) =>
socket.patch(`/users/${id}/username`, data, headers);
const updateUserAvatar = (id, data) => http.post(`/users/${id}/avatar`, data);
const updateUserAvatar = (id, data, headers) => http.post(`/users/${id}/avatar`, data, headers);
const deleteUser = (id) => socket.delete(`/users/${id}`);
const deleteUser = (id, headers) => socket.delete(`/users/${id}`, undefined, headers);
export default {
getUsers,
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

@@ -10,11 +10,11 @@ import CardModalContainer from '../../containers/CardModalContainer';
import ListAdd from './ListAdd';
import { ReactComponent as PlusMathIcon } from '../../assets/images/plus-math-icon.svg';
import styles from './BoardKanban.module.scss';
import styles from './Board.module.scss';
const parseDndId = (dndId) => dndId.split(':')[1];
const BoardKanban = React.memo(
const Board = React.memo(
({ listIds, isCardModalOpened, canEdit, onListCreate, onListMove, onCardMove }) => {
const [t] = useTranslation();
const [isListAddOpened, setIsListAddOpened] = useState(false);
@@ -166,7 +166,7 @@ const BoardKanban = React.memo(
},
);
BoardKanban.propTypes = {
Board.propTypes = {
listIds: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
isCardModalOpened: PropTypes.bool.isRequired,
canEdit: PropTypes.bool.isRequired,
@@ -175,4 +175,4 @@ BoardKanban.propTypes = {
onCardMove: PropTypes.func.isRequired,
};
export default BoardKanban;
export default Board;
@@ -15,7 +15,7 @@ const DEFAULT_DATA = {
const ListAdd = React.memo(({ onCreate, onClose }) => {
const [t] = useTranslation();
const [data, handleFieldChange, setData] = useForm(DEFAULT_DATA);
const [selectNameFieldState, selectNameField] = useToggle();
const [focusNameFieldState, focusNameField] = useToggle();
const nameField = useRef(null);
@@ -44,16 +44,16 @@ const ListAdd = React.memo(({ onCreate, onClose }) => {
onCreate(cleanData);
setData(DEFAULT_DATA);
selectNameField();
}, [onCreate, data, setData, selectNameField]);
focusNameField();
}, [onCreate, data, setData, focusNameField]);
useEffect(() => {
nameField.current.select();
nameField.current.focus();
}, []);
useDidUpdate(() => {
nameField.current.select();
}, [selectNameFieldState]);
nameField.current.focus();
}, [focusNameFieldState]);
return (
<Form className={styles.wrapper} onSubmit={handleSubmit}>
@@ -72,7 +72,7 @@ const ListAdd = React.memo(({ onCreate, onClose }) => {
<Button
positive
content={t('action.addList')}
className={styles.submitButton}
className={styles.button}
onMouseOver={handleControlMouseOver}
onMouseOut={handleControlMouseOut}
/>
@@ -1,4 +1,9 @@
:global(#app) {
.button {
min-height: 30px;
vertical-align: top;
}
.controls {
margin-top: 4px;
}
@@ -18,11 +23,6 @@
}
}
.submitButton {
min-height: 30px;
vertical-align: top;
}
.wrapper {
background: #e2e4e6;
border-radius: 3px;
+3
View File
@@ -0,0 +1,3 @@
import Board from './Board';
export default Board;
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import Filters from './Filters';
import Memberships from '../Memberships';
import BoardMembershipPermissionsSelectStep from '../BoardMembershipPermissionsSelectStep';
import styles from './BoardActions.module.scss';
@@ -13,8 +14,10 @@ const BoardActions = React.memo(
filterUsers,
filterLabels,
allUsers,
canEdit,
canEditMemberships,
onMembershipCreate,
onMembershipUpdate,
onMembershipDelete,
onUserToFilterAdd,
onUserFromFilterRemove,
@@ -25,30 +28,35 @@ const BoardActions = React.memo(
onLabelDelete,
}) => {
return (
<div className={styles.actions}>
<div className={styles.action}>
<Memberships
items={memberships}
allUsers={allUsers}
canEdit={canEditMemberships}
onCreate={onMembershipCreate}
onDelete={onMembershipDelete}
/>
</div>
<div className={styles.action}>
<Filters
users={filterUsers}
labels={filterLabels}
allBoardMemberships={memberships}
allLabels={labels}
onUserAdd={onUserToFilterAdd}
onUserRemove={onUserFromFilterRemove}
onLabelAdd={onLabelToFilterAdd}
onLabelRemove={onLabelFromFilterRemove}
onLabelCreate={onLabelCreate}
onLabelUpdate={onLabelUpdate}
onLabelDelete={onLabelDelete}
/>
<div className={styles.wrapper}>
<div className={styles.actions}>
<div className={styles.action}>
<Memberships
items={memberships}
allUsers={allUsers}
permissionsSelectStep={BoardMembershipPermissionsSelectStep}
canEdit={canEditMemberships}
onCreate={onMembershipCreate}
onUpdate={onMembershipUpdate}
onDelete={onMembershipDelete}
/>
</div>
<div className={styles.action}>
<Filters
users={filterUsers}
labels={filterLabels}
allBoardMemberships={memberships}
allLabels={labels}
canEdit={canEdit}
onUserAdd={onUserToFilterAdd}
onUserRemove={onUserFromFilterRemove}
onLabelAdd={onLabelToFilterAdd}
onLabelRemove={onLabelFromFilterRemove}
onLabelCreate={onLabelCreate}
onLabelUpdate={onLabelUpdate}
onLabelDelete={onLabelDelete}
/>
</div>
</div>
</div>
);
@@ -63,8 +71,10 @@ BoardActions.propTypes = {
filterLabels: PropTypes.array.isRequired,
allUsers: PropTypes.array.isRequired,
/* eslint-enable react/forbid-prop-types */
canEdit: PropTypes.bool.isRequired,
canEditMemberships: PropTypes.bool.isRequired,
onMembershipCreate: PropTypes.func.isRequired,
onMembershipUpdate: PropTypes.func.isRequired,
onMembershipDelete: PropTypes.func.isRequired,
onUserToFilterAdd: PropTypes.func.isRequired,
onUserFromFilterRemove: PropTypes.func.isRequired,
@@ -1,5 +1,6 @@
:global(#app) {
.action {
flex: 0 0 auto;
margin-right: 20px;
}
@@ -8,4 +9,15 @@
display: flex;
margin: 20px 20px;
}
.wrapper {
overflow-x: auto;
overflow-y: hidden;
-ms-overflow-style: none;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
}
@@ -15,6 +15,7 @@ const Filters = React.memo(
labels,
allBoardMemberships,
allLabels,
canEdit,
onUserAdd,
onUserRemove,
onLabelAdd,
@@ -74,6 +75,7 @@ const Filters = React.memo(
title={t('common.filterByLabels', {
context: 'title',
})}
canEdit={canEdit}
onSelect={onLabelAdd}
onDeselect={onLabelRemove}
onCreate={onLabelCreate}
@@ -108,6 +110,7 @@ Filters.propTypes = {
allBoardMemberships: PropTypes.array.isRequired,
allLabels: PropTypes.array.isRequired,
/* eslint-enable react/forbid-prop-types */
canEdit: PropTypes.bool.isRequired,
onUserAdd: PropTypes.func.isRequired,
onUserRemove: PropTypes.func.isRequired,
onLabelAdd: PropTypes.func.isRequired,
@@ -1,3 +0,0 @@
import BoardKanban from './BoardKanban';
export default BoardKanban;
@@ -0,0 +1,107 @@
import { dequal } from 'dequal';
import omit from 'lodash/omit';
import React, { useCallback, useState } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Button, Form, Menu, Radio, Segment } from 'semantic-ui-react';
import { Popup } from '../../lib/custom-ui';
import { BoardMembershipRoles } from '../../constants/Enums';
import styles from './BoardMembershipPermissionsSelectStep.module.scss';
const BoardMembershipPermissionsSelectStep = React.memo(
({ defaultData, title, buttonContent, onSelect, onBack, onClose }) => {
const [t] = useTranslation();
const [data, setData] = useState(() => ({
role: BoardMembershipRoles.EDITOR,
canComment: null,
...defaultData,
}));
const handleSelectRoleClick = useCallback((role) => {
setData((prevData) => ({
...prevData,
role,
canComment: role === BoardMembershipRoles.VIEWER ? !!prevData.canComment : null,
}));
}, []);
const handleSettingChange = useCallback((_, { name: fieldName, checked: value }) => {
setData((prevData) => ({
...prevData,
[fieldName]: value,
}));
}, []);
const handleSubmit = useCallback(() => {
if (!dequal(data, defaultData)) {
onSelect(data.role === BoardMembershipRoles.VIEWER ? data : omit(data, 'canComment'));
}
onClose();
}, [defaultData, onSelect, onClose, data]);
return (
<>
<Popup.Header onBack={onBack}>
{t(title, {
context: 'title',
})}
</Popup.Header>
<Popup.Content>
<Form onSubmit={handleSubmit}>
<Menu secondary vertical className={styles.menu}>
<Menu.Item
active={data.role === BoardMembershipRoles.EDITOR}
onClick={() => handleSelectRoleClick(BoardMembershipRoles.EDITOR)}
>
<div className={styles.menuItemTitle}>{t('common.editor')}</div>
<div className={styles.menuItemDescription}>
{t('common.canEditContentOfBoard')}
</div>
</Menu.Item>
<Menu.Item
active={data.role === BoardMembershipRoles.VIEWER}
onClick={() => handleSelectRoleClick(BoardMembershipRoles.VIEWER)}
>
<div className={styles.menuItemTitle}>{t('common.viewer')}</div>
<div className={styles.menuItemDescription}>{t('common.canOnlyViewBoard')}</div>
</Menu.Item>
</Menu>
{data.role === BoardMembershipRoles.VIEWER && (
<Segment basic className={styles.settings}>
<Radio
toggle
name="canComment"
checked={data.canComment}
label={t('common.canComment')}
onChange={handleSettingChange}
/>
</Segment>
)}
<Button positive content={t(buttonContent)} />
</Form>
</Popup.Content>
</>
);
},
);
BoardMembershipPermissionsSelectStep.propTypes = {
defaultData: PropTypes.object, // eslint-disable-line react/forbid-prop-types
title: PropTypes.string,
buttonContent: PropTypes.string,
onSelect: PropTypes.func.isRequired,
onBack: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
};
BoardMembershipPermissionsSelectStep.defaultProps = {
defaultData: undefined,
title: 'common.selectPermissions',
buttonContent: 'action.selectPermissions',
};
export default BoardMembershipPermissionsSelectStep;
@@ -0,0 +1,18 @@
:global(#app) {
.menu {
margin: 0 auto 8px;
width: 100%;
}
.menuItemDescription {
opacity: 0.5;
}
.menuItemTitle {
margin-bottom: 8px;
}
.settings {
margin: 0 0 8px;
}
}
@@ -0,0 +1,3 @@
import BoardMembershipPermissionsSelectStep from './BoardMembershipPermissionsSelectStep';
export default BoardMembershipPermissionsSelectStep;
@@ -1,9 +1,10 @@
import React, { useCallback } from 'react';
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Menu } from 'semantic-ui-react';
import { Popup } from '../../lib/custom-ui';
import { Input, Popup } from '../../lib/custom-ui';
import { useField } from '../../hooks';
import Item from './Item';
import styles from './BoardMembershipsStep.module.scss';
@@ -11,6 +12,21 @@ import styles from './BoardMembershipsStep.module.scss';
const BoardMembershipsStep = React.memo(
({ items, currentUserIds, title, onUserSelect, onUserDeselect, onBack }) => {
const [t] = useTranslation();
const [search, handleSearchChange] = useField('');
const cleanSearch = useMemo(() => search.trim().toLowerCase(), [search]);
const filteredItems = useMemo(
() =>
items.filter(
({ user }) =>
user.email.includes(cleanSearch) ||
user.name.toLowerCase().includes(cleanSearch) ||
(user.username && user.username.includes(cleanSearch)),
),
[items, cleanSearch],
);
const searchField = useRef(null);
const handleUserSelect = useCallback(
(id) => {
@@ -26,22 +42,42 @@ const BoardMembershipsStep = React.memo(
[onUserDeselect],
);
useEffect(() => {
searchField.current.focus({
preventScroll: true,
});
}, []);
return (
<>
<Popup.Header onBack={onBack}>{t(title)}</Popup.Header>
<Popup.Header onBack={onBack}>
{t(title, {
context: 'title',
})}
</Popup.Header>
<Popup.Content>
<Menu secondary vertical className={styles.menu}>
{items.map((item) => (
<Item
key={item.id}
isPersisted={item.isPersisted}
isActive={currentUserIds.includes(item.user.id)}
user={item.user}
onUserSelect={() => handleUserSelect(item.user.id)}
onUserDeselect={() => handleUserDeselect(item.user.id)}
/>
))}
</Menu>
<Input
fluid
ref={searchField}
value={search}
placeholder={t('common.searchMembers')}
icon="search"
onChange={handleSearchChange}
/>
{filteredItems.length > 0 && (
<Menu secondary vertical className={styles.menu}>
{filteredItems.map((item) => (
<Item
key={item.id}
isPersisted={item.isPersisted}
isActive={currentUserIds.includes(item.user.id)}
user={item.user}
onUserSelect={() => handleUserSelect(item.user.id)}
onUserDeselect={() => handleUserDeselect(item.user.id)}
/>
))}
</Menu>
)}
</Popup.Content>
</>
);
@@ -1,6 +1,22 @@
:global(#app) {
.menu {
margin: -7px auto -5px;
margin: 8px auto 0;
max-height: 60vh;
overflow-x: hidden;
overflow-y: auto;
scrollbar-width: thin;
width: 100%;
&::-webkit-scrollbar {
width: 5px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
border-radius: 3px;
}
}
}
@@ -2,6 +2,7 @@
.menuItem {
display: block;
margin: 0;
overflow: hidden;
padding: 4px;
}
-25
View File
@@ -1,25 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Loader } from 'semantic-ui-react';
import { BoardTypes } from '../constants/Enums';
import BoardKanbanContainer from '../containers/BoardKanbanContainer';
const BoardWrapper = React.memo(({ type, isFetching }) => {
if (isFetching) {
return <Loader active />;
}
if (type === BoardTypes.KANBAN) {
return <BoardKanbanContainer />;
}
return null;
});
BoardWrapper.propTypes = {
type: PropTypes.string.isRequired,
isFetching: PropTypes.bool.isRequired,
};
export default BoardWrapper;
-70
View File
@@ -1,70 +0,0 @@
import React, { useCallback, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Button, Form } from 'semantic-ui-react';
import { withPopup } from '../../lib/popup';
import { Input, Popup } from '../../lib/custom-ui';
import { useForm } from '../../hooks';
import styles from './AddPopup.module.scss';
const AddStep = React.memo(({ onCreate, onClose }) => {
const [t] = useTranslation();
const [data, handleFieldChange] = useForm({
name: '',
});
const nameField = useRef(null);
const handleSubmit = useCallback(() => {
const cleanData = {
...data,
type: 'kanban',
name: data.name.trim(),
};
if (!cleanData.name) {
nameField.current.select();
return;
}
onCreate(cleanData);
onClose();
}, [onCreate, onClose, data]);
useEffect(() => {
nameField.current.select();
}, []);
return (
<>
<Popup.Header>
{t('common.createBoard', {
context: 'title',
})}
</Popup.Header>
<Popup.Content>
<Form onSubmit={handleSubmit}>
<Input
fluid
ref={nameField}
name="name"
value={data.name}
className={styles.field}
onChange={handleFieldChange}
/>
<Button positive content={t('action.createBoard')} />
</Form>
</Popup.Content>
</>
);
});
AddStep.propTypes = {
onCreate: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
};
export default withPopup(AddStep);
@@ -1,5 +0,0 @@
:global(#app) {
.field {
margin-bottom: 8px;
}
}
+117
View File
@@ -0,0 +1,117 @@
import React, { useCallback, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Button, Form, Icon } from 'semantic-ui-react';
import { useDidUpdate, useToggle } from '../../../lib/hooks';
import { withPopup } from '../../../lib/popup';
import { Input, Popup } from '../../../lib/custom-ui';
import { useForm, useSteps } from '../../../hooks';
import ImportStep from './ImportStep';
import styles from './AddPopup.module.scss';
const StepTypes = {
IMPORT: 'IMPORT',
};
const AddStep = React.memo(({ onCreate, onClose }) => {
const [t] = useTranslation();
const [data, handleFieldChange, setData] = useForm({
name: '',
import: null,
});
const [step, openStep, handleBack] = useSteps();
const [focusNameFieldState, focusNameField] = useToggle();
const nameField = useRef(null);
const handleImportSelect = useCallback(
(nextImport) => {
setData((prevData) => ({
...prevData,
import: nextImport,
}));
},
[setData],
);
const handleImportBack = useCallback(() => {
handleBack();
focusNameField();
}, [handleBack, focusNameField]);
const handleSubmit = useCallback(() => {
const cleanData = {
...data,
name: data.name.trim(),
};
if (!cleanData.name) {
nameField.current.select();
return;
}
onCreate(cleanData);
onClose();
}, [onClose, data, onCreate]);
const handleImportClick = useCallback(() => {
openStep(StepTypes.IMPORT);
}, [openStep]);
useEffect(() => {
nameField.current.focus({
preventScroll: true,
});
}, []);
useDidUpdate(() => {
nameField.current.focus();
}, [focusNameFieldState]);
if (step && step.type === StepTypes.IMPORT) {
return <ImportStep onSelect={handleImportSelect} onBack={handleImportBack} />;
}
return (
<>
<Popup.Header>
{t('common.createBoard', {
context: 'title',
})}
</Popup.Header>
<Popup.Content>
<Form onSubmit={handleSubmit}>
<Input
fluid
ref={nameField}
name="name"
value={data.name}
className={styles.field}
onChange={handleFieldChange}
/>
<div className={styles.controls}>
<Button positive content={t('action.createBoard')} className={styles.createButton} />
<Button type="button" className={styles.importButton} onClick={handleImportClick}>
<Icon
name={data.import ? data.import.type : 'arrow down'}
className={styles.importButtonIcon}
/>
{data.import ? data.import.file.name : t('action.import')}
</Button>
</div>
</Form>
</Popup.Content>
</>
);
});
AddStep.propTypes = {
onCreate: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
};
export default withPopup(AddStep);
@@ -0,0 +1,42 @@
:global(#app) {
.controls {
display: flex;
max-width: 280px;
@media only screen and (max-width: 767px) {
max-width: 226px;
}
}
.createButton {
white-space: nowrap;
}
.field {
margin-bottom: 8px;
}
.importButton {
background: transparent;
box-shadow: none;
color: #6b808c;
font-weight: normal;
margin-left: auto;
margin-right: 0;
overflow: hidden;
text-align: left;
text-decoration: underline;
text-overflow: ellipsis;
transition: none;
white-space: nowrap;
&:hover {
background: rgba(9, 30, 66, 0.08);
color: #092d42;
}
}
.importButtonIcon {
text-decoration: none;
}
}
@@ -0,0 +1,51 @@
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Button } from 'semantic-ui-react';
import { FilePicker, Popup } from '../../../lib/custom-ui';
import styles from './ImportStep.module.scss';
const ImportStep = React.memo(({ onSelect, onBack }) => {
const [t] = useTranslation();
const handleFileSelect = useCallback(
(type, file) => {
onSelect({
type,
file,
});
onBack();
},
[onSelect, onBack],
);
return (
<>
<Popup.Header onBack={onBack}>
{t('common.importBoard', {
context: 'title',
})}
</Popup.Header>
<Popup.Content>
<FilePicker onSelect={(file) => handleFileSelect('trello', file)} accept=".json">
<Button
fluid
type="button"
icon="trello"
content={t('common.fromTrello')}
className={styles.button}
/>
</FilePicker>
</Popup.Content>
</>
);
});
ImportStep.propTypes = {
onSelect: PropTypes.func.isRequired,
onBack: PropTypes.func.isRequired,
};
export default ImportStep;
@@ -0,0 +1,17 @@
:global(#app) {
.button {
background: transparent;
box-shadow: none;
color: #6b808c;
font-weight: normal;
margin-top: 8px;
padding: 6px 11px;
text-align: left;
transition: none;
&:hover {
background: rgba(9, 30, 66, 0.08);
color: #092d42;
}
}
}
@@ -0,0 +1,3 @@
import AddPopup from './AddPopup';
export default AddPopup;
@@ -29,7 +29,7 @@
}
.link {
color: #fff;
color: rgba(255, 255, 255, 0.72);
cursor: pointer;
display: block;
line-height: 20px;
@@ -60,6 +60,11 @@
&:hover {
background: rgba(0, 0, 0, 0.32);
}
.link {
color: #fff;
font-weight: bold;
}
}
.tabWrapper {
+19 -4
View File
@@ -5,6 +5,7 @@ import { Button, Icon } from 'semantic-ui-react';
import { Link } from 'react-router-dom';
import { Draggable } from 'react-beautiful-dnd';
import { startTimer, stopTimer } from '../../utils/timer';
import Paths from '../../constants/Paths';
import Tasks from './Tasks';
import NameEdit from './NameEdit';
@@ -57,6 +58,17 @@ const Card = React.memo(
}
}, []);
const handleToggleTimerClick = useCallback(
(event) => {
event.preventDefault();
onUpdate({
timer: timer.startedAt ? stopTimer(timer) : startTimer(timer),
});
},
[timer, onUpdate],
);
const handleNameUpdate = useCallback(
(newName) => {
onUpdate({
@@ -108,7 +120,13 @@ const Card = React.memo(
)}
{timer && (
<span className={classNames(styles.attachment, styles.attachmentLeft)}>
<Timer startedAt={timer.startedAt} total={timer.total} size="tiny" />
<Timer
as="span"
startedAt={timer.startedAt}
total={timer.total}
size="tiny"
onClick={canEdit ? handleToggleTimerClick : undefined}
/>
</span>
)}
</span>
@@ -148,14 +166,11 @@ const Card = React.memo(
{canEdit && (
<ActionsPopup
card={{
id,
name,
dueDate,
timer,
boardId,
listId,
projectId,
isPersisted,
}}
projectsToLists={allProjectsToLists}
boardMemberships={allBoardMemberships}
@@ -77,7 +77,10 @@
.cover {
border-radius: 3px 3px 0 0;
margin-bottom: 2px;
padding: 2px 2px 0;
vertical-align: middle;
width: 100%;
}
.details {
@@ -114,6 +117,7 @@
}
.wrapper {
cursor: auto;
display: block;
margin-bottom: 8px;
}
+1 -1
View File
@@ -79,7 +79,7 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
useEffect(() => {
if (isOpened) {
field.current.ref.current.select();
field.current.ref.current.focus();
}
}, [isOpened]);
@@ -1,105 +0,0 @@
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Comment, Icon, Loader, Visibility } from 'semantic-ui-react';
import { ActionTypes } from '../../../constants/Enums';
import CommentAdd from './CommentAdd';
import Item from './Item';
import styles from './Actions.module.scss';
const Actions = React.memo(
({
items,
isFetching,
isAllFetched,
canEdit,
canEditAllComments,
onFetch,
onCommentCreate,
onCommentUpdate,
onCommentDelete,
}) => {
const [t] = useTranslation();
const handleCommentUpdate = useCallback(
(id, data) => {
onCommentUpdate(id, data);
},
[onCommentUpdate],
);
const handleCommentDelete = useCallback(
(id) => {
onCommentDelete(id);
},
[onCommentDelete],
);
return (
<>
{canEdit && (
<div className={styles.contentModule}>
<div className={styles.moduleWrapper}>
<Icon name="comment outline" className={styles.moduleIcon} />
<div className={styles.moduleHeader}>{t('common.addComment')}</div>
<CommentAdd onCreate={onCommentCreate} />
</div>
</div>
)}
<div className={styles.contentModule}>
<div className={styles.moduleWrapper}>
<Icon name="list ul" className={styles.moduleIcon} />
<div className={styles.moduleHeader}>{t('common.actions')}</div>
<div className={styles.wrapper}>
<Comment.Group>
{items.map((item) =>
item.type === ActionTypes.COMMENT_CARD ? (
<Item.Comment
key={item.id}
data={item.data}
createdAt={item.createdAt}
isPersisted={item.isPersisted}
user={item.user}
canEdit={(item.user.isCurrent && canEdit) || canEditAllComments}
onUpdate={(data) => handleCommentUpdate(item.id, data)}
onDelete={() => handleCommentDelete(item.id)}
/>
) : (
<Item
key={item.id}
type={item.type}
data={item.data}
createdAt={item.createdAt}
user={item.user}
/>
),
)}
</Comment.Group>
</div>
{isFetching ? (
<Loader active inverted inline="centered" size="small" className={styles.loader} />
) : (
!isAllFetched && <Visibility fireOnMount onOnScreen={onFetch} />
)}
</div>
</div>
</>
);
},
);
Actions.propTypes = {
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
isFetching: PropTypes.bool.isRequired,
isAllFetched: PropTypes.bool.isRequired,
canEdit: PropTypes.bool.isRequired,
canEditAllComments: PropTypes.bool.isRequired,
onFetch: PropTypes.func.isRequired,
onCommentCreate: PropTypes.func.isRequired,
onCommentUpdate: PropTypes.func.isRequired,
onCommentDelete: PropTypes.func.isRequired,
};
export default Actions;
@@ -1,3 +0,0 @@
import Actions from './Actions';
export default Actions;
+112
View File
@@ -0,0 +1,112 @@
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Button, Comment, Icon, Loader, Visibility } from 'semantic-ui-react';
import { ActivityTypes } from '../../../constants/Enums';
import CommentAdd from './CommentAdd';
import Item from './Item';
import styles from './Activities.module.scss';
const Activities = React.memo(
({
items,
isFetching,
isAllFetched,
isDetailsVisible,
isDetailsFetching,
canEdit,
canEditAllComments,
onFetch,
onDetailsToggle,
onCommentCreate,
onCommentUpdate,
onCommentDelete,
}) => {
const [t] = useTranslation();
const handleToggleDetailsClick = useCallback(() => {
onDetailsToggle(!isDetailsVisible);
}, [isDetailsVisible, onDetailsToggle]);
const handleCommentUpdate = useCallback(
(id, data) => {
onCommentUpdate(id, data);
},
[onCommentUpdate],
);
const handleCommentDelete = useCallback(
(id) => {
onCommentDelete(id);
},
[onCommentDelete],
);
return (
<div className={styles.contentModule}>
<div className={styles.moduleWrapper}>
<Icon name="list ul" className={styles.moduleIcon} />
<div className={styles.moduleHeader}>
{t('common.actions')}
<Button
content={isDetailsVisible ? t('action.hideDetails') : t('action.showDetails')}
className={styles.toggleButton}
onClick={handleToggleDetailsClick}
/>
</div>
{canEdit && <CommentAdd onCreate={onCommentCreate} />}
<div className={styles.wrapper}>
<Comment.Group>
{items.map((item) =>
item.type === ActivityTypes.COMMENT_CARD ? (
<Item.Comment
key={item.id}
data={item.data}
createdAt={item.createdAt}
isPersisted={item.isPersisted}
user={item.user}
canEdit={(item.user.isCurrent && canEdit) || canEditAllComments}
onUpdate={(data) => handleCommentUpdate(item.id, data)}
onDelete={() => handleCommentDelete(item.id)}
/>
) : (
<Item
key={item.id}
type={item.type}
data={item.data}
createdAt={item.createdAt}
user={item.user}
/>
),
)}
</Comment.Group>
</div>
{isFetching || isDetailsFetching ? (
<Loader active inverted inline="centered" size="small" className={styles.loader} />
) : (
!isAllFetched && <Visibility fireOnMount onOnScreen={onFetch} />
)}
</div>
</div>
);
},
);
Activities.propTypes = {
items: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
isFetching: PropTypes.bool.isRequired,
isAllFetched: PropTypes.bool.isRequired,
isDetailsVisible: PropTypes.bool.isRequired,
isDetailsFetching: PropTypes.bool.isRequired,
canEdit: PropTypes.bool.isRequired,
canEditAllComments: PropTypes.bool.isRequired,
onFetch: PropTypes.func.isRequired,
onDetailsToggle: PropTypes.func.isRequired,
onCommentCreate: PropTypes.func.isRequired,
onCommentUpdate: PropTypes.func.isRequired,
onCommentDelete: PropTypes.func.isRequired,
};
export default Activities;
@@ -8,12 +8,14 @@
}
.moduleHeader {
align-items: center;
color: #17394d;
display: flex;
font-size: 16px;
font-weight: bold;
line-height: 20px;
height: 36px;
justify-content: space-between;
margin: 0 0 4px;
padding: 8px 0;
}
.moduleIcon {
@@ -33,6 +35,24 @@
position: relative;
}
.toggleButton {
background: transparent;
box-shadow: none;
color: #6b808c;
float: right;
font-weight: normal;
margin-right: 0;
padding: 6px 11px;
text-align: left;
text-decoration: underline;
transition: none;
&:hover {
background: rgba(9, 30, 66, 0.08);
color: #092d42;
}
}
.wrapper {
margin-left: -40px;
margin-top: 12px;

Some files were not shown because too many files have changed in this diff Show More