seat-editor 1.6.11 → 1.6.13

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 (42) hide show
  1. package/dist/app/test/page.d.ts +1 -0
  2. package/dist/app/test/page.js +43 -0
  3. package/dist/app/v2/page.d.ts +2 -0
  4. package/dist/app/v2/page.js +8 -0
  5. package/dist/components/layer-v2/index.d.ts +19 -0
  6. package/dist/components/layer-v2/index.js +295 -0
  7. package/dist/features/board/index.js +2 -2
  8. package/dist/features/board-v2/board-slice.d.ts +14 -0
  9. package/dist/features/board-v2/board-slice.js +52 -0
  10. package/dist/features/board-v2/index.d.ts +6 -0
  11. package/dist/features/{board/index.jsx → board-v2/index.js} +40 -100
  12. package/dist/features/package/index.js +1 -1
  13. package/dist/features/panel/index.js +0 -2
  14. package/dist/features/side-tool/index.js +13 -1
  15. package/package.json +1 -1
  16. package/dist/app/layout.jsx +0 -27
  17. package/dist/app/new-board/page.jsx +0 -53
  18. package/dist/app/old-board/page.jsx +0 -510
  19. package/dist/app/only-view/page.jsx +0 -40
  20. package/dist/app/page.jsx +0 -13
  21. package/dist/components/button-tools/index.jsx +0 -17
  22. package/dist/components/form-tools/label.jsx +0 -44
  23. package/dist/components/form-tools/shape.jsx +0 -66
  24. package/dist/components/input/number-indicator.jsx +0 -36
  25. package/dist/components/joystick/index.jsx +0 -49
  26. package/dist/components/layer/index.jsx +0 -383
  27. package/dist/components/lib/index.jsx +0 -33
  28. package/dist/components/modal-preview/index.jsx +0 -11
  29. package/dist/features/navbar/index.jsx +0 -5
  30. package/dist/features/package/index.jsx +0 -114
  31. package/dist/features/panel/index.jsx +0 -115
  32. package/dist/features/panel/select-tool.jsx +0 -60
  33. package/dist/features/panel/square-circle-tool.jsx +0 -10
  34. package/dist/features/panel/table-seat-circle.jsx +0 -31
  35. package/dist/features/panel/text-tool.jsx +0 -26
  36. package/dist/features/panel/upload-tool.jsx +0 -152
  37. package/dist/features/side-tool/index.jsx +0 -298
  38. package/dist/features/view/index.jsx +0 -226
  39. package/dist/features/view-only/index.jsx +0 -204
  40. package/dist/provider/antd-provider.jsx +0 -46
  41. package/dist/provider/redux-provider.jsx +0 -6
  42. package/dist/provider/store-provider.jsx +0 -10
@@ -1,510 +0,0 @@
1
- "use client";
2
- import React, { useState } from "react";
3
- import { Button, Input, Modal } from "antd"; //tes commit
4
- // aduhuhhusd
5
- import { Square, MousePointer2, Move3D, Trash, CopyPlusIcon, ZoomInIcon, ZoomOutIcon, DownloadIcon, UploadIcon, Circle, PenIcon, Pencil, } from "lucide-react";
6
- import { SketchPicker } from "react-color";
7
- const SeatEditor = () => {
8
- var _a, _b;
9
- const [activeTool, setActiveTool] = useState(null);
10
- const [rectangles, setRectangles] = useState([]);
11
- const [selectedRectangle, setSelectedRectangle] = useState(null);
12
- const [isDragging, setIsDragging] = useState(false);
13
- const [startPoint, setStartPoint] = useState(null);
14
- const [shadowRect, setShadowRect] = useState(null);
15
- const [showModal, setShowModal] = useState(false);
16
- const [dragOffset, setDragOffset] = useState(null);
17
- const [zoom, setZoom] = useState(1);
18
- const [resizeDirection, setResizeDirection] = useState(null);
19
- const [images, setImages] = useState([]);
20
- const [penPaths, setPenPaths] = useState([]);
21
- const [currentPath, setCurrentPath] = useState(null);
22
- const [isDrawing, setIsDrawing] = useState(false);
23
- // upload image
24
- const widthWorkspace = ((_a = document.getElementById("workspace")) === null || _a === void 0 ? void 0 : _a.clientWidth) || 0;
25
- const heightWorkspace = ((_b = document.getElementById("workspace")) === null || _b === void 0 ? void 0 : _b.clientHeight) || 0;
26
- const handleImageUploadBackground = (e) => {
27
- var _a;
28
- const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
29
- if (!file)
30
- return;
31
- const reader = new FileReader();
32
- reader.onload = () => {
33
- const img = document.createElement("img");
34
- img.src = reader.result;
35
- let width = img.width > widthWorkspace ? img.width / 2 : img.width;
36
- let height = img.height > heightWorkspace ? img.height / 2 : img.height;
37
- img.onload = () => {
38
- setRectangles((prev) => [
39
- ...prev,
40
- {
41
- id: rectangles.length + 1,
42
- x: 100,
43
- y: 100,
44
- width: width < 1 ? 100 : width,
45
- height: height < 1 ? 100 : height,
46
- rotation: 0,
47
- shape: "image",
48
- src: img.src,
49
- },
50
- ]);
51
- };
52
- };
53
- reader.readAsDataURL(file);
54
- };
55
- const handleImageUpload = (e) => {
56
- var _a;
57
- const file = (_a = e.target.files) === null || _a === void 0 ? void 0 : _a[0];
58
- if (!file)
59
- return;
60
- const reader = new FileReader();
61
- reader.onload = () => {
62
- const img = document.createElement("img");
63
- img.src = reader.result;
64
- let width = img.width > widthWorkspace ? img.width / 2 : img.width;
65
- let height = img.height > heightWorkspace ? img.height / 2 : img.height;
66
- img.onload = () => {
67
- setRectangles((prev) => [
68
- ...prev,
69
- {
70
- id: rectangles.length + 1,
71
- x: 100,
72
- y: 100,
73
- width: width < 1 ? 100 : width,
74
- height: height < 1 ? 100 : height,
75
- rotation: 0,
76
- shape: "image-table",
77
- src: img.src,
78
- pax: "4 Pax",
79
- highlightColor: "#C1443D",
80
- status: "SOLD",
81
- table: `V${rectangles.length + 1}`,
82
- },
83
- ]);
84
- };
85
- };
86
- reader.readAsDataURL(file);
87
- };
88
- // zoom in out
89
- const zoomIn = () => setZoom((prev) => prev + 0.1);
90
- const zoomOut = () => setZoom((prev) => Math.max(0.1, prev - 0.1));
91
- const handleToolClick = (tool) => {
92
- setActiveTool(tool);
93
- setSelectedRectangle(null); // Deselect any rectangle when switching tools
94
- };
95
- // === Drawing Rectangle ===
96
- const handleMouseDown = (e) => {
97
- if (activeTool === "rectangle" ||
98
- activeTool === "circle" ||
99
- activeTool === "vip-seat") {
100
- const rect = e.target.getBoundingClientRect();
101
- setStartPoint({ x: e.clientX - rect.left, y: e.clientY - rect.top });
102
- setIsDragging(true);
103
- }
104
- if (activeTool === "pen") {
105
- const rect = e.target.getBoundingClientRect();
106
- const newPoint = { x: e.clientX - rect.left, y: e.clientY - rect.top };
107
- setCurrentPath({
108
- id: penPaths.length + 1,
109
- points: [newPoint],
110
- color: "#fff", // Default white stroke
111
- strokeWidth: 2, // Default stroke width
112
- });
113
- setIsDrawing(true);
114
- }
115
- };
116
- // rotate logic
117
- const rotateRectangle = (direction) => {
118
- if (selectedRectangle) {
119
- const rotationChange = direction === "left" ? -5 : 5; // Rotate 5 degrees
120
- const newRotation = (selectedRectangle.rotation + rotationChange) % 360;
121
- setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id
122
- ? Object.assign(Object.assign({}, rect), { rotation: newRotation }) : rect));
123
- setSelectedRectangle((prev) => prev ? Object.assign(Object.assign({}, prev), { rotation: newRotation }) : null);
124
- }
125
- };
126
- const handleMouseMove = (e) => {
127
- // Resize logic for node tool
128
- if (activeTool === "node" &&
129
- isDragging &&
130
- resizeDirection &&
131
- selectedRectangle) {
132
- const workspaceRect = e.currentTarget.getBoundingClientRect();
133
- const currentX = e.clientX - workspaceRect.left;
134
- const currentY = e.clientY - workspaceRect.top;
135
- let newRect = Object.assign({}, selectedRectangle);
136
- switch (resizeDirection) {
137
- case "top-left":
138
- newRect.width += newRect.x - currentX;
139
- newRect.height =
140
- selectedRectangle.shape === "circle"
141
- ? newRect.width
142
- : newRect.height + (newRect.y - currentY);
143
- newRect.x = currentX;
144
- newRect.y =
145
- selectedRectangle.shape === "circle" ? newRect.y : currentY;
146
- break;
147
- case "top-right":
148
- newRect.width = currentX - newRect.x;
149
- newRect.height =
150
- selectedRectangle.shape === "circle"
151
- ? newRect.width
152
- : newRect.height + (newRect.y - currentY);
153
- newRect.y =
154
- selectedRectangle.shape === "circle" ? newRect.y : currentY;
155
- break;
156
- case "bottom-left":
157
- newRect.width += newRect.x - currentX;
158
- newRect.height =
159
- selectedRectangle.shape === "circle"
160
- ? newRect.width
161
- : currentY - newRect.y;
162
- newRect.x = currentX;
163
- break;
164
- case "bottom-right":
165
- newRect.width = currentX - newRect.x;
166
- newRect.height =
167
- selectedRectangle.shape === "circle"
168
- ? newRect.width
169
- : currentY - newRect.y;
170
- break;
171
- }
172
- // Ensure width and height are always positive
173
- newRect.width = Math.max(10, newRect.width);
174
- newRect.height = Math.max(10, newRect.height);
175
- setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id ? Object.assign({}, newRect) : rect));
176
- setSelectedRectangle(newRect);
177
- }
178
- if ((activeTool === "rectangle" ||
179
- activeTool === "circle" ||
180
- activeTool === "vip-seat") &&
181
- isDragging &&
182
- startPoint) {
183
- const rect = e.target.getBoundingClientRect();
184
- const currentX = e.clientX - rect.left;
185
- const currentY = e.clientY - rect.top;
186
- // Update shadow rectangle dimensions dynamically
187
- const newShadowRect = {
188
- id: -1, // Temporary ID for preview
189
- x: Math.min(startPoint.x, currentX),
190
- y: Math.min(startPoint.y, currentY),
191
- width: Math.abs(currentX - startPoint.x),
192
- height: Math.abs(currentY - startPoint.y),
193
- color: activeTool === "vip-seat" ? "#2D2D36" : "rgba(74, 144, 226, 0.4)", // Light blue with transparency
194
- pax: "",
195
- rotation: 0,
196
- shape: activeTool === "vip-seat" ? "vip-seat" : activeTool, // Define shape type
197
- highlightColor: activeTool === "vip-seat" ? "#C1443D" : undefined, // Red section in VIP
198
- status: activeTool === "vip-seat" ? "SOLD" : undefined,
199
- table: activeTool === "vip-seat" ? `V${rectangles.length + 1}` : undefined, // Table number for VIP
200
- };
201
- setShadowRect(newShadowRect);
202
- }
203
- // Dragging for select tool
204
- if (activeTool === "select" &&
205
- isDragging &&
206
- selectedRectangle &&
207
- dragOffset) {
208
- const workspaceRect = e.currentTarget.getBoundingClientRect();
209
- const newX = e.clientX - workspaceRect.left - dragOffset.x;
210
- const newY = e.clientY - workspaceRect.top - dragOffset.y;
211
- setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id
212
- ? Object.assign(Object.assign({}, rect), { x: newX, y: newY }) : rect));
213
- }
214
- };
215
- const handleMouseUp = () => {
216
- setIsDragging(false);
217
- setResizeDirection(null);
218
- if ((activeTool === "rectangle" ||
219
- activeTool === "circle" ||
220
- activeTool === "vip-seat") &&
221
- isDragging &&
222
- shadowRect) {
223
- // Finalize the rectangle on mouse release
224
- 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 });
225
- setRectangles([...rectangles, newRectangle]);
226
- setImages((prev) => prev.map((img) => img.id === (selectedRectangle === null || selectedRectangle === void 0 ? void 0 : selectedRectangle.id)
227
- ? Object.assign(Object.assign({}, img), { x: newRectangle.x, y: newRectangle.y }) : img));
228
- setShadowRect(null); // Clear shadow preview
229
- setIsDragging(false);
230
- setStartPoint(null);
231
- }
232
- };
233
- const handleRectangleMouseDown = (e, rect) => {
234
- if (activeTool === "select" || activeTool === "node") {
235
- setSelectedRectangle(rect);
236
- const rectBox = e.target.getBoundingClientRect();
237
- setDragOffset({
238
- x: e.clientX - rectBox.left,
239
- y: e.clientY - rectBox.top,
240
- });
241
- setIsDragging(true);
242
- }
243
- };
244
- const handleRectangleDoubleClick = (rect) => {
245
- if (activeTool === "select" || activeTool === "node") {
246
- setSelectedRectangle(rect);
247
- setShowModal(true);
248
- }
249
- };
250
- const updateRectangle = (updates) => {
251
- if (selectedRectangle) {
252
- setRectangles((prev) => prev.map((rect) => rect.id === selectedRectangle.id ? Object.assign(Object.assign({}, rect), updates) : rect));
253
- setSelectedRectangle((prev) => (prev ? Object.assign(Object.assign({}, prev), updates) : null));
254
- }
255
- };
256
- const startResizing = (direction) => {
257
- setResizeDirection(direction);
258
- setIsDragging(true);
259
- };
260
- // Set the cursor style based on the active tool
261
- const getCursorStyle = () => {
262
- if (activeTool === "rectangle" ||
263
- activeTool === "circle" ||
264
- activeTool === "vip-seat")
265
- return "cursor-crosshair";
266
- if (activeTool === "select")
267
- return "cursor-default";
268
- if (activeTool === "node")
269
- return "cursor-pointer";
270
- return "cursor-default";
271
- };
272
- const deleteSelectedRectangle = () => {
273
- if (selectedRectangle) {
274
- setRectangles((prev) => prev.filter((rect) => rect.id !== selectedRectangle.id));
275
- setSelectedRectangle(null);
276
- }
277
- };
278
- // duplicate
279
- const duplicateRectangle = () => {
280
- if (selectedRectangle) {
281
- const newRectangle = Object.assign(Object.assign({}, selectedRectangle), { id: rectangles.length + 1, x: selectedRectangle.x + 20, y: selectedRectangle.y + 20 });
282
- setRectangles([...rectangles, newRectangle]);
283
- }
284
- };
285
- const exportJSON = () => {
286
- // const json = JSON.stringify(rectangles, null, 2);
287
- // const blob = new Blob([json], { type: "application/json" });
288
- // const link = document.createElement("a");
289
- // link.href = URL.createObjectURL(blob);
290
- // link.download = "seat_layout.json";
291
- // document.body.appendChild(link);
292
- // link.click();
293
- // document.body.removeChild(link);
294
- };
295
- return (<div className="flex h-screen w-full">
296
- {/* Toolbar */}
297
- <div className="w-16 bg-gray-800 text-white flex flex-col items-center py-4 space-y-4">
298
- {/* Select Tool */}
299
- <Button type={activeTool === "select" ? "primary" : "default"} shape="circle" icon={<MousePointer2 />} onClick={() => handleToolClick("select")}/>
300
- <Button type={activeTool === "circle" ? "primary" : "default"} shape="circle" icon={<Circle />} onClick={() => handleToolClick("circle")}/>
301
- <Button type={activeTool === "vip-seat" ? "primary" : "default"} shape="circle" icon={<PenIcon />} // Use any icon you prefer
302
- onClick={() => handleToolClick("vip-seat")}/>
303
- {/* Rectangle Tool */}
304
- <Button type={activeTool === "rectangle" ? "primary" : "default"} shape="circle" icon={<Square />} onClick={() => handleToolClick("rectangle")}/>
305
- {/* Node Tool */}
306
- <Button type={activeTool === "node" ? "primary" : "default"} shape="circle" icon={<Move3D />} onClick={() => handleToolClick("node")}/>
307
- <Button type={activeTool === "pen" ? "primary" : "default"} shape="circle" icon={<Pencil />} onClick={() => handleToolClick("pen")}/>
308
-
309
- {/* delete */}
310
- <Button type="default" shape="circle" icon={<Trash />} onClick={deleteSelectedRectangle}/>
311
- {/* duplicate */}
312
- <Button type="default" shape="circle" icon={<CopyPlusIcon />} // You can use a copy icon
313
- onClick={duplicateRectangle}/>
314
- {/* zoomIn/out */}
315
- <Button type="default" shape="circle" onClick={zoomIn} icon={<ZoomInIcon />}/>
316
- <Button type="default" shape="circle" onClick={zoomOut} icon={<ZoomOutIcon />}/>
317
- {/* {activeTool === "image" && ( */}
318
- <UploadIcon />
319
- <span>Image Seat</span>
320
- <input type="file" accept="image/*" onChange={handleImageUpload}/>
321
- <span>Background Image</span>
322
- <input type="file" accept="image/*" onChange={handleImageUploadBackground}/>
323
- {/* )} */}
324
- <Button shape="circle" icon={<DownloadIcon />} onClick={exportJSON}/>
325
- </div>
326
-
327
- {/* Workspace */}
328
- <div className="w-full flex items-center justify-center" id={"workspace"}>
329
- <div className={`bg-gray-900 relative ${getCursorStyle()} w-full h-screen `} onMouseDown={handleMouseDown} onMouseMove={handleMouseMove} onMouseUp={handleMouseUp} style={{
330
- transform: `scale(${zoom})`,
331
- transformOrigin: "0 0",
332
- }}>
333
-
334
- {shadowRect && (<div className="absolute border-dashed border-2 border-blue-400" style={{
335
- left: shadowRect.x,
336
- top: shadowRect.y,
337
- width: shadowRect.width,
338
- height: shadowRect.height,
339
- backgroundColor: shadowRect.color,
340
- }}/>)}
341
- {/* Render rectangles */}
342
- {rectangles.map((rect) => (<div key={rect.id} 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
343
- ? "border-black"
344
- : "border-gray-300"}`} style={{
345
- left: rect.x,
346
- top: rect.y,
347
- width: rect.width,
348
- height: rect.height,
349
- backgroundColor: rect.color,
350
- transform: `rotate(${rect.rotation}deg)`,
351
- transformOrigin: "center",
352
- borderRadius: rect.shape === "circle" ? "100%" : "0%",
353
- }}>
354
- {rect.shape === "image-table" && (<div className="w-full h-full relative">
355
- <img src={rect.src} alt="custom" className="w-full h-full object-cover" draggable={false}/>
356
- <div className="absolute left-0 right-0 flex items-center justify-center" style={{
357
- top: "10%",
358
- height: "20%",
359
- backgroundColor: rect.highlightColor || "transparent",
360
- }}>
361
- <span className="text-white font-bold text-xs absolute" style={{
362
- top: "10%",
363
- left: "50%",
364
- }}>
365
- {rect.table}
366
- </span>
367
- </div>
368
- <span className="text-xs text-white flex items-center justify-center absolute w-full" style={{
369
- top: "85%",
370
- left: "50%",
371
- transform: "translate(-50%, -50%)",
372
- backgroundColor: rect.highlightColor || "transparent"
373
- }}>
374
- {rect.pax}
375
- </span>
376
- <div className="absolute left-0 right-0 flex items-center justify-center" style={{
377
- top: "40%",
378
- height: "20%",
379
- backgroundColor: rect.highlightColor || "transparent",
380
- }}>
381
- <span className="text-white font-bold text-xs">
382
- {rect.status}
383
- </span>
384
- </div>
385
- </div>)}
386
- {rect.shape === "image" && (<img src={rect.src} alt="custom" className="w-full h-full object-cover" draggable={false}/>)}
387
- {rect.shape === "vip-seat" && (<div className="absolute left-0 right-0 flex items-center justify-center" style={{
388
- top: "10%",
389
- height: "20%",
390
- }}>
391
- <span className="text-white font-bold text-xs">
392
- {rect.table}
393
- </span>
394
- </div>)}
395
- {rect.shape === "vip-seat" && (<div className="absolute left-0 right-0 flex items-center justify-center" style={{
396
- top: "40%",
397
- height: "20%",
398
- backgroundColor: rect.highlightColor || "transparent",
399
- }}>
400
- <span className="text-white font-bold text-xs">
401
- {rect.status}
402
- </span>
403
- </div>)}
404
-
405
- {/* Bottom Text */}
406
- <div className="absolute bottom-2 left-0 right-0 text-center text-white text-sm">
407
- {rect.shape === "vip-seat" ? "8 Pax" : ""}
408
- </div>
409
-
410
- {/* Resize Nodes */}
411
- {/* Resize Nodes (Only Show When in Node Mode and Item is Selected) */}
412
- {activeTool === "node" && (selectedRectangle === null || selectedRectangle === void 0 ? void 0 : selectedRectangle.id) === rect.id && (<>
413
- {/* Top Left */}
414
- <div className="absolute w-3 h-3 bg-white border border-gray-800" style={{
415
- top: -6,
416
- left: -6,
417
- cursor: "nwse-resize",
418
- borderRadius: rect.shape === "circle" ? "50%" : "0%",
419
- }} onMouseDown={() => startResizing("top-left")}/>
420
- {/* Top Right */}
421
- <div className="absolute w-3 h-3 bg-white border border-gray-800" style={{
422
- top: -6,
423
- right: -6,
424
- cursor: "nesw-resize",
425
- borderRadius: rect.shape === "circle" ? "50%" : "0%",
426
- }} onMouseDown={() => startResizing("top-right")}/>
427
- {/* Bottom Left */}
428
- <div className="absolute w-3 h-3 bg-white border border-gray-800" style={{
429
- bottom: -6,
430
- left: -6,
431
- cursor: "nesw-resize",
432
- borderRadius: rect.shape === "circle" ? "50%" : "0%",
433
- }} onMouseDown={() => startResizing("bottom-left")}/>
434
- {/* Bottom Right */}
435
- <div className="absolute w-3 h-3 bg-white border border-gray-800" style={{
436
- bottom: -6,
437
- right: -6,
438
- cursor: "nwse-resize",
439
- borderRadius: rect.shape === "circle" ? "50%" : "0%",
440
- }} onMouseDown={() => startResizing("bottom-right")}/>
441
- </>)}
442
- </div>))}
443
- </div>
444
- </div>
445
-
446
- {/* Rectangle Customization Modal */}
447
- <Modal open={showModal} onCancel={() => setShowModal(false)} onOk={() => setShowModal(false)} title="Edit Rectangle">
448
- {selectedRectangle && (<>
449
- <div className="flex gap-4 items-center">
450
- <div className="flex flex-col">
451
- <p className="mb-2 font-semibold">Change Color:</p>
452
- <SketchPicker color={selectedRectangle.color} onChangeComplete={(color) => updateRectangle({ color: color.hex })}/>
453
- </div>
454
- <div className="flex flex-col">
455
- <p className="mt-4 mb-2 font-semibold">Live Preview:</p>
456
- <div className="relative borderflex items-center justify-center" style={{
457
- width: selectedRectangle.width,
458
- height: selectedRectangle.height,
459
- margin: "0 auto",
460
- transform: `rotate(${selectedRectangle.rotation}deg)`,
461
- backgroundColor: selectedRectangle.color,
462
- transition: "all 0.3s ease",
463
- scale: "0.5",
464
- borderRadius: selectedRectangle.shape === "circle" ? "100%" : "0%",
465
- }}>
466
- {selectedRectangle.shape === "vip-seat" && (<div className="absolute left-0 right-0 flex items-center justify-center" style={{
467
- top: "10%",
468
- height: "20%",
469
- }}>
470
- <span className="text-white font-bold text-xs">
471
- {selectedRectangle.status}sfsdf
472
- </span>
473
- </div>)}
474
- {selectedRectangle.shape === "vip-seat" && (<div className="absolute left-0 right-0 flex items-center justify-center" style={{
475
- top: "40%",
476
- height: "20%",
477
- backgroundColor: selectedRectangle.highlightColor || "transparent",
478
- }}>
479
- <span className="text-white font-bold text-xs">
480
- {selectedRectangle.status} dsdsd
481
- </span>
482
- </div>)}
483
- </div>
484
- </div>
485
- </div>
486
-
487
- {/* Preview Section */}
488
-
489
- <p className="mt-4 mb-2 font-semibold">Edit Text:</p>
490
- <Input value={selectedRectangle.pax} onChange={(e) => updateRectangle({ pax: e.target.value })}/>
491
- <p className="mt-4 mb-2 font-semibold">Edit Label:</p>
492
- <Input value={selectedRectangle.table} onChange={(e) => updateRectangle({ table: e.target.value })}/>
493
- <p className="mt-4 mb-2 font-semibold">Edit Highlight:</p>
494
- <Input value={selectedRectangle.status} onChange={(e) => updateRectangle({ status: e.target.value })}/>
495
- {/* Rotation Controls */}
496
- <p className="mt-4 mb-2 font-semibold">Rotate:</p>
497
- <div className="flex gap-4 items-center">
498
- <Button onClick={() => rotateRectangle("left")}>
499
- ⟲ Rotate Left
500
- </Button>
501
- <span>{selectedRectangle.rotation}°</span>
502
- <Button onClick={() => rotateRectangle("right")}>
503
- ⟳ Rotate Right
504
- </Button>
505
- </div>
506
- </>)}
507
- </Modal>
508
- </div>);
509
- };
510
- export default SeatEditor;
@@ -1,40 +0,0 @@
1
- "use client";
2
- import LayerView from "@/features/view";
3
- import { useState, useEffect } from "react";
4
- import { dataDummy } from "./constant";
5
- const TouchScrollDetect = () => {
6
- const [fingerCount, setFingerCount] = useState(0);
7
- const [scrollType, setScrollType] = useState(""); // untuk kondisi tampilan
8
- useEffect(() => {
9
- const container = document.getElementById("scroll-container");
10
- const handleTouchStart = (e) => {
11
- const count = e.touches.length;
12
- setFingerCount(count);
13
- if (count === 1) {
14
- setScrollType("one");
15
- }
16
- else if (count === 2) {
17
- setScrollType("two");
18
- }
19
- else {
20
- setScrollType("other");
21
- }
22
- };
23
- const handleTouchEnd = () => {
24
- setFingerCount(0);
25
- setScrollType(""); // reset saat tidak ada sentuhan
26
- };
27
- if (container) {
28
- container.addEventListener("touchstart", handleTouchStart);
29
- container.addEventListener("touchend", handleTouchEnd);
30
- }
31
- return () => {
32
- if (container) {
33
- container.removeEventListener("touchstart", handleTouchStart);
34
- container.removeEventListener("touchend", handleTouchEnd);
35
- }
36
- };
37
- }, []);
38
- return (<LayerView statusKey="status" defaultBackground="#000000" componentProps={dataDummy} extraComponentProps={[]}/>);
39
- };
40
- export default TouchScrollDetect;
package/dist/app/page.jsx DELETED
@@ -1,13 +0,0 @@
1
- import Board from "../features/board";
2
- import SideTool from "../features/side-tool";
3
- import ControlPanels from "../features/panel";
4
- const TableEditor = () => {
5
- return (<>
6
- <div className="w-full h-screen flex relative">
7
- <SideTool />
8
- <Board />
9
- <ControlPanels />
10
- </div>
11
- </>);
12
- };
13
- export default TableEditor;
@@ -1,17 +0,0 @@
1
- "use client";
2
- import { Button, Popover } from "antd";
3
- const ButtonTools = (props) => {
4
- const { buttonProps, items, popoverProps } = props;
5
- if (items.length === 0) {
6
- return (<Popover trigger="hover" {...popoverProps}>
7
- <Button {...buttonProps}/>
8
- </Popover>);
9
- }
10
- return (<Popover content={<div>
11
- <Button>Button 1</Button>
12
- <Button>Button 2</Button>
13
- </div>} trigger="click">
14
- <Button {...buttonProps}/>
15
- </Popover>);
16
- };
17
- export default ButtonTools;
@@ -1,44 +0,0 @@
1
- "use client";
2
- import { Button, ColorPicker, Flex, Form, Input, InputNumber } from "antd";
3
- const SectionLabel = () => {
4
- return (<div className="py-2">
5
- <h1 className="heading-s">Section Labeling</h1>
6
- <Form.Item label="Labels in square" name={"labels"}>
7
- <Form.List name="labels">
8
- {(fields, { add, remove }) => (<>
9
- {fields.map((field) => (<div key={field.key}>
10
- <Flex gap={2}>
11
- <Form.Item name={[field.name, "label"]} label="Text">
12
- <Input />
13
- </Form.Item>
14
- <Form.Item name={[field.name, "fontColor"]} label="Color" getValueFromEvent={(color) => color.toHexString()}>
15
- <ColorPicker allowClear format="hex" defaultFormat="hex"/>
16
- </Form.Item>
17
- </Flex>
18
- <Flex gap={2}>
19
- <Form.Item name={[field.name, "x"]} label="X">
20
- <InputNumber />
21
- </Form.Item>
22
- <Form.Item name={[field.name, "y"]} label="Y">
23
- <InputNumber />
24
- </Form.Item>
25
- <Form.Item name={[field.name, "fontSize"]} label="Size">
26
- <InputNumber suffix="px"/>
27
- </Form.Item>
28
- </Flex>
29
- </div>))}
30
- <Flex gap={2}>
31
- <Button type="primary" onClick={() => add()} className="btn btn-primary">
32
- Add
33
- </Button>
34
- <Button type="primary" onClick={() => remove(fields.length - 1)} className="btn btn-primary">
35
- Remove
36
- </Button>
37
- </Flex>
38
- </>)}
39
- </Form.List>
40
- </Form.Item>
41
- <div className="divider-dashed"/>
42
- </div>);
43
- };
44
- export default SectionLabel;