mirror of
https://github.com/plankanban/planka.git
synced 2025-12-20 09:15:39 +03:00
ref: Little refactoring
This commit is contained in:
@@ -16,7 +16,7 @@ import { usePopupInClosableContext } from '../../../hooks';
|
||||
import { isListArchiveOrTrash } from '../../../utils/record-helpers';
|
||||
import { AttachmentTypes, BoardMembershipRoles } from '../../../constants/Enums';
|
||||
import EditStep from './EditStep';
|
||||
import Favicon from './Favicon';
|
||||
import Favicon from '../../common/Favicon';
|
||||
import TimeAgo from '../../common/TimeAgo';
|
||||
|
||||
import styles from './ItemContent.module.scss';
|
||||
@@ -131,7 +131,11 @@ const ItemContent = React.forwardRef(({ id, onOpen }, ref) => {
|
||||
<span className={styles.options}>
|
||||
<button type="button" className={styles.option} onClick={handleDownloadClick}>
|
||||
<Icon name="download" size="small" className={styles.optionIcon} />
|
||||
<span className={styles.optionText}>Download</span>
|
||||
<span className={styles.optionText}>
|
||||
{t('action.download', {
|
||||
context: 'title',
|
||||
})}
|
||||
</span>
|
||||
</button>
|
||||
{attachment.data.image && canEdit && (
|
||||
<button type="button" className={styles.option} onClick={handleToggleCoverClick}>
|
||||
|
||||
8
client/src/components/common/Favicon/index.js
Normal file
8
client/src/components/common/Favicon/index.js
Normal file
@@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
import Favicon from './Favicon';
|
||||
|
||||
export default Favicon;
|
||||
@@ -73,14 +73,14 @@ const Header = React.memo(() => {
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const handleToggleEditModeClick = useCallback(() => {
|
||||
dispatch(entryActions.toggleEditMode(!isEditModeEnabled));
|
||||
}, [isEditModeEnabled, dispatch]);
|
||||
|
||||
const handleToggleFavoritesClick = useCallback(() => {
|
||||
dispatch(entryActions.toggleFavorites(!isFavoritesEnabled));
|
||||
}, [isFavoritesEnabled, dispatch]);
|
||||
|
||||
const handleToggleEditModeClick = useCallback(() => {
|
||||
dispatch(entryActions.toggleEditMode(!isEditModeEnabled));
|
||||
}, [isEditModeEnabled, dispatch]);
|
||||
|
||||
const handleProjectSettingsClick = useCallback(() => {
|
||||
if (!canEditProject) {
|
||||
return;
|
||||
|
||||
@@ -377,6 +377,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: 'تكرار البطاقة',
|
||||
edit: 'تعديل',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -382,6 +382,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: 'Дублирана карта',
|
||||
edit: 'Редактиране',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -392,6 +392,7 @@ export default {
|
||||
deleteUser_title: 'Smazat uživatele',
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Vše přečteno',
|
||||
download: null,
|
||||
duplicateCard_title: 'Duplikovat kartu',
|
||||
edit: 'Upravit',
|
||||
editColor_title: 'Upravit barvu',
|
||||
|
||||
@@ -402,6 +402,7 @@ export default {
|
||||
deleteUser_title: 'Slet bruger',
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Afvis alle',
|
||||
download: null,
|
||||
duplicateCard_title: 'Duplikér kort',
|
||||
edit: 'Rediger',
|
||||
editColor_title: 'Rediger farve',
|
||||
|
||||
@@ -407,6 +407,7 @@ export default {
|
||||
deleteUser_title: 'Benutzer löschen',
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Alle verwerfen',
|
||||
download: null,
|
||||
duplicateCard_title: 'Karte duplizieren',
|
||||
edit: 'Bearbeiten',
|
||||
editColor_title: 'Farbe bearbeiten',
|
||||
|
||||
@@ -418,6 +418,7 @@ export default {
|
||||
deleteUser_title: 'Διαγραφή χρήστη',
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Απόρριψη όλων',
|
||||
download: null,
|
||||
duplicateCard_title: 'Διπλασιασμός κάρτας',
|
||||
edit: 'Επεξεργασία',
|
||||
editColor_title: 'Επεξεργασία χρώματος',
|
||||
|
||||
@@ -401,6 +401,7 @@ export default {
|
||||
deleteUser_title: 'Delete User',
|
||||
deleteWebhook: 'Delete webhook',
|
||||
dismissAll: 'Dismiss all',
|
||||
download: 'Download',
|
||||
duplicateCard_title: 'Duplicate Card',
|
||||
edit: 'Edit',
|
||||
editColor_title: 'Edit Color',
|
||||
|
||||
@@ -396,6 +396,7 @@ export default {
|
||||
deleteUser_title: 'Delete User',
|
||||
deleteWebhook: 'Delete webhook',
|
||||
dismissAll: 'Dismiss all',
|
||||
download: 'Download',
|
||||
duplicateCard_title: 'Duplicate Card',
|
||||
edit: 'Edit',
|
||||
editColor_title: 'Edit Color',
|
||||
|
||||
@@ -401,6 +401,7 @@ export default {
|
||||
deleteUser_title: 'Borrar Usuario',
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Descartar todo',
|
||||
download: null,
|
||||
duplicateCard_title: 'Duplicar tarjeta',
|
||||
edit: 'Editar',
|
||||
editColor_title: 'Editar color',
|
||||
|
||||
@@ -400,6 +400,7 @@ export default {
|
||||
deleteUser_title: 'Kustuta kasutaja',
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Eemalda kõik',
|
||||
download: null,
|
||||
duplicateCard_title: 'Duplikaardi loomine',
|
||||
edit: 'Muuda',
|
||||
editColor_title: 'Muuda värvi',
|
||||
|
||||
@@ -379,6 +379,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: 'تکرار کارت',
|
||||
edit: 'ویرایش',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -400,6 +400,7 @@ export default {
|
||||
deleteUser_title: 'Poista käyttäjä',
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Sulje kaikki',
|
||||
download: null,
|
||||
duplicateCard_title: 'Monista kortti',
|
||||
edit: 'Muokkaa',
|
||||
editColor_title: 'Muokkaa väriä',
|
||||
|
||||
@@ -404,6 +404,7 @@ export default {
|
||||
deleteUser_title: 'Supprimer l’utilisateur',
|
||||
deleteWebhook: 'Supprimer le webhook',
|
||||
dismissAll: 'Tout rejeter',
|
||||
download: null,
|
||||
duplicateCard_title: 'Dupliquer la carte',
|
||||
edit: 'Modifier',
|
||||
editColor_title: 'Modifier la couleur',
|
||||
|
||||
@@ -401,6 +401,7 @@ export default {
|
||||
deleteUser_title: 'Felhasználó törlése',
|
||||
deleteWebhook: 'Webhook törlése',
|
||||
dismissAll: 'Összes elvetése',
|
||||
download: null,
|
||||
duplicateCard_title: 'Kártya másolása',
|
||||
edit: 'Szerkesztés',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -381,6 +381,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: 'Ubah',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -402,6 +402,7 @@ export default {
|
||||
deleteUser_title: 'Elimina utente',
|
||||
deleteWebhook: 'Elimina webhook',
|
||||
dismissAll: 'Ignora tutto',
|
||||
download: null,
|
||||
duplicateCard_title: 'Duplica scheda',
|
||||
edit: 'Modifica',
|
||||
editColor_title: 'Modifica colore',
|
||||
|
||||
@@ -381,6 +381,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: '編集',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -380,6 +380,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: '모두 해제',
|
||||
download: null,
|
||||
duplicateCard_title: '카드 복제',
|
||||
edit: '편집',
|
||||
editColor_title: '색상 편집',
|
||||
|
||||
@@ -382,6 +382,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: 'Bewerken',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -392,6 +392,7 @@ export default {
|
||||
deleteUser_title: 'Usuń Użytkownika',
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Odrzuć wszystkie',
|
||||
download: null,
|
||||
duplicateCard_title: 'Duplikuj Kartę',
|
||||
edit: 'Edytuj',
|
||||
editColor_title: 'Edytuj Kolor',
|
||||
|
||||
@@ -404,6 +404,7 @@ export default {
|
||||
deleteUser_title: 'Excluir Usuário',
|
||||
deleteWebhook: 'Excluir webhook',
|
||||
dismissAll: 'Dispensar todos',
|
||||
download: null,
|
||||
duplicateCard_title: 'Duplicar Cartão',
|
||||
edit: 'Editar',
|
||||
editColor_title: 'Editar Cor',
|
||||
|
||||
@@ -383,6 +383,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: 'Editar',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -382,6 +382,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: 'Editați',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -396,6 +396,7 @@ export default {
|
||||
deleteUser_title: 'Удалить пользователя',
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Отклонить все',
|
||||
download: null,
|
||||
duplicateCard_title: 'Дублировать карточку',
|
||||
edit: 'Изменить',
|
||||
editColor_title: 'Изменить цвет',
|
||||
|
||||
@@ -381,6 +381,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: 'Upraviť',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -381,6 +381,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: 'Клонирај картицу',
|
||||
edit: 'Измени',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -378,6 +378,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: 'Kloniraj karticu',
|
||||
edit: 'Izmeni',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -380,6 +380,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: 'Avvisa alla',
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: 'Redigera',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -378,6 +378,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: 'Düzenle',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -398,6 +398,7 @@ export default {
|
||||
deleteUser_title: 'Видалити Користувача',
|
||||
deleteWebhook: 'Видалити вебхук',
|
||||
dismissAll: 'Скасувати всі',
|
||||
download: null,
|
||||
duplicateCard_title: 'Дублювати Картку',
|
||||
edit: 'Редагувати',
|
||||
editColor_title: 'Редагувати колір',
|
||||
|
||||
@@ -377,6 +377,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: 'Tahrirlash',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -379,6 +379,7 @@ export default {
|
||||
deleteUser_title: '删除用户',
|
||||
deleteWebhook: '删除Webhook',
|
||||
dismissAll: '全部忽略',
|
||||
download: null,
|
||||
duplicateCard_title: '复制卡片',
|
||||
edit: '编辑',
|
||||
editColor_title: '编辑颜色',
|
||||
|
||||
@@ -374,6 +374,7 @@ export default {
|
||||
deleteUser_title: null,
|
||||
deleteWebhook: null,
|
||||
dismissAll: null,
|
||||
download: null,
|
||||
duplicateCard_title: null,
|
||||
edit: '編輯',
|
||||
editColor_title: null,
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { attr, fk } from 'redux-orm';
|
||||
|
||||
import BaseModel from './BaseModel';
|
||||
import getFilenameAndExtension from '../utils/get-filename-and-extension';
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
import { AttachmentTypes } from '../constants/Enums';
|
||||
|
||||
@@ -14,10 +15,7 @@ const prepareAttachment = (attachment) => {
|
||||
return attachment;
|
||||
}
|
||||
|
||||
const filename = attachment.data.url.split('/').pop().toLowerCase();
|
||||
|
||||
let extension = filename.slice((Math.max(0, filename.lastIndexOf('.')) || Infinity) + 1);
|
||||
extension = extension ? extension.toLowerCase() : null;
|
||||
const { filename, extension } = getFilenameAndExtension(attachment.data.url);
|
||||
|
||||
return {
|
||||
...attachment,
|
||||
|
||||
16
client/src/utils/get-filename-and-extension.js
Normal file
16
client/src/utils/get-filename-and-extension.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
export default (url) => {
|
||||
const filename = url.split('/').pop().toLowerCase();
|
||||
|
||||
let extension = filename.slice((Math.max(0, filename.lastIndexOf('.')) || Infinity) + 1);
|
||||
extension = extension ? extension.toLowerCase() : null;
|
||||
|
||||
return {
|
||||
filename,
|
||||
extension,
|
||||
};
|
||||
};
|
||||
@@ -3,9 +3,9 @@
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
const LIMIT = 50;
|
||||
const buildSearchParts = require('../../../../utils/build-query-parts');
|
||||
|
||||
const SEARCH_PARTS_REGEX = /[ ,;]+/;
|
||||
const LIMIT = 50;
|
||||
|
||||
const defaultFind = (criteria, { sort = 'id', limit } = {}) =>
|
||||
Card.find(criteria).sort(sort).limit(limit);
|
||||
@@ -53,13 +53,7 @@ const getIdsByEndlessListId = async (
|
||||
queryValues.push(search.substring(1));
|
||||
query += ` AND (card.name ~* $${queryValues.length} OR card.description ~* $${queryValues.length})`;
|
||||
} else {
|
||||
const searchParts = search.split(SEARCH_PARTS_REGEX).flatMap((searchPart) => {
|
||||
if (!searchPart) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return searchPart.toLowerCase();
|
||||
});
|
||||
const searchParts = buildSearchParts(search);
|
||||
|
||||
if (searchParts.length > 0) {
|
||||
let ilikeValues = searchParts.map((searchPart) => {
|
||||
|
||||
17
server/utils/build-query-parts.js
Normal file
17
server/utils/build-query-parts.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/*!
|
||||
* Copyright (c) 2024 PLANKA Software GmbH
|
||||
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
|
||||
*/
|
||||
|
||||
const QUERY_PARTS_REGEX = /[ ,;]+/;
|
||||
|
||||
const buildQueryParts = (query) =>
|
||||
query.split(QUERY_PARTS_REGEX).flatMap((queryPart) => {
|
||||
if (!queryPart) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return queryPart.toLowerCase();
|
||||
});
|
||||
|
||||
module.exports = buildQueryParts;
|
||||
Reference in New Issue
Block a user