@ittinc/strapi-plugin-kanban-board 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/admin/custom.d.ts +2 -0
- package/admin/src/components/Initializer.tsx +19 -0
- package/admin/src/components/KanbanInput/index.tsx +605 -0
- package/admin/src/components/PluginIcon.tsx +5 -0
- package/admin/src/index.ts +136 -0
- package/admin/src/pages/App.tsx +15 -0
- package/admin/src/pages/HomePage.tsx +398 -0
- package/admin/src/pluginId.ts +1 -0
- package/admin/src/translations/en.json +5 -0
- package/admin/src/translations/ru.json +5 -0
- package/admin/src/utils/getTranslation.ts +5 -0
- package/admin/tsconfig.build.json +10 -0
- package/admin/tsconfig.json +8 -0
- package/dist/_chunks/App-BEiW65up.js +343 -0
- package/dist/_chunks/App-DXTlN9Fm.mjs +341 -0
- package/dist/_chunks/en-C0sbENwZ.js +8 -0
- package/dist/_chunks/en-CHHvJuav.mjs +8 -0
- package/dist/_chunks/index-9nQMm6ez.js +465 -0
- package/dist/_chunks/index-DI_QN_uF.mjs +463 -0
- package/dist/_chunks/ru-B7uE6tx_.mjs +8 -0
- package/dist/_chunks/ru-Bl2jLOwG.js +8 -0
- package/dist/admin/index.js +156 -0
- package/dist/admin/index.mjs +157 -0
- package/dist/admin/src/components/Initializer.d.ts +5 -0
- package/dist/admin/src/components/KanbanInput/index.d.ts +33 -0
- package/dist/admin/src/components/PluginIcon.d.ts +2 -0
- package/dist/admin/src/index.d.ts +10 -0
- package/dist/admin/src/pages/App.d.ts +2 -0
- package/dist/admin/src/pages/HomePage.d.ts +2 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/utils/getTranslation.d.ts +2 -0
- package/dist/server/index.js +73 -0
- package/dist/server/index.mjs +74 -0
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/config/index.d.ts +5 -0
- package/dist/server/src/content-types/index.d.ts +2 -0
- package/dist/server/src/controllers/controller.d.ts +7 -0
- package/dist/server/src/controllers/index.d.ts +2 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/index.d.ts +2 -0
- package/dist/server/src/middlewares/index.d.ts +2 -0
- package/dist/server/src/policies/index.d.ts +2 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/routes/admin/index.d.ts +5 -0
- package/dist/server/src/routes/content-api/index.d.ts +12 -0
- package/dist/server/src/routes/index.d.ts +18 -0
- package/dist/server/src/services/index.d.ts +2 -0
- package/dist/server/src/services/service.d.ts +7 -0
- package/package.json +101 -0
- package/server/src/bootstrap.ts +7 -0
- package/server/src/config/index.ts +4 -0
- package/server/src/content-types/index.ts +1 -0
- package/server/src/controllers/controller.ts +13 -0
- package/server/src/controllers/index.ts +5 -0
- package/server/src/destroy.ts +7 -0
- package/server/src/index.ts +30 -0
- package/server/src/middlewares/index.ts +1 -0
- package/server/src/policies/index.ts +1 -0
- package/server/src/register.ts +13 -0
- package/server/src/routes/admin/index.ts +4 -0
- package/server/src/routes/content-api/index.ts +14 -0
- package/server/src/routes/index.ts +9 -0
- package/server/src/services/index.ts +5 -0
- package/server/src/services/service.ts +9 -0
- package/server/tsconfig.build.json +10 -0
- package/server/tsconfig.json +8 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { getTranslation } from './utils/getTranslation';
|
|
2
|
+
import { PLUGIN_ID } from './pluginId';
|
|
3
|
+
import { Initializer } from './components/Initializer';
|
|
4
|
+
import { PluginIcon } from './components/PluginIcon';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
register(app: any) {
|
|
8
|
+
app.addMenuLink({
|
|
9
|
+
to: `plugins/${PLUGIN_ID}`,
|
|
10
|
+
icon: PluginIcon,
|
|
11
|
+
intlLabel: {
|
|
12
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
13
|
+
defaultMessage: PLUGIN_ID,
|
|
14
|
+
},
|
|
15
|
+
Component: async () => {
|
|
16
|
+
const { App } = await import('./pages/App');
|
|
17
|
+
|
|
18
|
+
return App;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
app.registerPlugin({
|
|
23
|
+
id: PLUGIN_ID,
|
|
24
|
+
initializer: Initializer,
|
|
25
|
+
isReady: false,
|
|
26
|
+
name: PLUGIN_ID,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
app.customFields.register({
|
|
30
|
+
name: 'kanban-board',
|
|
31
|
+
pluginId: PLUGIN_ID,
|
|
32
|
+
type: 'json',
|
|
33
|
+
intlLabel: {
|
|
34
|
+
id: `${PLUGIN_ID}.kanban-board.label`,
|
|
35
|
+
defaultMessage: 'Kanban Board',
|
|
36
|
+
},
|
|
37
|
+
intlDescription: {
|
|
38
|
+
id: `${PLUGIN_ID}.kanban-board.description`,
|
|
39
|
+
defaultMessage: 'Drag and drop items between columns',
|
|
40
|
+
},
|
|
41
|
+
icon: PluginIcon,
|
|
42
|
+
components: {
|
|
43
|
+
Input: async () => import('./components/KanbanInput').then((module) => ({
|
|
44
|
+
default: module.KanbanInput
|
|
45
|
+
})),
|
|
46
|
+
},
|
|
47
|
+
options: {
|
|
48
|
+
base: [
|
|
49
|
+
{
|
|
50
|
+
sectionTitle: {
|
|
51
|
+
id: 'kanban-plugin.section.settings',
|
|
52
|
+
defaultMessage: 'Board Configuration',
|
|
53
|
+
},
|
|
54
|
+
items: [
|
|
55
|
+
{
|
|
56
|
+
intlLabel: {
|
|
57
|
+
id: 'kanban-plugin.options.defaultColumns',
|
|
58
|
+
defaultMessage: 'Default Columns (JSON Array)',
|
|
59
|
+
},
|
|
60
|
+
intlDescription: {
|
|
61
|
+
id: 'kanban-plugin.options.defaultColumns.desc',
|
|
62
|
+
defaultMessage: 'e.g. ["To Do", "In Progress", "Done"]',
|
|
63
|
+
},
|
|
64
|
+
name: 'options.defaultColumns',
|
|
65
|
+
type: 'text',
|
|
66
|
+
defaultValue: '[{"code": "todo", "name": "To Do"}, {"code": "in-progress", "name": "In Progress"}, {"code": "done", "name": "Done"}]',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
intlLabel: {
|
|
70
|
+
id: 'kanban-plugin.options.itemSchema',
|
|
71
|
+
defaultMessage: 'Item Schema (JSON Array)',
|
|
72
|
+
},
|
|
73
|
+
intlDescription: {
|
|
74
|
+
id: 'kanban-plugin.options.itemSchema.desc',
|
|
75
|
+
defaultMessage: 'Define fields: [{"name": "title", "label": "Title", "type": "text", "required": true}]',
|
|
76
|
+
},
|
|
77
|
+
name: 'options.itemSchema',
|
|
78
|
+
type: 'text',
|
|
79
|
+
defaultValue: '[{"name": "title", "label": "Title", "type": "text", "required": true}, {"name": "subtitle", "label": "Subtitle", "type": "text"}]',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
sectionTitle: {
|
|
85
|
+
id: 'kanban-plugin.section.permissions',
|
|
86
|
+
defaultMessage: 'Permissions',
|
|
87
|
+
},
|
|
88
|
+
items: [
|
|
89
|
+
{
|
|
90
|
+
intlLabel: {
|
|
91
|
+
id: 'kanban-plugin.options.canAddColumns',
|
|
92
|
+
defaultMessage: 'Allow Adding Columns',
|
|
93
|
+
},
|
|
94
|
+
name: 'options.canAddColumns',
|
|
95
|
+
type: 'checkbox',
|
|
96
|
+
defaultValue: true,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
intlLabel: {
|
|
100
|
+
id: 'kanban-plugin.options.canDeleteColumns',
|
|
101
|
+
defaultMessage: 'Allow Deleting Columns',
|
|
102
|
+
},
|
|
103
|
+
name: 'options.canDeleteColumns',
|
|
104
|
+
type: 'checkbox',
|
|
105
|
+
defaultValue: true,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
intlLabel: {
|
|
109
|
+
id: 'kanban-plugin.options.canRenameColumns',
|
|
110
|
+
defaultMessage: 'Allow Renaming Columns',
|
|
111
|
+
},
|
|
112
|
+
name: 'options.canRenameColumns',
|
|
113
|
+
type: 'checkbox',
|
|
114
|
+
defaultValue: true,
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
async registerTrads({ locales }: { locales: string[] }) {
|
|
124
|
+
return Promise.all(
|
|
125
|
+
locales.map(async (locale) => {
|
|
126
|
+
try {
|
|
127
|
+
const { default: data } = await import(`./translations/${locale}.json`);
|
|
128
|
+
|
|
129
|
+
return { data, locale };
|
|
130
|
+
} catch {
|
|
131
|
+
return { data: {}, locale };
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
);
|
|
135
|
+
},
|
|
136
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Page } from '@strapi/strapi/admin';
|
|
2
|
+
import { Routes, Route } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
import { HomePage } from './HomePage';
|
|
5
|
+
|
|
6
|
+
const App = () => {
|
|
7
|
+
return (
|
|
8
|
+
<Routes>
|
|
9
|
+
<Route index element={<HomePage />} />
|
|
10
|
+
<Route path="*" element={<Page.Error />} />
|
|
11
|
+
</Routes>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { App };
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Main, Box, Typography, Flex, Button, TextInput } from '@strapi/design-system';
|
|
3
|
+
import { Plus, Pencil, Check, Trash } from '@strapi/icons';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
|
|
6
|
+
// --- Types ---
|
|
7
|
+
interface Item {
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
subtitle: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ColumnData {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
items: Item[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// --- Mock Initial Data ---
|
|
20
|
+
const initialData: ColumnData[] = [
|
|
21
|
+
{
|
|
22
|
+
id: 'col-1',
|
|
23
|
+
title: 'To Do',
|
|
24
|
+
items: [
|
|
25
|
+
{ id: '1', title: 'Research Plugins', subtitle: 'Read Strapi v5 docs' },
|
|
26
|
+
{ id: '2', title: 'Setup Environment', subtitle: 'Install dependencies' },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'col-2',
|
|
31
|
+
title: 'In Progress',
|
|
32
|
+
items: [
|
|
33
|
+
{ id: '3', title: 'Develop Feature', subtitle: 'Implement Drag & Drop' },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'col-3',
|
|
38
|
+
title: 'Done',
|
|
39
|
+
items: [
|
|
40
|
+
{ id: '4', title: 'Initialize Project', subtitle: 'Run CLI commands' },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
// --- Styled Components ---
|
|
46
|
+
|
|
47
|
+
const BoardContainer = styled(Flex)`
|
|
48
|
+
gap: 16px;
|
|
49
|
+
padding: 24px;
|
|
50
|
+
height: 100%;
|
|
51
|
+
align-items: flex-start;
|
|
52
|
+
overflow-x: auto;
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
const ColumnContainer = styled(Box)`
|
|
56
|
+
background: ${({ theme }) => theme.colors.neutral100};
|
|
57
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
58
|
+
border-radius: ${({ theme }) => theme.borderRadius};
|
|
59
|
+
min-width: 300px;
|
|
60
|
+
width: 300px;
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
max-height: 100%;
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
const ColumnHeader = styled(Flex)`
|
|
68
|
+
padding: 16px;
|
|
69
|
+
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
70
|
+
background: ${({ theme }) => theme.colors.neutral150};
|
|
71
|
+
border-top-left-radius: ${({ theme }) => theme.borderRadius};
|
|
72
|
+
border-top-right-radius: ${({ theme }) => theme.borderRadius};
|
|
73
|
+
justify-content: space-between;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 8px;
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
const ItemList = styled(Box)<{ $isDraggingOver: boolean }>`
|
|
79
|
+
padding: 16px;
|
|
80
|
+
flex-grow: 1;
|
|
81
|
+
min-height: 100px;
|
|
82
|
+
background: ${({ theme, $isDraggingOver }) =>
|
|
83
|
+
$isDraggingOver ? theme.colors.primary100 : 'transparent'};
|
|
84
|
+
transition: background 0.2s;
|
|
85
|
+
overflow-y: auto;
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
const CardItem = styled(Box)<{ $isDragging: boolean }>`
|
|
89
|
+
background: ${({ theme }) => theme.colors.neutral0};
|
|
90
|
+
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
91
|
+
border-radius: ${({ theme }) => theme.borderRadius};
|
|
92
|
+
padding: 12px;
|
|
93
|
+
margin-bottom: 8px;
|
|
94
|
+
box-shadow: ${({ theme }) => theme.shadows.filterShadow};
|
|
95
|
+
cursor: grab;
|
|
96
|
+
opacity: ${({ $isDragging }) => ($isDragging ? 0.5 : 1)};
|
|
97
|
+
|
|
98
|
+
&:hover {
|
|
99
|
+
border-color: ${({ theme }) => theme.colors.primary500};
|
|
100
|
+
box-shadow: ${({ theme }) => theme.shadows.tableShadow};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:active {
|
|
104
|
+
cursor: grabbing;
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
|
|
108
|
+
const ScrollableMain = styled(Main)`
|
|
109
|
+
height: 100vh;
|
|
110
|
+
overflow-y: hidden;
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
`;
|
|
114
|
+
|
|
115
|
+
// --- Components ---
|
|
116
|
+
|
|
117
|
+
const HomePage = () => {
|
|
118
|
+
const [columns, setColumns] = useState<ColumnData[]>(initialData);
|
|
119
|
+
const [draggedItem, setDraggedItem] = useState<{ itemId: string; sourceColId: string } | null>(null);
|
|
120
|
+
const [dragOverColId, setDragOverColId] = useState<string | null>(null);
|
|
121
|
+
|
|
122
|
+
// State for renaming columns
|
|
123
|
+
const [editingColId, setEditingColId] = useState<string | null>(null);
|
|
124
|
+
const [tempColTitle, setTempColTitle] = useState<string>('');
|
|
125
|
+
|
|
126
|
+
// State for editing items
|
|
127
|
+
const [editingItemId, setEditingItemId] = useState<string | null>(null);
|
|
128
|
+
const [tempItemTitle, setTempItemTitle] = useState<string>('');
|
|
129
|
+
const [tempItemSubtitle, setTempItemSubtitle] = useState<string>('');
|
|
130
|
+
|
|
131
|
+
const handleDragStart = (e: React.DragEvent, itemId: string, sourceColId: string) => {
|
|
132
|
+
setDraggedItem({ itemId, sourceColId });
|
|
133
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const handleDragOver = (e: React.DragEvent, colId: string) => {
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
setDragOverColId(colId);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const handleDragLeave = () => {
|
|
142
|
+
setDragOverColId(null);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const handleDrop = (e: React.DragEvent, targetColId: string) => {
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
setDragOverColId(null);
|
|
148
|
+
|
|
149
|
+
if (!draggedItem) return;
|
|
150
|
+
const { itemId, sourceColId } = draggedItem;
|
|
151
|
+
|
|
152
|
+
if (sourceColId === targetColId) {
|
|
153
|
+
setDraggedItem(null);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const newColumns = columns.map((col) => {
|
|
158
|
+
// Remove from source
|
|
159
|
+
if (col.id === sourceColId) {
|
|
160
|
+
return {
|
|
161
|
+
...col,
|
|
162
|
+
items: col.items.filter((item) => item.id !== itemId),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
// Add to target
|
|
166
|
+
if (col.id === targetColId) {
|
|
167
|
+
const itemToMove = columns
|
|
168
|
+
.find((c) => c.id === sourceColId)
|
|
169
|
+
?.items.find((i) => i.id === itemId);
|
|
170
|
+
|
|
171
|
+
if (itemToMove) {
|
|
172
|
+
return {
|
|
173
|
+
...col,
|
|
174
|
+
items: [...col.items, itemToMove],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return col;
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
setColumns(newColumns);
|
|
182
|
+
setDraggedItem(null);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
// --- Column Management ---
|
|
186
|
+
|
|
187
|
+
const handleAddColumn = () => {
|
|
188
|
+
const newCol: ColumnData = {
|
|
189
|
+
id: `col-${Date.now()}`,
|
|
190
|
+
title: 'New Column',
|
|
191
|
+
items: [],
|
|
192
|
+
};
|
|
193
|
+
setColumns([...columns, newCol]);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const handleStartRename = (col: ColumnData) => {
|
|
197
|
+
setEditingColId(col.id);
|
|
198
|
+
setTempColTitle(col.title);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const handleSaveRename = (colId: string) => {
|
|
202
|
+
if (!tempColTitle.trim()) return;
|
|
203
|
+
|
|
204
|
+
setColumns(columns.map(col =>
|
|
205
|
+
col.id === colId ? { ...col, title: tempColTitle } : col
|
|
206
|
+
));
|
|
207
|
+
setEditingColId(null);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const handleDeleteColumn = (colId: string) => {
|
|
211
|
+
// eslint-disable-next-line no-restricted-globals
|
|
212
|
+
if (confirm('Are you sure you want to delete this column?')) {
|
|
213
|
+
setColumns(columns.filter(col => col.id !== colId));
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// --- Item Management ---
|
|
218
|
+
|
|
219
|
+
const handleStartEditItem = (item: Item) => {
|
|
220
|
+
setEditingItemId(item.id);
|
|
221
|
+
setTempItemTitle(item.title);
|
|
222
|
+
setTempItemSubtitle(item.subtitle);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const handleSaveEditItem = (colId: string, itemId: string) => {
|
|
226
|
+
if (!tempItemTitle.trim()) return;
|
|
227
|
+
|
|
228
|
+
setColumns(columns.map(col => {
|
|
229
|
+
if (col.id === colId) {
|
|
230
|
+
return {
|
|
231
|
+
...col,
|
|
232
|
+
items: col.items.map(item =>
|
|
233
|
+
item.id === itemId
|
|
234
|
+
? { ...item, title: tempItemTitle, subtitle: tempItemSubtitle }
|
|
235
|
+
: item
|
|
236
|
+
),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return col;
|
|
240
|
+
}));
|
|
241
|
+
setEditingItemId(null);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const handleDeleteItem = (colId: string, itemId: string) => {
|
|
245
|
+
// eslint-disable-next-line no-restricted-globals
|
|
246
|
+
if (confirm('Are you sure you want to delete this item?')) {
|
|
247
|
+
setColumns(columns.map(col => {
|
|
248
|
+
if (col.id === colId) {
|
|
249
|
+
return {
|
|
250
|
+
...col,
|
|
251
|
+
items: col.items.filter(item => item.id !== itemId)
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
return col;
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
return (
|
|
260
|
+
<>
|
|
261
|
+
<ScrollableMain>
|
|
262
|
+
<Box padding={8} background="neutral100">
|
|
263
|
+
<Flex justifyContent="space-between" alignItems="center">
|
|
264
|
+
<Box>
|
|
265
|
+
<Typography variant="alpha">Kanban Board</Typography>
|
|
266
|
+
<Typography variant="epsilon" textColor="neutral600" as="div">
|
|
267
|
+
Manage your project tasks visually
|
|
268
|
+
</Typography>
|
|
269
|
+
</Box>
|
|
270
|
+
<Button startIcon={<Plus />} onClick={handleAddColumn}>
|
|
271
|
+
Add Column
|
|
272
|
+
</Button>
|
|
273
|
+
</Flex>
|
|
274
|
+
</Box>
|
|
275
|
+
|
|
276
|
+
<BoardContainer>
|
|
277
|
+
{columns.map((col) => (
|
|
278
|
+
<ColumnContainer key={col.id}>
|
|
279
|
+
<ColumnHeader>
|
|
280
|
+
{editingColId === col.id ? (
|
|
281
|
+
<Flex gap={2} style={{ flexGrow: 1 }}>
|
|
282
|
+
<TextInput
|
|
283
|
+
aria-label="Column title"
|
|
284
|
+
value={tempColTitle}
|
|
285
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setTempColTitle(e.target.value)}
|
|
286
|
+
size="S"
|
|
287
|
+
/>
|
|
288
|
+
<Button
|
|
289
|
+
onClick={() => handleSaveRename(col.id)}
|
|
290
|
+
size="S"
|
|
291
|
+
startIcon={<Check />}
|
|
292
|
+
>
|
|
293
|
+
Save
|
|
294
|
+
</Button>
|
|
295
|
+
</Flex>
|
|
296
|
+
) : (
|
|
297
|
+
<>
|
|
298
|
+
<Box>
|
|
299
|
+
<Typography variant="delta" fontWeight="bold">
|
|
300
|
+
{col.title}
|
|
301
|
+
</Typography>
|
|
302
|
+
<Typography variant="pi" textColor="neutral600" style={{ marginLeft: '8px' }}>
|
|
303
|
+
({col.items.length})
|
|
304
|
+
</Typography>
|
|
305
|
+
</Box>
|
|
306
|
+
<Flex gap={1}>
|
|
307
|
+
<Button
|
|
308
|
+
onClick={() => handleStartRename(col)}
|
|
309
|
+
variant="ghost"
|
|
310
|
+
size="S"
|
|
311
|
+
startIcon={<Pencil />}
|
|
312
|
+
/>
|
|
313
|
+
<Button
|
|
314
|
+
onClick={() => handleDeleteColumn(col.id)}
|
|
315
|
+
variant="ghost"
|
|
316
|
+
size="S"
|
|
317
|
+
startIcon={<Trash />}
|
|
318
|
+
/>
|
|
319
|
+
</Flex>
|
|
320
|
+
</>
|
|
321
|
+
)}
|
|
322
|
+
</ColumnHeader>
|
|
323
|
+
|
|
324
|
+
<ItemList
|
|
325
|
+
$isDraggingOver={dragOverColId === col.id}
|
|
326
|
+
onDragOver={(e: React.DragEvent) => handleDragOver(e, col.id)}
|
|
327
|
+
onDragLeave={handleDragLeave}
|
|
328
|
+
onDrop={(e: React.DragEvent) => handleDrop(e, col.id)}
|
|
329
|
+
>
|
|
330
|
+
{col.items.map((item) => (
|
|
331
|
+
<CardItem
|
|
332
|
+
key={item.id}
|
|
333
|
+
draggable={editingItemId !== item.id}
|
|
334
|
+
onDragStart={(e: React.DragEvent) => handleDragStart(e, item.id, col.id)}
|
|
335
|
+
$isDragging={draggedItem?.itemId === item.id}
|
|
336
|
+
>
|
|
337
|
+
{editingItemId === item.id ? (
|
|
338
|
+
<Flex direction="column" gap={2}>
|
|
339
|
+
<TextInput
|
|
340
|
+
aria-label="Item title"
|
|
341
|
+
value={tempItemTitle}
|
|
342
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setTempItemTitle(e.target.value)}
|
|
343
|
+
size="S"
|
|
344
|
+
/>
|
|
345
|
+
<TextInput
|
|
346
|
+
aria-label="Item subtitle"
|
|
347
|
+
value={tempItemSubtitle}
|
|
348
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setTempItemSubtitle(e.target.value)}
|
|
349
|
+
size="S"
|
|
350
|
+
/>
|
|
351
|
+
<Flex gap={2} justifyContent="flex-end" style={{ width: '100%' }}>
|
|
352
|
+
<Button
|
|
353
|
+
onClick={() => handleSaveEditItem(col.id, item.id)}
|
|
354
|
+
size="S"
|
|
355
|
+
startIcon={<Check />}
|
|
356
|
+
>
|
|
357
|
+
Save
|
|
358
|
+
</Button>
|
|
359
|
+
</Flex>
|
|
360
|
+
</Flex>
|
|
361
|
+
) : (
|
|
362
|
+
<Flex justifyContent="space-between" alignItems="start">
|
|
363
|
+
<Box>
|
|
364
|
+
<Typography variant="omega" fontWeight="bold" as="div" marginBottom={1}>
|
|
365
|
+
{item.title}
|
|
366
|
+
</Typography>
|
|
367
|
+
<Typography variant="pi" textColor="neutral600" as="div">
|
|
368
|
+
{item.subtitle}
|
|
369
|
+
</Typography>
|
|
370
|
+
</Box>
|
|
371
|
+
<Flex gap={1} style={{ opacity: 0.5 }}>
|
|
372
|
+
<Button
|
|
373
|
+
onClick={() => handleStartEditItem(item)}
|
|
374
|
+
variant="ghost"
|
|
375
|
+
size="S"
|
|
376
|
+
startIcon={<Pencil />}
|
|
377
|
+
/>
|
|
378
|
+
<Button
|
|
379
|
+
onClick={() => handleDeleteItem(col.id, item.id)}
|
|
380
|
+
variant="ghost"
|
|
381
|
+
size="S"
|
|
382
|
+
startIcon={<Trash />}
|
|
383
|
+
/>
|
|
384
|
+
</Flex>
|
|
385
|
+
</Flex>
|
|
386
|
+
)}
|
|
387
|
+
</CardItem>
|
|
388
|
+
))}
|
|
389
|
+
</ItemList>
|
|
390
|
+
</ColumnContainer>
|
|
391
|
+
))}
|
|
392
|
+
</BoardContainer>
|
|
393
|
+
</ScrollableMain>
|
|
394
|
+
</>
|
|
395
|
+
);
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
export { HomePage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PLUGIN_ID = 'kanban-board';
|