seat-editor 1.4.21 → 1.4.23

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.
Files changed (56) hide show
  1. package/dist/app/layout.d.ts +1 -1
  2. package/dist/app/new-board/page.d.ts +1 -1
  3. package/dist/app/old-board/page.d.ts +2 -1
  4. package/dist/app/only-view/page.d.ts +1 -1
  5. package/dist/app/page.d.ts +1 -1
  6. package/dist/components/button-tools/index.d.ts +1 -1
  7. package/dist/components/form-tools/label.d.ts +1 -1
  8. package/dist/components/form-tools/shape.d.ts +1 -1
  9. package/dist/components/input/number-indicator.d.ts +1 -1
  10. package/dist/components/joystick/index.d.ts +2 -1
  11. package/dist/components/layer/index.d.ts +1 -1
  12. package/dist/components/lib/index.d.ts +1 -1
  13. package/dist/components/modal-preview/index.d.ts +1 -1
  14. package/dist/features/board/index.d.ts +1 -1
  15. package/dist/features/navbar/index.d.ts +1 -1
  16. package/dist/features/package/index.d.ts +1 -1
  17. package/dist/features/package/index.jsx +12 -5
  18. package/dist/features/panel/index.d.ts +1 -1
  19. package/dist/features/panel/select-tool.d.ts +1 -1
  20. package/dist/features/panel/square-circle-tool.d.ts +1 -1
  21. package/dist/features/panel/table-seat-circle.d.ts +1 -1
  22. package/dist/features/panel/text-tool.d.ts +1 -1
  23. package/dist/features/panel/upload-tool.d.ts +1 -1
  24. package/dist/features/side-tool/index.d.ts +1 -1
  25. package/dist/features/view/index.d.ts +1 -1
  26. package/dist/features/view/index.jsx +1 -1
  27. package/dist/provider/redux-provider.d.ts +1 -1
  28. package/dist/provider/store-provider.d.ts +1 -1
  29. package/package.json +1 -1
  30. package/dist/app/layout.js +0 -22
  31. package/dist/app/new-board/page.js +0 -30
  32. package/dist/app/old-board/page.js +0 -377
  33. package/dist/app/only-view/page.js +0 -41
  34. package/dist/app/page.js +0 -8
  35. package/dist/components/button-tools/index.js +0 -11
  36. package/dist/components/form-tools/label.js +0 -7
  37. package/dist/components/form-tools/shape.js +0 -25
  38. package/dist/components/input/number-indicator.js +0 -27
  39. package/dist/components/joystick/index.js +0 -48
  40. package/dist/components/layer/index.js +0 -276
  41. package/dist/components/lib/index.js +0 -28
  42. package/dist/components/modal-preview/index.js +0 -10
  43. package/dist/features/board/index.js +0 -626
  44. package/dist/features/navbar/index.js +0 -6
  45. package/dist/features/package/index.js +0 -102
  46. package/dist/features/panel/index.js +0 -97
  47. package/dist/features/panel/select-tool.js +0 -44
  48. package/dist/features/panel/square-circle-tool.js +0 -8
  49. package/dist/features/panel/table-seat-circle.js +0 -9
  50. package/dist/features/panel/text-tool.js +0 -7
  51. package/dist/features/panel/upload-tool.js +0 -155
  52. package/dist/features/side-tool/index.js +0 -244
  53. package/dist/features/view/index.js +0 -213
  54. package/dist/provider/antd-provider.js +0 -43
  55. package/dist/provider/redux-provider.js +0 -7
  56. package/dist/provider/store-provider.js +0 -9
@@ -1,377 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { Button, Input, Modal } from "antd"; //tes commit
5
- // aduhuhhusd
6
- import { Square, MousePointer2, Move3D, Trash, CopyPlusIcon, ZoomInIcon, ZoomOutIcon, DownloadIcon, UploadIcon, Circle, PenIcon, Pencil, } from "lucide-react";
7
- import { SketchPicker } from "react-color";
8
- const SeatEditor = () => {
9
- var _a, _b;
10
- const [activeTool, setActiveTool] = useState(null);
11
- const [rectangles, setRectangles] = useState([]);
12
- const [selectedRectangle, setSelectedRectangle] = useState(null);
13
- const [isDragging, setIsDragging] = useState(false);
14
- const [startPoint, setStartPoint] = useState(null);
15
- const [shadowRect, setShadowRect] = useState(null);
16
- const [showModal, setShowModal] = useState(false);
17
- const [dragOffset, setDragOffset] = useState(null);
18
- const [zoom, setZoom] = useState(1);
19
- const [resizeDirection, setResizeDirection] = useState(null);
20
- const [images, setImages] = useState([]);
21
- const [penPaths, setPenPaths] = useState([]);
22
- const [currentPath, setCurrentPath] = useState(null);
23
- const [isDrawing, setIsDrawing] = useState(false);
24
- // upload image
25
- const widthWorkspace = ((_a = document.getElementById("workspace")) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0;
26
- const heightWorkspace = ((_b = document.getElementById("workspace")) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0;
27
- const handleImageUploadBackground = (e) => {
28
- var _a;
29
- const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
30
- if (!file)
31
- return;
32
- const reader = new FileReader();
33
- reader.onload = () => {
34
- const img = document.createElement("img");
35
- img.src = reader.result;
36
- let width = img.width > widthWorkspace ? img.width / 2 : img.width;
37
- let height = img.height > heightWorkspace ? img.height / 2 : img.height;
38
- img.onload = () => {
39
- setRectangles((prev) => [
40
- ...prev,
41
- {
42
- id: rectangles.length + 1,
43
- x: 100,
44
- y: 100,
45
- width: width < 1 ? 100 : width,
46
- height: height < 1 ? 100 : height,
47
- rotation: 0,
48
- shape: "image",
49
- src: img.src,
50
- },
51
- ]);
52
- };
53
- };
54
- reader.readAsDataURL(file);
55
- };
56
- const handleImageUpload = (e) => {
57
- var _a;
58
- const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
59
- if (!file)
60
- return;
61
- const reader = new FileReader();
62
- reader.onload = () => {
63
- const img = document.createElement("img");
64
- img.src = reader.result;
65
- let width = img.width > widthWorkspace ? img.width / 2 : img.width;
66
- let height = img.height > heightWorkspace ? img.height / 2 : img.height;
67
- img.onload = () => {
68
- setRectangles((prev) => [
69
- ...prev,
70
- {
71
- id: rectangles.length + 1,
72
- x: 100,
73
- y: 100,
74
- width: width < 1 ? 100 : width,
75
- height: height < 1 ? 100 : height,
76
- rotation: 0,
77
- shape: "image-table",
78
- src: img.src,
79
- pax: "4 Pax",
80
- highlightColor: "#C1443D",
81
- status: "SOLD",
82
- table: `V${rectangles.length + 1}`,
83
- },
84
- ]);
85
- };
86
- };
87
- reader.readAsDataURL(file);
88
- };
89
- // zoom in out
90
- const zoomIn = () => setZoom((prev) => prev + 0.1);
91
- const zoomOut = () => setZoom((prev) => Math.max(0.1, prev - 0.1));
92
- const handleToolClick = (tool) => {
93
- setActiveTool(tool);
94
- setSelectedRectangle(null); // Deselect any rectangle when switching tools
95
- };
96
- // === Drawing Rectangle ===
97
- const handleMouseDown = (e) => {
98
- if (activeTool === "rectangle" ||
99
- activeTool === "circle" ||
100
- activeTool === "vip-seat") {
101
- const rect = e.target.getBoundingClientRect();
102
- setStartPoint({ x: e.clientX - rect.left, y: e.clientY - rect.top });
103
- setIsDragging(true);
104
- }
105
- if (activeTool === "pen") {
106
- const rect = e.target.getBoundingClientRect();
107
- const newPoint = { x: e.clientX - rect.left, y: e.clientY - rect.top };
108
- setCurrentPath({
109
- id: penPaths.length + 1,
110
- points: [newPoint],
111
- color: "#fff", // Default white stroke
112
- strokeWidth: 2, // Default stroke width
113
- });
114
- setIsDrawing(true);
115
- }
116
- };
117
- // rotate logic
118
- const rotateRectangle = (direction) => {
119
- if (selectedRectangle) {
120
- const rotationChange = direction === "left" ? -5 : 5; // Rotate 5 degrees
121
- const newRotation = (selectedRectangle.rotation + rotationChange) % 360;
122
- setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id
123
- ? Object.assign(Object.assign({}, rect), { rotation: newRotation }) : rect));
124
- setSelectedRectangle((prev) => prev ? Object.assign(Object.assign({}, prev), { rotation: newRotation }) : null);
125
- }
126
- };
127
- const handleMouseMove = (e) => {
128
- // Resize logic for node tool
129
- if (activeTool === "node" &&
130
- isDragging &&
131
- resizeDirection &&
132
- selectedRectangle) {
133
- const workspaceRect = e.currentTarget.getBoundingClientRect();
134
- const currentX = e.clientX - workspaceRect.left;
135
- const currentY = e.clientY - workspaceRect.top;
136
- let newRect = Object.assign({}, selectedRectangle);
137
- switch (resizeDirection) {
138
- case "top-left":
139
- newRect.width += newRect.x - currentX;
140
- newRect.height =
141
- selectedRectangle.shape === "circle"
142
- ? newRect.width
143
- : newRect.height + (newRect.y - currentY);
144
- newRect.x = currentX;
145
- newRect.y =
146
- selectedRectangle.shape === "circle" ? newRect.y : currentY;
147
- break;
148
- case "top-right":
149
- newRect.width = currentX - newRect.x;
150
- newRect.height =
151
- selectedRectangle.shape === "circle"
152
- ? newRect.width
153
- : newRect.height + (newRect.y - currentY);
154
- newRect.y =
155
- selectedRectangle.shape === "circle" ? newRect.y : currentY;
156
- break;
157
- case "bottom-left":
158
- newRect.width += newRect.x - currentX;
159
- newRect.height =
160
- selectedRectangle.shape === "circle"
161
- ? newRect.width
162
- : currentY - newRect.y;
163
- newRect.x = currentX;
164
- break;
165
- case "bottom-right":
166
- newRect.width = currentX - newRect.x;
167
- newRect.height =
168
- selectedRectangle.shape === "circle"
169
- ? newRect.width
170
- : currentY - newRect.y;
171
- break;
172
- }
173
- // Ensure width and height are always positive
174
- newRect.width = Math.max(10, newRect.width);
175
- newRect.height = Math.max(10, newRect.height);
176
- setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id ? Object.assign({}, newRect) : rect));
177
- setSelectedRectangle(newRect);
178
- }
179
- if ((activeTool === "rectangle" ||
180
- activeTool === "circle" ||
181
- activeTool === "vip-seat") &&
182
- isDragging &&
183
- startPoint) {
184
- const rect = e.target.getBoundingClientRect();
185
- const currentX = e.clientX - rect.left;
186
- const currentY = e.clientY - rect.top;
187
- // Update shadow rectangle dimensions dynamically
188
- const newShadowRect = {
189
- id: -1, // Temporary ID for preview
190
- x: Math.min(startPoint.x, currentX),
191
- y: Math.min(startPoint.y, currentY),
192
- width: Math.abs(currentX - startPoint.x),
193
- height: Math.abs(currentY - startPoint.y),
194
- color: activeTool === "vip-seat" ? "#2D2D36" : "rgba(74, 144, 226, 0.4)", // Light blue with transparency
195
- pax: "",
196
- rotation: 0,
197
- shape: activeTool === "vip-seat" ? "vip-seat" : activeTool, // Define shape type
198
- highlightColor: activeTool === "vip-seat" ? "#C1443D" : undefined, // Red section in VIP
199
- status: activeTool === "vip-seat" ? "SOLD" : undefined,
200
- table: activeTool === "vip-seat" ? `V${rectangles.length + 1}` : undefined, // Table number for VIP
201
- };
202
- setShadowRect(newShadowRect);
203
- }
204
- // Dragging for select tool
205
- if (activeTool === "select" &&
206
- isDragging &&
207
- selectedRectangle &&
208
- dragOffset) {
209
- const workspaceRect = e.currentTarget.getBoundingClientRect();
210
- const newX = e.clientX - workspaceRect.left - dragOffset.x;
211
- const newY = e.clientY - workspaceRect.top - dragOffset.y;
212
- setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id
213
- ? Object.assign(Object.assign({}, rect), { x: newX, y: newY }) : rect));
214
- }
215
- };
216
- const handleMouseUp = () => {
217
- setIsDragging(false);
218
- setResizeDirection(null);
219
- if ((activeTool === "rectangle" ||
220
- activeTool === "circle" ||
221
- activeTool === "vip-seat") &&
222
- isDragging &&
223
- shadowRect) {
224
- // Finalize the rectangle on mouse release
225
- const newRectangle = Object.assign(Object.assign({}, shadowRect), { id: rectangles.length + 1, color: "#4A90E2", pax: activeTool === "vip-seat" ? "4 Pax" : "Seat", highlightColor: activeTool === "vip-seat" ? "#C1443D" : undefined, status: activeTool === "vip-seat" ? "SOLD" : undefined, table: activeTool === "vip-seat" ? "V1" : undefined });
226
- setRectangles([...rectangles, newRectangle]);
227
- setImages((prev) => prev.map((img) => img.id === (selectedRectangle === null || selectedRectangle === void 0 ? void 0 : selectedRectangle.id)
228
- ? Object.assign(Object.assign({}, img), { x: newRectangle.x, y: newRectangle.y }) : img));
229
- setShadowRect(null); // Clear shadow preview
230
- setIsDragging(false);
231
- setStartPoint(null);
232
- }
233
- };
234
- const handleRectangleMouseDown = (e, rect) => {
235
- if (activeTool === "select" || activeTool === "node") {
236
- setSelectedRectangle(rect);
237
- const rectBox = e.target.getBoundingClientRect();
238
- setDragOffset({
239
- x: e.clientX - rectBox.left,
240
- y: e.clientY - rectBox.top,
241
- });
242
- setIsDragging(true);
243
- }
244
- };
245
- const handleRectangleDoubleClick = (rect) => {
246
- if (activeTool === "select" || activeTool === "node") {
247
- setSelectedRectangle(rect);
248
- setShowModal(true);
249
- }
250
- };
251
- const updateRectangle = (updates) => {
252
- if (selectedRectangle) {
253
- setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id ? Object.assign(Object.assign({}, rect), updates) : rect));
254
- setSelectedRectangle((prev) => (prev ? Object.assign(Object.assign({}, prev), updates) : null));
255
- }
256
- };
257
- const startResizing = (direction) => {
258
- setResizeDirection(direction);
259
- setIsDragging(true);
260
- };
261
- // Set the cursor style based on the active tool
262
- const getCursorStyle = () => {
263
- if (activeTool === "rectangle" ||
264
- activeTool === "circle" ||
265
- activeTool === "vip-seat")
266
- return "cursor-crosshair";
267
- if (activeTool === "select")
268
- return "cursor-default";
269
- if (activeTool === "node")
270
- return "cursor-pointer";
271
- return "cursor-default";
272
- };
273
- const deleteSelectedRectangle = () => {
274
- if (selectedRectangle) {
275
- setRectangles((prev) => prev.filter((rect) => rect.id !== selectedRectangle.id));
276
- setSelectedRectangle(null);
277
- }
278
- };
279
- // duplicate
280
- const duplicateRectangle = () => {
281
- if (selectedRectangle) {
282
- const newRectangle = Object.assign(Object.assign({}, selectedRectangle), { id: rectangles.length + 1, x: selectedRectangle.x + 20, y: selectedRectangle.y + 20 });
283
- setRectangles([...rectangles, newRectangle]);
284
- }
285
- };
286
- const exportJSON = () => {
287
- // const json = JSON.stringify(rectangles, null, 2);
288
- // const blob = new Blob([json], { type: "application/json" });
289
- // const link = document.createElement("a");
290
- // link.href = URL.createObjectURL(blob);
291
- // link.download = "seat_layout.json";
292
- // document.body.appendChild(link);
293
- // link.click();
294
- // document.body.removeChild(link);
295
- };
296
- return (_jsxs("div", { className: "flex h-screen w-full", children: [_jsxs("div", { className: "w-16 bg-gray-800 text-white flex flex-col items-center py-4 space-y-4", children: [_jsx(Button, { type: activeTool === "select" ? "primary" : "default", shape: "circle", icon: _jsx(MousePointer2, {}), onClick: () => handleToolClick("select") }), _jsx(Button, { type: activeTool === "circle" ? "primary" : "default", shape: "circle", icon: _jsx(Circle, {}), onClick: () => handleToolClick("circle") }), _jsx(Button, { type: activeTool === "vip-seat" ? "primary" : "default", shape: "circle", icon: _jsx(PenIcon, {}), onClick: () => handleToolClick("vip-seat") }), _jsx(Button, { type: activeTool === "rectangle" ? "primary" : "default", shape: "circle", icon: _jsx(Square, {}), onClick: () => handleToolClick("rectangle") }), _jsx(Button, { type: activeTool === "node" ? "primary" : "default", shape: "circle", icon: _jsx(Move3D, {}), onClick: () => handleToolClick("node") }), _jsx(Button, { type: activeTool === "pen" ? "primary" : "default", shape: "circle", icon: _jsx(Pencil, {}), onClick: () => handleToolClick("pen") }), _jsx(Button, { type: "default", shape: "circle", icon: _jsx(Trash, {}), onClick: deleteSelectedRectangle }), _jsx(Button, { type: "default", shape: "circle", icon: _jsx(CopyPlusIcon, {}), onClick: duplicateRectangle }), _jsx(Button, { type: "default", shape: "circle", onClick: zoomIn, icon: _jsx(ZoomInIcon, {}) }), _jsx(Button, { type: "default", shape: "circle", onClick: zoomOut, icon: _jsx(ZoomOutIcon, {}) }), _jsx(UploadIcon, {}), _jsx("span", { children: "Image Seat" }), _jsx("input", { type: "file", accept: "image/*", onChange: handleImageUpload }), _jsx("span", { children: "Background Image" }), _jsx("input", { type: "file", accept: "image/*", onChange: handleImageUploadBackground }), _jsx(Button, { shape: "circle", icon: _jsx(DownloadIcon, {}), onClick: exportJSON })] }), _jsx("div", { className: "w-full flex items-center justify-center", id: "workspace", children: _jsxs("div", { className: `bg-gray-900 relative ${getCursorStyle()} w-full h-screen `, onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, style: {
297
- transform: `scale(${zoom})`,
298
- transformOrigin: "0 0",
299
- }, children: [shadowRect && (_jsx("div", { className: "absolute border-dashed border-2 border-blue-400", style: {
300
- left: shadowRect.x,
301
- top: shadowRect.y,
302
- width: shadowRect.width,
303
- height: shadowRect.height,
304
- backgroundColor: shadowRect.color,
305
- } })), rectangles.map((rect) => (_jsxs("div", { onMouseDown: (e) => handleRectangleMouseDown(e, rect), onDoubleClick: () => handleRectangleDoubleClick(rect), className: `absolute cursor-move border transition-transform ${(selectedRectangle === null || selectedRectangle === void 0 ? void 0 : selectedRectangle.id) === rect.id
306
- ? "border-black"
307
- : "border-gray-300"}`, style: {
308
- left: rect.x,
309
- top: rect.y,
310
- width: rect.width,
311
- height: rect.height,
312
- backgroundColor: rect.color,
313
- transform: `rotate(${rect.rotation}deg)`,
314
- transformOrigin: "center",
315
- borderRadius: rect.shape === "circle" ? "100%" : "0%",
316
- }, children: [rect.shape === "image-table" && (_jsxs("div", { className: "w-full h-full relative", children: [_jsx("img", { src: rect.src, alt: "custom", className: "w-full h-full object-cover", draggable: false }), _jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
317
- top: "10%",
318
- height: "20%",
319
- backgroundColor: rect.highlightColor || "transparent",
320
- }, children: _jsx("span", { className: "text-white font-bold text-xs absolute", style: {
321
- top: "10%",
322
- left: "50%",
323
- }, children: rect.table }) }), _jsx("span", { className: "text-xs text-white flex items-center justify-center absolute w-full", style: {
324
- top: "85%",
325
- left: "50%",
326
- transform: "translate(-50%, -50%)",
327
- backgroundColor: rect.highlightColor || "transparent"
328
- }, children: rect.pax }), _jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
329
- top: "40%",
330
- height: "20%",
331
- backgroundColor: rect.highlightColor || "transparent",
332
- }, children: _jsx("span", { className: "text-white font-bold text-xs", children: rect.status }) })] })), rect.shape === "image" && (_jsx("img", { src: rect.src, alt: "custom", className: "w-full h-full object-cover", draggable: false })), rect.shape === "vip-seat" && (_jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
333
- top: "10%",
334
- height: "20%",
335
- }, children: _jsx("span", { className: "text-white font-bold text-xs", children: rect.table }) })), rect.shape === "vip-seat" && (_jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
336
- top: "40%",
337
- height: "20%",
338
- backgroundColor: rect.highlightColor || "transparent",
339
- }, children: _jsx("span", { className: "text-white font-bold text-xs", children: rect.status }) })), _jsx("div", { className: "absolute bottom-2 left-0 right-0 text-center text-white text-sm", children: rect.shape === "vip-seat" ? "8 Pax" : "" }), activeTool === "node" && (selectedRectangle === null || selectedRectangle === void 0 ? void 0 : selectedRectangle.id) === rect.id && (_jsxs(_Fragment, { children: [_jsx("div", { className: "absolute w-3 h-3 bg-white border border-gray-800", style: {
340
- top: -6,
341
- left: -6,
342
- cursor: "nwse-resize",
343
- borderRadius: rect.shape === "circle" ? "50%" : "0%",
344
- }, onMouseDown: () => startResizing("top-left") }), _jsx("div", { className: "absolute w-3 h-3 bg-white border border-gray-800", style: {
345
- top: -6,
346
- right: -6,
347
- cursor: "nesw-resize",
348
- borderRadius: rect.shape === "circle" ? "50%" : "0%",
349
- }, onMouseDown: () => startResizing("top-right") }), _jsx("div", { className: "absolute w-3 h-3 bg-white border border-gray-800", style: {
350
- bottom: -6,
351
- left: -6,
352
- cursor: "nesw-resize",
353
- borderRadius: rect.shape === "circle" ? "50%" : "0%",
354
- }, onMouseDown: () => startResizing("bottom-left") }), _jsx("div", { className: "absolute w-3 h-3 bg-white border border-gray-800", style: {
355
- bottom: -6,
356
- right: -6,
357
- cursor: "nwse-resize",
358
- borderRadius: rect.shape === "circle" ? "50%" : "0%",
359
- }, onMouseDown: () => startResizing("bottom-right") })] }))] }, rect.id)))] }) }), _jsx(Modal, { open: showModal, onCancel: () => setShowModal(false), onOk: () => setShowModal(false), title: "Edit Rectangle", children: selectedRectangle && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex gap-4 items-center", children: [_jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "mb-2 font-semibold", children: "Change Color:" }), _jsx(SketchPicker, { color: selectedRectangle.color, onChangeComplete: (color) => updateRectangle({ color: color.hex }) })] }), _jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Live Preview:" }), _jsxs("div", { className: "relative borderflex items-center justify-center", style: {
360
- width: selectedRectangle.width,
361
- height: selectedRectangle.height,
362
- margin: "0 auto",
363
- transform: `rotate(${selectedRectangle.rotation}deg)`,
364
- backgroundColor: selectedRectangle.color,
365
- transition: "all 0.3s ease",
366
- scale: "0.5",
367
- borderRadius: selectedRectangle.shape === "circle" ? "100%" : "0%",
368
- }, children: [selectedRectangle.shape === "vip-seat" && (_jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
369
- top: "10%",
370
- height: "20%",
371
- }, children: _jsxs("span", { className: "text-white font-bold text-xs", children: [selectedRectangle.status, "sfsdf"] }) })), selectedRectangle.shape === "vip-seat" && (_jsx("div", { className: "absolute left-0 right-0 flex items-center justify-center", style: {
372
- top: "40%",
373
- height: "20%",
374
- backgroundColor: selectedRectangle.highlightColor || "transparent",
375
- }, children: _jsxs("span", { className: "text-white font-bold text-xs", children: [selectedRectangle.status, " dsdsd"] }) }))] })] })] }), _jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Edit Text:" }), _jsx(Input, { value: selectedRectangle.pax, onChange: (e) => updateRectangle({ pax: e.target.value }) }), _jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Edit Label:" }), _jsx(Input, { value: selectedRectangle.table, onChange: (e) => updateRectangle({ table: e.target.value }) }), _jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Edit Highlight:" }), _jsx(Input, { value: selectedRectangle.status, onChange: (e) => updateRectangle({ status: e.target.value }) }), _jsx("p", { className: "mt-4 mb-2 font-semibold", children: "Rotate:" }), _jsxs("div", { className: "flex gap-4 items-center", children: [_jsx(Button, { onClick: () => rotateRectangle("left"), children: "\u27F2 Rotate Left" }), _jsxs("span", { children: [selectedRectangle.rotation, "\u00B0"] }), _jsx(Button, { onClick: () => rotateRectangle("right"), children: "\u27F3 Rotate Right" })] })] })) })] }));
376
- };
377
- export default SeatEditor;
@@ -1,41 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import LayerView from "@/features/view";
4
- import { useState, useEffect } from "react";
5
- import { dataDummy } from "./constant";
6
- const TouchScrollDetect = () => {
7
- const [fingerCount, setFingerCount] = useState(0);
8
- const [scrollType, setScrollType] = useState(""); // untuk kondisi tampilan
9
- useEffect(() => {
10
- const container = document.getElementById("scroll-container");
11
- const handleTouchStart = (e) => {
12
- const count = e.touches.length;
13
- setFingerCount(count);
14
- if (count === 1) {
15
- setScrollType("one");
16
- }
17
- else if (count === 2) {
18
- setScrollType("two");
19
- }
20
- else {
21
- setScrollType("other");
22
- }
23
- };
24
- const handleTouchEnd = () => {
25
- setFingerCount(0);
26
- setScrollType(""); // reset saat tidak ada sentuhan
27
- };
28
- if (container) {
29
- container.addEventListener("touchstart", handleTouchStart);
30
- container.addEventListener("touchend", handleTouchEnd);
31
- }
32
- return () => {
33
- if (container) {
34
- container.removeEventListener("touchstart", handleTouchStart);
35
- container.removeEventListener("touchend", handleTouchEnd);
36
- }
37
- };
38
- }, []);
39
- return (_jsx(LayerView, { statusKey: "status", defaultBackground: "#000000", componentProps: dataDummy, extraComponentProps: [] }));
40
- };
41
- export default TouchScrollDetect;
package/dist/app/page.js DELETED
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import Board from "../features/board";
3
- import SideTool from "../features/side-tool";
4
- import ControlPanels from "../features/panel";
5
- const TableEditor = () => {
6
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full h-screen flex relative", children: [_jsx(SideTool, {}), _jsx(Board, {}), _jsx(ControlPanels, {})] }) }));
7
- };
8
- export default TableEditor;
@@ -1,11 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Button, Popover } from "antd";
4
- const ButtonTools = (props) => {
5
- const { buttonProps, items, popoverProps } = props;
6
- if (items.length === 0) {
7
- return (_jsx(Popover, Object.assign({ trigger: "hover" }, popoverProps, { children: _jsx(Button, Object.assign({}, buttonProps)) })));
8
- }
9
- return (_jsx(Popover, { content: _jsxs("div", { children: [_jsx(Button, { children: "Button 1" }), _jsx(Button, { children: "Button 2" })] }), trigger: "click", children: _jsx(Button, Object.assign({}, buttonProps)) }));
10
- };
11
- export default ButtonTools;
@@ -1,7 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { Button, ColorPicker, Flex, Form, Input, InputNumber } from "antd";
4
- const SectionLabel = () => {
5
- return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Section Labeling" }), _jsx(Form.Item, { label: "Labels in square", name: "labels", children: _jsx(Form.List, { name: "labels", children: (fields, { add, remove }) => (_jsxs(_Fragment, { children: [fields.map((field) => (_jsxs("div", { children: [_jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { name: [field.name, "label"], label: "Text", children: _jsx(Input, {}) }), _jsx(Form.Item, { name: [field.name, "fontColor"], label: "Color", getValueFromEvent: (color) => color.toHexString(), children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { name: [field.name, "x"], label: "X", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "y"], label: "Y", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { name: [field.name, "fontSize"], label: "Size", children: _jsx(InputNumber, { suffix: "px" }) })] })] }, field.key))), _jsxs(Flex, { gap: 2, children: [_jsx(Button, { type: "primary", onClick: () => add(), className: "btn btn-primary", children: "Add" }), _jsx(Button, { type: "primary", onClick: () => remove(fields.length - 1), className: "btn btn-primary", children: "Remove" })] })] })) }) }), _jsx("div", { className: "divider-dashed" })] }));
6
- };
7
- export default SectionLabel;
@@ -1,25 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { ColorPicker, Flex, Form, InputNumber, Select } from "antd";
4
- const SectionShape = () => {
5
- const optionsShape = [
6
- {
7
- value: "circle",
8
- label: "Circle",
9
- },
10
- {
11
- value: "square",
12
- label: "Square",
13
- },
14
- {
15
- value: "table-seat-circle",
16
- label: "Table Seat Circle",
17
- },
18
- {
19
- label: "Image Table",
20
- value: "image-table",
21
- },
22
- ];
23
- return (_jsxs("div", { className: "py-2", children: [_jsx("h1", { className: "heading-s", children: "Shape" }), _jsx(Flex, { gap: 2, className: "w-full", children: _jsx(Form.Item, { label: "Name", name: "shape", className: "w-full", children: _jsx(Select, { options: optionsShape, className: "w-full" }) }) }), _jsxs(Flex, { gap: 2, className: "w-full", children: [_jsx(Form.Item, { label: "Width", name: "width", className: "w-full", children: _jsx(InputNumber, { suffix: "px" }) }), _jsx(Form.Item, { label: "Height", name: "height", className: "w-full", children: _jsx(InputNumber, { suffix: "px" }) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Position X", name: "x", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "Position Y", name: "y", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "Rotation", name: "rotation", className: "w-full", children: _jsx(InputNumber, {}) })] }), _jsxs(Flex, { gap: 2, children: [_jsx(Form.Item, { label: "Fill", name: "fill", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) }), _jsx(Form.Item, { label: "Stroke", name: "stroke", getValueFromEvent: (color) => color.toHexString(), className: "w-full ", children: _jsx(ColorPicker, { allowClear: true, format: "hex", defaultFormat: "hex" }) })] }), _jsxs(Flex, { children: [_jsx(Form.Item, { label: "Stroke Width", name: "strokeWidth", className: "w-full", children: _jsx(InputNumber, {}) }), _jsx(Form.Item, { label: "opacity", name: "opacity", className: "w-full", children: _jsx(InputNumber, { step: 0.1, max: 1, min: 0 }) })] })] }));
24
- };
25
- export default SectionShape;
@@ -1,27 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useState, useEffect } from "react";
4
- import { Input, Button, Flex, Form } from "antd";
5
- import { ArrowRight, ArrowLeft } from "lucide-react";
6
- const NumberIndicator = ({ name, defaultValue, onChange }) => {
7
- const [value, setValue] = useState(0);
8
- const form = Form.useFormInstance();
9
- useEffect(() => {
10
- if (defaultValue) {
11
- setValue(defaultValue);
12
- form.setFieldsValue({ [name]: defaultValue });
13
- }
14
- }, [defaultValue]);
15
- const handlePrev = () => {
16
- setValue(value - 1);
17
- form.setFieldsValue({ [name]: value - 1 });
18
- onChange(value - 1);
19
- };
20
- const handleNext = () => {
21
- setValue(value + 1);
22
- form.setFieldsValue({ [name]: value + 1 });
23
- onChange(value + 1);
24
- };
25
- return (_jsxs(Flex, { gap: 2, children: [_jsx(Button, { onClick: handlePrev, children: _jsx(ArrowLeft, {}) }), _jsx(Form.Item, { name: name, noStyle: true, children: _jsx(Input, { className: "flex text-center", type: "number", value: value, name: name, onChange: (e) => setValue(parseInt(e.target.value)) }) }), _jsx(Button, { onClick: handleNext, children: _jsx(ArrowRight, {}) })] }));
26
- };
27
- export default NumberIndicator;
@@ -1,48 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- // Joystick.tsx
3
- import { useRef, useState } from "react";
4
- export const Joystick = ({ size = 120, onMove, onEnd, }) => {
5
- const baseRef = useRef(null);
6
- const [position, setPosition] = useState({ x: 0, y: 0 });
7
- const handleMove = (e) => {
8
- const base = baseRef.current;
9
- if (!base)
10
- return;
11
- const rect = base.getBoundingClientRect();
12
- const isTouch = "touches" in e;
13
- const clientX = isTouch ? e.touches[0].clientX : e.clientX;
14
- const clientY = isTouch ? e.touches[0].clientY : e.clientY;
15
- const centerX = rect.left + rect.width / 2;
16
- const centerY = rect.top + rect.height / 2;
17
- const dx = clientX - centerX;
18
- const dy = clientY - centerY;
19
- const distance = Math.min(Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)), size / 2 - 20);
20
- const angle = Math.atan2(dy, dx);
21
- const x = Math.cos(angle) * distance;
22
- const y = Math.sin(angle) * distance;
23
- setPosition({ x, y });
24
- onMove === null || onMove === void 0 ? void 0 : onMove({ x, y });
25
- };
26
- const handleEnd = () => {
27
- setPosition({ x: 0, y: 0 });
28
- onEnd === null || onEnd === void 0 ? void 0 : onEnd();
29
- };
30
- return (_jsx("div", { ref: baseRef, onMouseMove: (e) => e.buttons === 1 && handleMove(e), onMouseUp: handleEnd, onMouseLeave: handleEnd, onTouchMove: handleMove, onTouchEnd: handleEnd, style: {
31
- width: size,
32
- height: size,
33
- background: "#ddd",
34
- borderRadius: "50%",
35
- position: "relative",
36
- touchAction: "none",
37
- userSelect: "none",
38
- }, children: _jsx("div", { onMouseDown: handleMove, onTouchStart: handleMove, style: {
39
- width: 40,
40
- height: 40,
41
- background: "#3E97FF",
42
- borderRadius: "50%",
43
- position: "absolute",
44
- left: `calc(50% + ${position.x}px - 20px)`,
45
- top: `calc(50% + ${position.y}px - 20px)`,
46
- touchAction: "none",
47
- } }) }));
48
- };