Compare commits

...
38 Commits
Author SHA1 Message Date
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
64 changed files with 15018 additions and 16343 deletions
+23 -5
View File
@@ -1,11 +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/logs
!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
@@ -9,7 +9,7 @@ on:
workflow_dispatch:
env:
ALPINE_VERSION: 3.15
ALPINE_VERSION: 3.16
jobs:
build-and-push-docker-base-image:
+7
View File
@@ -3,3 +3,10 @@ docker-compose.override.yml
.idea
.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
+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 \
+149 -3
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,9 +49,146 @@ 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 applciation's logfile directory to the host machine via a shared volume. This feature is not enabled by default.
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`.
@@ -117,6 +259,10 @@ Restart the fail2ban service. You can check the status of your Planka jail by ru
fail2ban-client status planka
```
### Import from Trello
It is not yet implemented inside Planka, but for now you can use the great tool [trello2planka](https://github.com/christophenne/trello2planka) to do the import.
## Development
Clone the repository and install dependencies:
+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;
};
+11642 -14809
View File
File diff suppressed because it is too large Load Diff
+37 -46
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,75 +49,68 @@
"**/*.test.js"
]
}
],
"prettier/prettier": [
"error",
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}
]
}
},
"dependencies": {
"@juggle/resize-observer": "^3.4.0",
"classnames": "^2.3.1",
"connected-react-router": "^6.9.3",
"date-fns": "^2.29.1",
"classnames": "^2.3.2",
"date-fns": "^2.29.3",
"dequal": "^2.0.3",
"history": "^4.10.1",
"i18next": "^21.8.14",
"i18next-browser-languagedetector": "^6.1.4",
"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",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"node-sass": "^7.0.1",
"photoswipe": "^5.3.0",
"node-sass": "^8.0.0",
"photoswipe": "^5.3.3",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-beautiful-dnd": "^13.1.0",
"react": "^18.2.0",
"react-app-rewired": "^2.2.1",
"react-beautiful-dnd": "^13.1.1",
"react-datepicker": "^4.8.0",
"react-dom": "^17.0.2",
"react-dropzone": "^14.2.2",
"react-i18next": "^11.18.1",
"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.3",
"react-photoswipe-gallery": "^2.2.1",
"react-redux": "^7.2.8",
"react-router-dom": "^5.3.1",
"react-photoswipe-gallery": "^2.2.2",
"react-redux": "^8.0.5",
"react-router": "^6.4.3",
"react-router-dom": "^6.4.3",
"react-scripts": "5.0.1",
"react-textarea-autosize": "^8.3.4",
"react-simplemde-editor": "^5.2.0",
"react-textarea-autosize": "^8.4.0",
"redux": "^4.2.0",
"redux-first-history": "^5.1.1",
"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.6",
"reselect": "^4.1.7",
"sails.io.js": "^1.2.1",
"semantic-ui-react": "^2.1.3",
"socket.io-client": "^2.3.1",
"socket.io-client": "^2.5.0",
"validator": "^13.7.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.20.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.6.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"jest-enzyme": "^7.1.2",
"prettier": "2.7.1",
"react-test-renderer": "^17.0.2"
"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>
+2 -1
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,6 +13,7 @@ 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) => {
@@ -14,6 +14,7 @@ const BoardActions = React.memo(
filterUsers,
filterLabels,
allUsers,
canEdit,
canEditMemberships,
onMembershipCreate,
onMembershipUpdate,
@@ -27,6 +28,7 @@ const BoardActions = React.memo(
onLabelDelete,
}) => {
return (
<div className={styles.wrapper}>
<div className={styles.actions}>
<div className={styles.action}>
<Memberships
@@ -45,6 +47,7 @@ const BoardActions = React.memo(
labels={filterLabels}
allBoardMemberships={memberships}
allLabels={labels}
canEdit={canEdit}
onUserAdd={onUserToFilterAdd}
onUserRemove={onUserFromFilterRemove}
onLabelAdd={onLabelToFilterAdd}
@@ -55,6 +58,7 @@ const BoardActions = React.memo(
/>
</div>
</div>
</div>
);
},
);
@@ -67,6 +71,7 @@ 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,
@@ -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,
@@ -19,7 +19,7 @@ const BoardMembershipPermissionsSelectStep = React.memo(
...defaultData,
}));
const handleRoleSelectClick = useCallback((role) => {
const handleSelectRoleClick = useCallback((role) => {
setData((prevData) => ({
...prevData,
role,
@@ -50,7 +50,7 @@ const BoardMembershipPermissionsSelectStep = React.memo(
<Menu secondary vertical className={styles.menu}>
<Menu.Item
active={data.role === BoardMembershipRoles.EDITOR}
onClick={() => handleRoleSelectClick(BoardMembershipRoles.EDITOR)}
onClick={() => handleSelectRoleClick(BoardMembershipRoles.EDITOR)}
>
<div className={styles.menuItemTitle}>{t('common.editor')}</div>
<div className={styles.menuItemDescription}>
@@ -59,7 +59,7 @@ const BoardMembershipPermissionsSelectStep = React.memo(
</Menu.Item>
<Menu.Item
active={data.role === BoardMembershipRoles.VIEWER}
onClick={() => handleRoleSelectClick(BoardMembershipRoles.VIEWER)}
onClick={() => handleSelectRoleClick(BoardMembershipRoles.VIEWER)}
>
<div className={styles.menuItemTitle}>{t('common.viewer')}</div>
<div className={styles.menuItemDescription}>{t('common.canOnlyViewBoard')}</div>
+1 -4
View File
@@ -125,7 +125,7 @@ const Card = React.memo(
startedAt={timer.startedAt}
total={timer.total}
size="tiny"
onClick={handleToggleTimerClick}
onClick={canEdit ? handleToggleTimerClick : undefined}
/>
</span>
)}
@@ -166,14 +166,11 @@ const Card = React.memo(
{canEdit && (
<ActionsPopup
card={{
id,
name,
dueDate,
timer,
boardId,
listId,
projectId,
isPersisted,
}}
projectsToLists={allProjectsToLists}
boardMemberships={allBoardMemberships}
@@ -10,7 +10,7 @@
position: absolute;
text-align: center;
width: 100%;
z-index: 2000;
z-index: 2001;
}
.wrapper {
@@ -29,7 +29,6 @@
padding: 6px 32px 6px 128px;
margin: 0;
min-height: 80px;
z-index: 0;
}
.extension {
@@ -95,7 +94,6 @@
text-decoration: none;
top: 50%;
width: 112px;
z-index: 1;
}
.thumbnailLabel {
@@ -298,6 +298,7 @@ const CardModal = React.memo(
<Timer startedAt={timer.startedAt} total={timer.total} />
)}
</span>
{canEdit && (
<button
onClick={handleToggleTimerClick}
type="button"
@@ -309,6 +310,7 @@ const CardModal = React.memo(
className={styles.addAttachment}
/>
</button>
)}
</div>
)}
</div>
@@ -1,19 +1,15 @@
import React, { useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
import React, { useCallback, useImperativeHandle, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import TextareaAutosize from 'react-textarea-autosize';
import { Button, Form, TextArea } from 'semantic-ui-react';
import { useClosableForm, useField } from '../../hooks';
import { Button, Form } from 'semantic-ui-react';
import SimpleMDE from 'react-simplemde-editor';
import styles from './DescriptionEdit.module.scss';
const DescriptionEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) => {
const [t] = useTranslation();
const [isOpened, setIsOpened] = useState(false);
const [value, handleFieldChange, setValue] = useField(null);
const field = useRef(null);
const [value, setValue] = useState(null);
const open = useCallback(() => {
setIsOpened(true);
@@ -55,20 +51,37 @@ const DescriptionEdit = React.forwardRef(({ children, defaultValue, onUpdate },
[close],
);
const [handleFieldBlur, handleControlMouseOver, handleControlMouseOut] = useClosableForm(
close,
isOpened,
);
const handleSubmit = useCallback(() => {
close();
}, [close]);
useEffect(() => {
if (isOpened) {
field.current.ref.current.focus();
}
}, [isOpened]);
const mdEditorOptions = useMemo(
() => ({
autofocus: true,
spellChecker: false,
status: false,
toolbar: [
'bold',
'italic',
'heading',
'strikethrough',
'|',
'quote',
'unordered-list',
'ordered-list',
'table',
'|',
'link',
'image',
'|',
'undo',
'redo',
'|',
'guide',
],
}),
[],
);
if (!isOpened) {
return React.cloneElement(children, {
@@ -78,26 +91,17 @@ const DescriptionEdit = React.forwardRef(({ children, defaultValue, onUpdate },
return (
<Form onSubmit={handleSubmit}>
<TextArea
ref={field}
as={TextareaAutosize}
<SimpleMDE
value={value}
options={mdEditorOptions}
placeholder={t('common.enterDescription')}
minRows={3}
spellCheck={false}
className={styles.field}
onKeyDown={handleFieldKeyDown}
onChange={handleFieldChange}
onBlur={handleFieldBlur}
onChange={setValue}
/>
<div className={styles.controls}>
{/* eslint-disable-next-line jsx-a11y/mouse-events-have-key-events */}
<Button
positive
content={t('action.save')}
onMouseOver={handleControlMouseOver}
onMouseOut={handleControlMouseOut}
/>
<Button positive content={t('action.save')} />
</div>
</Form>
);
@@ -6,15 +6,12 @@
.field {
background: #fff;
border: 1px solid rgba(9, 30, 66, 0.13);
border-radius: 3px;
color: #17394d;
display: block;
font-size: 14px;
line-height: 1.5;
margin-bottom: 4px;
overflow: hidden;
padding: 8px 12px;
resize: none;
&:focus {
@@ -2,5 +2,6 @@
.wrapper {
position: fixed;
width: 100%;
z-index: 1;
}
}
@@ -7,7 +7,8 @@
background: none;
}
&:active, &:hover {
&:active,
&:hover {
background: transparent;
color: rgba(255, 255, 255, 0.9);
}
@@ -42,7 +43,6 @@
height: 50px;
margin: 0;
width: 100%;
z-index: 1;
}
.notification {
@@ -1,3 +1,4 @@
import truncate from 'lodash/truncate';
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useTranslation, Trans } from 'react-i18next';
@@ -47,23 +48,26 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
{activity.data.toList.name}
</Trans>
);
case ActivityTypes.COMMENT_CARD:
case ActivityTypes.COMMENT_CARD: {
const commentText = truncate(activity.data.text);
return (
<Trans
i18nKey="common.userLeftNewCommentToCard"
values={{
user: activity.user.name,
comment: activity.data.text,
comment: commentText,
card: card.name,
}}
>
{activity.user.name}
{` left a new comment «${activity.data.text}» to `}
{` left a new comment «${commentText}» to `}
<Link to={Paths.CARDS.replace(':id', card.id)} onClick={onClose}>
{card.name}
</Link>
</Trans>
);
}
default:
}
@@ -80,9 +84,10 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
})}
</Popup.Header>
<Popup.Content>
{items.length > 0
? items.map((item) => (
<div key={item.id} className={styles.wrapper}>
{items.length > 0 ? (
<div className={styles.wrapper}>
{items.map((item) => (
<div key={item.id} className={styles.item}>
{item.card && item.activity ? (
<>
<User
@@ -90,20 +95,23 @@ const NotificationsStep = React.memo(({ items, onDelete, onClose }) => {
avatarUrl={item.activity.user.avatarUrl}
size="large"
/>
<span className={styles.content}>{renderItemContent(item)}</span>
<span className={styles.itemContent}>{renderItemContent(item)}</span>
</>
) : (
<div className={styles.deletedContent}>{t('common.cardOrActionAreDeleted')}</div>
<div className={styles.itemDeleted}>{t('common.cardOrActionAreDeleted')}</div>
)}
<Button
type="button"
icon="close"
className={styles.button}
icon="trash alternate outline"
className={styles.itemButton}
onClick={() => handleDelete(item.id)}
/>
</div>
))
: t('common.noUnreadNotifications')}
))}
</div>
) : (
t('common.noUnreadNotifications')
)}
</Popup.Content>
</>
);
@@ -1,5 +1,13 @@
:global(#app) {
.button {
.item {
padding: 12px;
&:hover {
background: #f0f0f0;
}
}
.itemButton {
background: transparent;
box-shadow: none;
float: right;
@@ -7,7 +15,7 @@
line-height: 20px;
margin: 0;
min-height: auto;
padding: 5px 0;
padding: 0;
transition: background 0.3s ease;
width: 20px;
@@ -16,7 +24,7 @@
}
}
.content {
.itemContent {
display: inline-block;
font-size: 12px;
min-height: 36px;
@@ -27,7 +35,7 @@
word-break: break-word;
}
.deletedContent {
.itemDeleted {
display: inline-block;
line-height: 20px;
min-height: 20px;
@@ -38,10 +46,21 @@
.wrapper {
margin: 0 -12px;
padding: 12px;
max-height: 60vh;
overflow-x: hidden;
overflow-y: auto;
scrollbar-width: thin;
&:hover {
background: #f0f0f0;
&::-webkit-scrollbar {
width: 5px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
border-radius: 3px;
}
}
}
+3 -1
View File
@@ -10,12 +10,13 @@ import Editor from './Editor';
import styles from './AddStep.module.scss';
const AddStep = React.memo(({ onCreate, onBack }) => {
const AddStep = React.memo(({ defaultData, onCreate, onBack }) => {
const [t] = useTranslation();
const [data, handleFieldChange] = useForm(() => ({
name: '',
color: LabelColors[0],
...defaultData,
}));
const handleSubmit = useCallback(() => {
@@ -46,6 +47,7 @@ const AddStep = React.memo(({ onCreate, onBack }) => {
});
AddStep.propTypes = {
defaultData: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
onCreate: PropTypes.func.isRequired,
onBack: PropTypes.func.isRequired,
};
+8 -2
View File
@@ -8,7 +8,8 @@ import { Button } from 'semantic-ui-react';
import styles from './Item.module.scss';
import globalStyles from '../../styles.module.scss';
const Item = React.memo(({ name, color, isPersisted, isActive, onSelect, onDeselect, onEdit }) => {
const Item = React.memo(
({ name, color, isPersisted, isActive, canEdit, onSelect, onDeselect, onEdit }) => {
const handleToggleClick = useCallback(() => {
if (isActive) {
onDeselect();
@@ -31,22 +32,27 @@ const Item = React.memo(({ name, color, isPersisted, isActive, onSelect, onDesel
)}
onClick={handleToggleClick}
/>
{canEdit && (
<Button
icon="pencil"
size="small"
floated="right"
disabled={!isPersisted}
className={styles.editButton}
onClick={onEdit}
/>
)}
</div>
);
});
},
);
Item.propTypes = {
name: PropTypes.string,
color: PropTypes.string.isRequired,
isPersisted: PropTypes.bool.isRequired,
isActive: PropTypes.bool.isRequired,
canEdit: PropTypes.bool.isRequired,
onSelect: PropTypes.func.isRequired,
onDeselect: PropTypes.func.isRequired,
onEdit: PropTypes.func.isRequired,
@@ -4,7 +4,6 @@
box-shadow: none;
flex: 0 0 auto;
font-weight: normal;
margin: 0;
padding: 8px 10px;
text-decoration: underline;
@@ -18,6 +17,7 @@
flex: 1 1 auto;
font-size: 14px;
font-weight: bold;
margin-right: 0;
overflow: hidden;
padding: 8px 32px 8px 10px;
position: relative;
@@ -18,7 +18,18 @@ const StepTypes = {
};
const LabelsStep = React.memo(
({ items, currentIds, title, onSelect, onDeselect, onCreate, onUpdate, onDelete, onBack }) => {
({
items,
currentIds,
title,
canEdit,
onSelect,
onDeselect,
onCreate,
onUpdate,
onDelete,
onBack,
}) => {
const [t] = useTranslation();
const [step, openStep, handleBack] = useSteps();
const [search, handleSearchChange] = useField('');
@@ -84,7 +95,15 @@ const LabelsStep = React.memo(
if (step) {
switch (step.type) {
case StepTypes.ADD:
return <AddStep onCreate={onCreate} onBack={handleBack} />;
return (
<AddStep
defaultData={{
name: search,
}}
onCreate={onCreate}
onBack={handleBack}
/>
);
case StepTypes.EDIT: {
const currentItem = items.find((item) => item.id === step.params.id);
@@ -132,6 +151,7 @@ const LabelsStep = React.memo(
color={item.color}
isPersisted={item.isPersisted}
isActive={currentIds.includes(item.id)}
canEdit={canEdit}
onSelect={() => handleSelect(item.id)}
onDeselect={() => handleDeselect(item.id)}
onEdit={() => handleEdit(item.id)}
@@ -139,12 +159,14 @@ const LabelsStep = React.memo(
))}
</div>
)}
{canEdit && (
<Button
fluid
content={t('action.createNewLabel')}
className={styles.addButton}
onClick={handleAddClick}
/>
)}
</Popup.Content>
</>
);
@@ -157,6 +179,7 @@ LabelsStep.propTypes = {
currentIds: PropTypes.array.isRequired,
/* eslint-enable react/forbid-prop-types */
title: PropTypes.string,
canEdit: PropTypes.bool,
onSelect: PropTypes.func.isRequired,
onDeselect: PropTypes.func.isRequired,
onCreate: PropTypes.func.isRequired,
@@ -167,6 +190,7 @@ LabelsStep.propTypes = {
LabelsStep.defaultProps = {
title: 'common.labels',
canEdit: true,
onBack: undefined,
};
+13 -12
View File
@@ -1,8 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Provider } from 'react-redux';
import { Route, Switch } from 'react-router-dom';
import { ConnectedRouter } from 'connected-react-router';
import { Route, Routes } from 'react-router-dom';
import { HistoryRouter as Router } from 'redux-first-history/rr6';
import Paths from '../constants/Paths';
import LoginContainer from '../containers/LoginContainer';
@@ -11,6 +11,7 @@ import NotFound from './NotFound';
import 'react-datepicker/dist/react-datepicker.css';
import 'photoswipe/dist/photoswipe.css';
import 'easymde/dist/easymde.min.css';
import '../lib/custom-ui/styles.css';
import '../styles.module.scss';
@@ -18,16 +19,16 @@ import '../styles.module.scss';
function Root({ store, history }) {
return (
<Provider store={store}>
<ConnectedRouter history={history}>
<Switch>
<Route exact path={Paths.LOGIN} component={LoginContainer} />
<Route exact path={Paths.ROOT} component={CoreWrapperContainer} />
<Route exact path={Paths.PROJECTS} component={CoreWrapperContainer} />
<Route exact path={Paths.BOARDS} component={CoreWrapperContainer} />
<Route exact path={Paths.CARDS} component={CoreWrapperContainer} />
<Route path="*" component={NotFound} />
</Switch>
</ConnectedRouter>
<Router history={history}>
<Routes>
<Route path={Paths.LOGIN} element={<LoginContainer />} />
<Route path={Paths.ROOT} element={<CoreWrapperContainer />} />
<Route path={Paths.PROJECTS} element={<CoreWrapperContainer />} />
<Route path={Paths.BOARDS} element={<CoreWrapperContainer />} />
<Route path={Paths.CARDS} element={<CoreWrapperContainer />} />
<Route path="*" element={<NotFound />} />
</Routes>
</Router>
</Provider>
);
}
+8 -1
View File
@@ -1,6 +1,11 @@
const { BASE_URL } = window;
const BASE_PATH = BASE_URL.replace(/^.*\/\/[^/]*(.*)[^?#]*.*$/, '$1');
const SERVER_BASE_URL =
process.env.REACT_APP_SERVER_BASE_URL ||
(process.env.NODE_ENV === 'production' ? '' : 'http://localhost:1337');
(process.env.NODE_ENV === 'production' ? BASE_URL : 'http://localhost:1337');
const SERVER_HOST_NAME = SERVER_BASE_URL.replace(/^(.*\/\/[^/?#]*).*$/, '$1');
const ACCESS_TOKEN_KEY = 'accessToken';
const ACCESS_TOKEN_VERSION_KEY = 'accessTokenVersion';
@@ -10,7 +15,9 @@ const POSITION_GAP = 65535;
const ACTIVITIES_LIMIT = 50;
export default {
BASE_PATH,
SERVER_BASE_URL,
SERVER_HOST_NAME,
ACCESS_TOKEN_KEY,
ACCESS_TOKEN_VERSION_KEY,
ACCESS_TOKEN_VERSION,
+7 -5
View File
@@ -1,8 +1,10 @@
const ROOT = '/';
const LOGIN = '/login';
const PROJECTS = '/projects/:id';
const BOARDS = '/boards/:id';
const CARDS = '/cards/:id';
import Config from './Config';
const ROOT = `${Config.BASE_PATH}/`;
const LOGIN = `${Config.BASE_PATH}/login`;
const PROJECTS = `${Config.BASE_PATH}/projects/:id`;
const BOARDS = `${Config.BASE_PATH}/boards/:id`;
const CARDS = `${Config.BASE_PATH}/cards/:id`;
export default {
ROOT,
@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import { BoardMembershipRoles } from '../constants/Enums';
import BoardActions from '../components/BoardActions';
const mapStateToProps = (state) => {
@@ -12,6 +13,7 @@ const mapStateToProps = (state) => {
const labels = selectors.selectLabelsForCurrentBoard(state);
const filterUsers = selectors.selectFilterUsersForCurrentBoard(state);
const filterLabels = selectors.selectFilterLabelsForCurrentBoard(state);
const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state);
return {
memberships,
@@ -19,6 +21,7 @@ const mapStateToProps = (state) => {
filterUsers,
filterLabels,
allUsers,
canEdit: !!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR,
canEditMemberships: isCurrentUserManager,
};
};
+1 -1
View File
@@ -1,6 +1,6 @@
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { push } from 'connected-react-router';
import { push } from 'redux-first-history';
import omit from 'lodash/omit';
import selectors from '../selectors';
-3
View File
@@ -1,3 +0,0 @@
import { createBrowserHistory } from 'history';
export default createBrowserHistory();
+4 -4
View File
@@ -1,10 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import store from './store';
import history from './history';
import store, { history } from './store';
import Root from './components/Root';
import './i18n';
ReactDOM.render(React.createElement(Root, { store, history }), document.getElementById('root'));
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(React.createElement(Root, { store, history }));
+17 -16
View File
@@ -4,11 +4,11 @@ export default {
dateFns,
format: {
date: 'd/M/yyyy',
date: 'd.MM.yyyy',
time: 'p',
dateTime: '$t(format:date) $t(format:time)',
longDate: 'MMM d',
longDateTime: "d MMMM 'at' p",
longDate: 'd. MMM',
longDateTime: "d. MMMM 'um' p",
},
translation: {
@@ -23,7 +23,7 @@ export default {
administrator: 'Administrator',
all: 'Alle',
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
'Alle Änderungen werden automatisch gespeichert,<br />sobald die Verbindung wiederhergestellt wurde',
'Alle Änderungen werden automatisch gespeichert, sobald die Verbindung wiederhergestellt wurde.',
areYouSureYouWantToDeleteThisAttachment:
'Sind Sie sicher, dass Sie diesen Anhang löschen möchten?',
areYouSureYouWantToDeleteThisBoard: 'Sind Sie sicher, dass Sie dieses Board löschen möchten?',
@@ -55,10 +55,11 @@ export default {
color: 'Farbe',
createBoard_title: 'Board erstellen',
createLabel_title: 'Label erstellen',
createNewOneOrSelectExistingOne: 'Ein Neues erstellen, oder <br />ein Bestehendes auswählen',
createNewOneOrSelectExistingOne:
'Erstellen Sie ein neues oder wählen Sie ein bestehendes aus.',
createProject_title: 'Projekt erstellen',
createTextFile_title: 'Textdatei erstellen',
currentPassword: 'Derzeitiges Password',
currentPassword: 'Derzeitiges Passwort',
dangerZone_title: 'Gefährlicher Bereich',
date: 'Datum',
dueDate_title: 'Fälligkeitsdatum',
@@ -73,18 +74,18 @@ export default {
deleteUser_title: 'Benutzer löschen',
description: 'Beschreibung',
detectAutomatically: 'Automatische Erkennung',
dropFileToUpload: 'Datei ablegen, um hochzuladen',
dropFileToUpload: 'Datei ablegen, um sie hochzuladen',
editAttachment_title: 'Anhang bearbieten',
editAvatar_title: 'Avatar bearbeiten',
editBoard_title: 'Board bearbeiten',
editDueDate_title: 'Fälligkeitsdatum bearbeiten',
editEmail_title: 'E-Mail bearbeiten',
editEmail_title: 'E-Mail-Adresse bearbeiten',
editLabel_title: 'Label bearbeiten',
editPassword_title: 'Passwort ändern',
editTimer_title: 'Timer bearbeiten',
editUsername_title: 'Benutzername ändern',
email: 'E-Mail',
emailAlreadyInUse: 'E-Mail bereits in Verwendung',
email: 'E-Mail-Adresse',
emailAlreadyInUse: 'E-Mail-Adresse bereits in Verwendung',
enterCardTitle: 'Kartentitel eingeben...',
enterDescription: 'Beschreibung eingeben...',
enterFilename: 'Dateiname eingeben',
@@ -108,7 +109,7 @@ export default {
minutes: 'Minuten',
moveCard_title: 'Karte verschieben',
name: 'Name',
newEmail: 'Neue E-Mail',
newEmail: 'Neue E-Mail-Adresse',
newPassword: 'Neues Passwort',
newUsername: 'Neuer Benutzername',
noConnectionToServer: 'Keine Verbindung zum Server',
@@ -140,10 +141,10 @@ export default {
time: 'Zeit',
timer: 'Timer',
title: 'Titel',
userActions_title: 'Benutzerraktionen',
userActions_title: 'Benutzeraktionen',
userAddedThisCardToList: '<0>{{user}}</0><1> hat diese Karte hinzugefügt zu {{list}}</1>',
userLeftNewCommentToCard:
'{{user}} hat einen neuen Kommentar verfasst «{{comment}}» to <2>{{card}}</2>',
'{{user}} hat einen neuen Kommentar verfasst: «{{comment}}» in <2>{{card}}</2>',
userMovedCardFromListToList:
'{{user}} bewegte <2>{{card}}</2> von {{fromList}} nach {{toList}}',
userMovedThisCardFromListToList:
@@ -190,7 +191,7 @@ export default {
edit: 'Bearbeiten',
editDueDate_title: 'Fälligkeitsdatum bearbeiten',
editDescription_title: 'Beschreibung ändern',
editEmail_title: 'E-Mail bearbeiten',
editEmail_title: 'E-Mail-Adresse bearbeiten',
editPassword_title: 'Passwort ändern',
editTimer_title: 'Timer bearbeiten',
editTitle_title: 'Titel bearbeiten',
@@ -199,7 +200,7 @@ export default {
leaveBoard: 'Board verlassen',
leaveProject: 'Projekt verlassen',
logOut_title: 'Ausloggen',
makeCover_title: 'als Vorschau festlegen',
makeCover_title: 'Als Vorschau festlegen',
move: 'Verschieben',
moveCard_title: 'Karte bewegen',
remove: 'Löschen',
@@ -216,7 +217,7 @@ export default {
start: 'Start',
stop: 'Stopp',
subscribe: 'Abonnieren',
unsubscribe: 'Deabonnieren',
unsubscribe: 'De-abonnieren',
uploadNewAvatar: 'Neuen Avatar hochladen',
uploadNewImage: 'Neues Bild hochladen',
},
+3 -3
View File
@@ -1,14 +1,14 @@
export default {
translation: {
common: {
emailOrUsername: 'E-mail oder Benutzername',
invalidEmailOrUsername: 'Ungültige E-mail oder Benutzername',
emailOrUsername: 'E-Mail-Adresse oder Benutzername',
invalidEmailOrUsername: 'Ungültige E-Mail-Adresse oder Benutzername',
invalidPassword: 'Ungültiges Passwort',
logInToPlanka: 'Einloggen',
noInternetConnection: 'Keine Internetverbindung',
pageNotFound_title: 'Seite nicht gefunden',
password: 'Passwort',
projectManagement: 'Projekt Management',
projectManagement: 'Projekt-Management',
serverConnectionFailed: 'Serververbindung fehlgeschlagen',
unknownError: 'Unbekannter Fehler, bitte später erneut versuchen',
},
+1 -1
View File
@@ -1,4 +1,4 @@
import { LOCATION_CHANGE } from 'connected-react-router';
import { LOCATION_CHANGE } from 'redux-first-history';
import ActionTypes from '../constants/ActionTypes';
import ModalTypes from '../constants/ModalTypes';
+2 -4
View File
@@ -1,5 +1,3 @@
import { connectRouter } from 'connected-react-router';
import { routerReducer } from '../redux-history-context';
import history from '../history';
export default connectRouter(history);
export default routerReducer;
+6
View File
@@ -0,0 +1,6 @@
import { createBrowserHistory } from 'history';
import { createReduxHistoryContext } from 'redux-first-history';
export const { createReduxHistory, routerMiddleware, routerReducer } = createReduxHistoryContext({
history: createBrowserHistory(),
});
+2 -2
View File
@@ -23,9 +23,9 @@ export function* fetchBoardByCurrentPath() {
if (pathsMatch) {
let boardId;
if (pathsMatch.path === Paths.BOARDS) {
if (pathsMatch.pattern.path === Paths.BOARDS) {
boardId = pathsMatch.params.id;
} else if (pathsMatch.path === Paths.CARDS) {
} else if (pathsMatch.pattern.path === Paths.CARDS) {
({
item: card,
item: { boardId },
+4 -4
View File
@@ -1,5 +1,5 @@
import { call, put, select, take } from 'redux-saga/effects';
import { push } from 'connected-react-router';
import { push } from 'redux-first-history';
import request from '../request';
import selectors from '../../../selectors';
@@ -31,7 +31,7 @@ export function* handleLocationChange() {
return;
}
switch (pathsMatch.path) {
switch (pathsMatch.pattern.path) {
case Paths.LOGIN:
yield call(goToRoot);
@@ -58,7 +58,7 @@ export function* handleLocationChange() {
let attachments;
let deletedNotifications;
switch (pathsMatch.path) {
switch (pathsMatch.pattern.path) {
case Paths.BOARDS:
case Paths.CARDS: {
const currentBoard = yield select(selectors.selectCurrentBoard);
@@ -85,7 +85,7 @@ export function* handleLocationChange() {
} catch (error) {} // eslint-disable-line no-empty
}
if (pathsMatch.path === Paths.CARDS) {
if (pathsMatch.pattern.path === Paths.CARDS) {
const notificationIds = yield select(selectors.selectNotificationIdsForCurrentCard);
if (notificationIds && notificationIds.length > 0) {
+1 -1
View File
@@ -1,5 +1,5 @@
import { takeEvery } from 'redux-saga/effects';
import { LOCATION_CHANGE } from 'connected-react-router';
import { LOCATION_CHANGE } from 'redux-first-history';
import services from '../services';
+2 -2
View File
@@ -1,5 +1,5 @@
import { call, put, select } from 'redux-saga/effects';
import { push } from 'connected-react-router';
import { push } from 'redux-first-history';
import selectors from '../../../selectors';
import Paths from '../../../constants/Paths';
@@ -19,7 +19,7 @@ export function* handleLocationChange() {
return;
}
switch (pathsMatch.path) {
switch (pathsMatch.pattern.path) {
case Paths.ROOT:
case Paths.PROJECTS:
case Paths.BOARDS:
+1 -1
View File
@@ -1,5 +1,5 @@
import { takeEvery } from 'redux-saga/effects';
import { LOCATION_CHANGE } from 'connected-react-router';
import { LOCATION_CHANGE } from 'redux-first-history';
import services from '../services';
+1 -1
View File
@@ -22,7 +22,7 @@ export const selectPath = createReduxOrmSelector(
(state) => selectCurrentUserId(state),
({ Project, Board, Card }, pathsMatch, currentUserId) => {
if (pathsMatch) {
switch (pathsMatch.path) {
switch (pathsMatch.pattern.path) {
case Paths.PROJECTS: {
const projectModel = Project.withId(pathsMatch.params.id);
+5 -6
View File
@@ -1,6 +1,5 @@
import { configure } from 'enzyme';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
import 'jest-enzyme';
configure({ adapter: new Adapter() });
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
+7 -4
View File
@@ -1,14 +1,13 @@
import { applyMiddleware, legacy_createStore as createStore, compose as reduxCompose } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { routerMiddleware } from 'connected-react-router';
import rootReducer from './reducers';
import rootSaga from './sagas';
import history from './history';
import { createReduxHistory, routerMiddleware } from './redux-history-context';
const sagaMiddleware = createSagaMiddleware();
const middlewares = [sagaMiddleware, routerMiddleware(history)];
const middlewares = [sagaMiddleware, routerMiddleware];
let compose = reduxCompose;
@@ -23,6 +22,10 @@ if (process.env.NODE_ENV !== 'production') {
}
}
export default createStore(rootReducer, compose(applyMiddleware(...middlewares)));
const store = createStore(rootReducer, compose(applyMiddleware(...middlewares)));
sagaMiddleware.run(rootSaga);
export default store;
export const history = createReduxHistory(store);
+6 -3
View File
@@ -2,10 +2,13 @@ import { matchPath } from 'react-router-dom';
export default (pathname, paths) => {
for (let i = 0; i < paths.length; i += 1) {
const match = matchPath(pathname, {
const match = matchPath(
{
path: paths[i],
exact: true,
});
end: true,
},
pathname,
);
if (match) {
return match;
+1 -1
View File
@@ -27,7 +27,7 @@ services:
- postgres
postgres:
image: postgres:alpine
image: postgres:14-alpine
restart: unless-stopped
volumes:
- db-data:/var/lib/postgresql/data
+1839 -250
View File
File diff suppressed because it is too large Load Diff
+26 -3
View File
@@ -1,6 +1,6 @@
{
"name": "planka",
"version": "1.8.1",
"version": "1.8.7",
"private": true,
"homepage": "https://plankanban.github.io/planka",
"repository": {
@@ -38,9 +38,32 @@
"npm run server:lint"
]
},
"prettier": {
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
},
"eslintConfig": {
"plugins": [
"prettier"
],
"extends": [
"plugin:prettier/recommended"
],
"rules": {
"no-undef": "off",
"prettier/prettier": "error"
}
},
"dependencies": {
"concurrently": "^7.3.0",
"husky": "^8.0.1",
"concurrently": "^7.6.0",
"husky": "^8.0.2",
"lint-staged": "^13.0.3"
},
"devDependencies": {
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.7.1"
}
}
+11 -11
View File
@@ -7,7 +7,7 @@ module.exports = {
let boardMemberships = await sails.helpers.users.getBoardMemberships(currentUser.id);
let membershipBoardIds = sails.helpers.utils.mapRecords(boardMemberships, 'boardId');
const membershipBoardIds = sails.helpers.utils.mapRecords(boardMemberships, 'boardId');
let membershipBoards = await sails.helpers.boards.getMany({
id: membershipBoardIds,
@@ -21,16 +21,6 @@ module.exports = {
membershipProjectIds = sails.helpers.utils.mapRecords(membershipProjects);
membershipBoards = membershipBoards.filter((membershipBoard) =>
membershipProjectIds.includes(membershipBoard.projectId),
);
membershipBoardIds = sails.helpers.utils.mapRecords(membershipBoards);
boardMemberships = boardMemberships.filter((boardMembership) =>
membershipBoardIds.includes(boardMembership.boardId),
);
const projectIds = [...managerProjectIds, ...membershipProjectIds];
const projects = [...managerProjects, ...membershipProjects];
@@ -40,7 +30,17 @@ module.exports = {
const users = await sails.helpers.users.getMany(userIds);
const managerBoards = await sails.helpers.projects.getBoards(managerProjectIds);
membershipBoards = membershipBoards.filter((membershipBoard) =>
membershipProjectIds.includes(membershipBoard.projectId),
);
const boards = [...managerBoards, ...membershipBoards];
const boardIds = sails.helpers.utils.mapRecords(boards);
boardMemberships = boardMemberships.filter((boardMembership) =>
boardIds.includes(boardMembership.boardId),
);
return {
items: projects,
@@ -1,3 +1,5 @@
const { v4: uuid } = require('uuid');
module.exports = {
inputs: {
record: {
@@ -29,18 +31,9 @@ module.exports = {
const boardMembership = await BoardMembership.destroyOne(inputs.record.id);
if (boardMembership) {
const notify = (room) => {
sails.sockets.broadcast(
`user:${boardMembership.userId}`,
'boardMembershipDelete',
{
item: boardMembership,
},
inputs.request,
);
const notifyBoard = () => {
sails.sockets.broadcast(
`board:${boardMembership.boardId}`,
room,
'boardMembershipDelete',
{
item: boardMembership,
@@ -54,15 +47,31 @@ module.exports = {
inputs.project.id,
);
if (!isProjectManager) {
sails.sockets.removeRoomMembersFromRooms(
`@user:${boardMembership.userId}`,
`board:${boardMembership.boardId}`,
() => {
notify(`board:${boardMembership.boardId}`);
},
);
}
notify(`user:${boardMembership.userId}`);
if (isProjectManager) {
notifyBoard();
} else {
// TODO: also remove if unsubscribed to user
const tempRoom = uuid();
sails.sockets.addRoomMembersToRooms(`board:${boardMembership.boardId}`, tempRoom, () => {
sails.sockets.removeRoomMembersFromRooms(
`user:${boardMembership.userId}`,
`board:${boardMembership.boardId}`,
notifyBoard,
tempRoom,
() => {
notify(tempRoom);
sails.sockets.removeRoomMembersFromRooms(tempRoom, tempRoom);
},
);
});
}
}
+9 -2
View File
@@ -17,16 +17,23 @@ module.exports = {
const board = await Board.archiveOne(inputs.record.id);
if (board) {
sails.sockets.leaveAll(`board:${board.id}`);
sails.sockets.removeRoomMembersFromRooms(`board:${board.id}`, `board:${board.id}`);
const managerUserIds = await sails.helpers.projects.getManagerUserIds(board.projectId);
const memberUserIds = await sails.helpers.boards.getMemberUserIds(board.id);
const userIds = _.union(managerUserIds, memberUserIds);
userIds.forEach((userId) => {
sails.sockets.broadcast(
`project:${board.projectId}`,
`user:${userId}`,
'boardDelete',
{
item: board,
},
inputs.request,
);
});
}
return board;
+4 -3
View File
@@ -25,9 +25,10 @@ module.exports = {
},
async fn(inputs) {
const userIds = await sails.helpers.projects.getManagerAndBoardMemberUserIds(
inputs.record.projectId,
);
const managerUserIds = await sails.helpers.projects.getManagerUserIds(inputs.record.projectId);
const memberUserIds = await sails.helpers.boards.getMemberUserIds(inputs.record.id);
const userIds = _.union(managerUserIds, memberUserIds);
if (!_.isUndefined(inputs.values.position)) {
const boards = await sails.helpers.projects.getBoards(
+1 -1
View File
@@ -22,6 +22,6 @@ module.exports = {
};
}
return sails.helpers.cards.getMany(criteria);
return sails.helpers.cards.getMany(criteria, 'position');
},
};
+1 -1
View File
@@ -26,7 +26,7 @@ module.exports = {
const userIds = _.union(managerUserIds, memberUserIds);
userIds.forEach((userId) => {
sails.sockets.removeRoomMembersFromRooms(`user:${userId}`, boardRooms);
sails.sockets.removeRoomMembersFromRooms(`@user:${userId}`, boardRooms);
sails.sockets.broadcast(
`user:${userId}`,
+2 -2
View File
@@ -123,13 +123,13 @@ module.exports = {
if (user.id === inputs.user.id && inputs.request && inputs.request.isSocket) {
const tempRoom = uuid();
sails.sockets.addRoomMembersToRooms(`user:${user.id}`, tempRoom, () => {
sails.sockets.addRoomMembersToRooms(`@user:${user.id}`, tempRoom, () => {
sails.sockets.leave(inputs.request, tempRoom, () => {
sails.sockets.leaveAll(tempRoom);
});
});
} else {
sails.sockets.leaveAll(`user:${user.id}`);
sails.sockets.leaveAll(`@user:${user.id}`);
}
}
+4
View File
@@ -59,6 +59,10 @@ module.exports = function defineCurrentUserHook(sails) {
accessToken,
currentUser,
});
if (req.isSocket) {
sails.sockets.join(req, `@user:${currentUser.id}`);
}
}
}
+2 -1
View File
@@ -24,7 +24,7 @@ module.exports.views = {
*
*/
extension: 'html',
extension: 'ejs',
/**
*
@@ -36,4 +36,5 @@ module.exports.views = {
*/
layout: false,
locals: { BASE_URL: process.env.BASE_URL },
};
+1049 -1153
View File
File diff suppressed because it is too large Load Diff
+16 -30
View File
@@ -13,24 +13,13 @@
"test": "mocha test/lifecycle.test.js test/integration/**/*.test.js test/utils/**/*.test.js"
},
"eslintConfig": {
"plugins": [
"prettier"
],
"extends": [
"airbnb-base",
"plugin:prettier/recommended"
"../package.json"
],
"rules": {
"no-throw-literal": "off",
"no-undef": "off",
"prettier/prettier": [
"error",
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}
]
"no-undef": "off"
},
"globals": {
"_": true,
@@ -38,38 +27,35 @@
}
},
"dependencies": {
"bcrypt": "^5.0.1",
"dotenv": "^16.0.1",
"bcrypt": "^5.1.0",
"dotenv": "^16.0.3",
"dotenv-cli": "^6.0.0",
"filenamify": "^4.3.0",
"jsonwebtoken": "^8.5.1",
"knex": "^2.2.0",
"knex": "^2.3.0",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"move-file": "^2.1.0",
"rimraf": "^3.0.2",
"sails": "^1.5.2",
"sails-hook-orm": "^4.0.1",
"sails-hook-sockets": "^2.0.1",
"sails": "^1.5.3",
"sails-hook-orm": "^4.0.2",
"sails-hook-sockets": "^2.0.3",
"sails-postgresql-redacted": "^1.0.2-9",
"sharp": "^0.30.7",
"sharp": "^0.31.2",
"stream-to-array": "^2.3.0",
"uuid": "^8.3.2",
"uuid": "^9.0.0",
"validator": "^13.7.0",
"winston": "^3.8.1",
"winston": "^3.8.2",
"zxcvbn": "^4.4.2"
},
"devDependencies": {
"chai": "^4.3.6",
"eslint": "^8.20.0",
"chai": "^4.3.7",
"eslint": "^8.28.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"mocha": "^9.2.2",
"nodemon": "^2.0.19",
"prettier": "2.7.1",
"supertest": "^6.2.4"
"mocha": "^10.1.0",
"nodemon": "^2.0.20",
"supertest": "^6.3.1"
},
"engines": {
"node": "^12.10"