fix error
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# VITE_API_URL = 'https://dpage.liara.run'
|
||||
VITE_API_URL = 'http://188.121.103.8:4141'
|
||||
# VITE_API_URL = 'http://188.121.103.8:4141'
|
||||
VITE_TOKEN_NAME = 'dpage-editor-t'
|
||||
VITE_REFRESH_TOKEN_NAME = 'dpage-editor-refresh-t'
|
||||
BIN
Binary file not shown.
Generated
+3325
-40
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@liara/cli": "^9.4.7",
|
||||
"@radix-ui/react-switch": "^1.2.6",
|
||||
"@tailwindcss/vite": "^4.1.17",
|
||||
"@tanstack/react-query": "^5.90.21",
|
||||
|
||||
@@ -110,7 +110,7 @@ type EditorStoreType = {
|
||||
width: number;
|
||||
height: number;
|
||||
value: string;
|
||||
} | null
|
||||
} | null,
|
||||
) => void;
|
||||
addTable: (x: number, y: number, rows?: number, cols?: number) => void;
|
||||
addRow: (tableId: string) => void;
|
||||
@@ -121,12 +121,12 @@ type EditorStoreType = {
|
||||
changeCellBackground: (
|
||||
tableId: string,
|
||||
cellId: string,
|
||||
color: string
|
||||
color: string,
|
||||
) => void;
|
||||
applyTableResize: (
|
||||
tableId: string,
|
||||
newWidth: number,
|
||||
newHeight: number
|
||||
newHeight: number,
|
||||
) => void;
|
||||
stageRef: React.RefObject<Konva.Stage | null> | null;
|
||||
setStageRef: (ref: React.RefObject<Konva.Stage | null>) => void;
|
||||
@@ -155,7 +155,7 @@ const createInitialCells = (
|
||||
rows: number,
|
||||
cols: number,
|
||||
cellWidth: number,
|
||||
cellHeight: number
|
||||
cellHeight: number,
|
||||
): Record<string, TableCell> => {
|
||||
const cells: Record<string, TableCell> = {};
|
||||
for (let row = 0; row < rows; row++) {
|
||||
@@ -174,7 +174,7 @@ const createInitialCells = (
|
||||
};
|
||||
|
||||
const createInitialPage = (name: string): Page => ({
|
||||
id: `page-${crypto.randomUUID()}`,
|
||||
id: `page-${crypto.randomUUID?.()}`,
|
||||
name,
|
||||
objects: [],
|
||||
});
|
||||
@@ -193,7 +193,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
const state = get();
|
||||
if (state.currentPageId) {
|
||||
const currentPage = state.pages.find(
|
||||
(p) => p.id === state.currentPageId
|
||||
(p) => p.id === state.currentPageId,
|
||||
);
|
||||
if (currentPage) {
|
||||
set((state) => ({
|
||||
@@ -201,7 +201,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
pages: state.pages.map((p) =>
|
||||
p.id === state.currentPageId
|
||||
? { ...p, objects: [...p.objects, object] }
|
||||
: p
|
||||
: p,
|
||||
),
|
||||
}));
|
||||
return;
|
||||
@@ -214,24 +214,24 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
if (state.currentPageId) {
|
||||
set((state) => ({
|
||||
objects: state.objects.map((obj) =>
|
||||
obj.id === id ? { ...obj, ...updates } : obj
|
||||
obj.id === id ? { ...obj, ...updates } : obj,
|
||||
),
|
||||
pages: state.pages.map((p) =>
|
||||
p.id === state.currentPageId
|
||||
? {
|
||||
...p,
|
||||
objects: p.objects.map((obj) =>
|
||||
obj.id === id ? { ...obj, ...updates } : obj
|
||||
obj.id === id ? { ...obj, ...updates } : obj,
|
||||
),
|
||||
}
|
||||
: p
|
||||
: p,
|
||||
),
|
||||
}));
|
||||
return;
|
||||
}
|
||||
set((state) => ({
|
||||
objects: state.objects.map((obj) =>
|
||||
obj.id === id ? { ...obj, ...updates } : obj
|
||||
obj.id === id ? { ...obj, ...updates } : obj,
|
||||
),
|
||||
}));
|
||||
},
|
||||
@@ -243,7 +243,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
pages: state.pages.map((p) =>
|
||||
p.id === state.currentPageId
|
||||
? { ...p, objects: p.objects.filter((obj) => obj.id !== id) }
|
||||
: p
|
||||
: p,
|
||||
),
|
||||
selectedObjectId:
|
||||
state.selectedObjectId === id ? null : state.selectedObjectId,
|
||||
@@ -282,8 +282,8 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
...cell,
|
||||
id: `cell-${crypto.randomUUID()}`,
|
||||
},
|
||||
]
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
},
|
||||
}),
|
||||
@@ -295,7 +295,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
pages: state.pages.map((p) =>
|
||||
p.id === state.currentPageId
|
||||
? { ...p, objects: [...p.objects, duplicatedObject] }
|
||||
: p
|
||||
: p,
|
||||
),
|
||||
selectedObjectId: duplicatedObject.id,
|
||||
}));
|
||||
@@ -333,7 +333,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
removeFromSelection: (id) => {
|
||||
const state = get();
|
||||
const newIds = state.selectedObjectIds.filter(
|
||||
(selectedId) => selectedId !== id
|
||||
(selectedId) => selectedId !== id,
|
||||
);
|
||||
set({
|
||||
selectedObjectIds: newIds,
|
||||
@@ -592,7 +592,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
}));
|
||||
|
||||
const newPage: Page = {
|
||||
id: `page-${crypto.randomUUID()}`,
|
||||
id: `page-${crypto.randomUUID?.()}`,
|
||||
name: `${pageToDuplicate.name} (کپی)`,
|
||||
objects: duplicatedObjects,
|
||||
};
|
||||
@@ -628,7 +628,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
// Save current objects to current page before switching
|
||||
const updatedPages = state.currentPageId
|
||||
? state.pages.map((p) =>
|
||||
p.id === state.currentPageId ? { ...p, objects: state.objects } : p
|
||||
p.id === state.currentPageId ? { ...p, objects: state.objects } : p,
|
||||
)
|
||||
: state.pages;
|
||||
|
||||
@@ -660,17 +660,17 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
if (state.currentPageId) {
|
||||
set((state) => ({
|
||||
objects: state.objects.map((obj) =>
|
||||
obj.id === id ? { ...obj, visible: newVisible } : obj
|
||||
obj.id === id ? { ...obj, visible: newVisible } : obj,
|
||||
),
|
||||
pages: state.pages.map((p) =>
|
||||
p.id === state.currentPageId
|
||||
? {
|
||||
...p,
|
||||
objects: p.objects.map((obj) =>
|
||||
obj.id === id ? { ...obj, visible: newVisible } : obj
|
||||
obj.id === id ? { ...obj, visible: newVisible } : obj,
|
||||
),
|
||||
}
|
||||
: p
|
||||
: p,
|
||||
),
|
||||
selectedObjectId: shouldDeselect ? null : state.selectedObjectId,
|
||||
selectedTableId: shouldDeselect ? null : state.selectedTableId,
|
||||
@@ -679,7 +679,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
}
|
||||
set((state) => ({
|
||||
objects: state.objects.map((obj) =>
|
||||
obj.id === id ? { ...obj, visible: newVisible } : obj
|
||||
obj.id === id ? { ...obj, visible: newVisible } : obj,
|
||||
),
|
||||
selectedObjectId: shouldDeselect ? null : state.selectedObjectId,
|
||||
selectedTableId: shouldDeselect ? null : state.selectedTableId,
|
||||
@@ -710,7 +710,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
} else if (obj?.groupId) {
|
||||
// اگر این آبجکت در یک گروه است، همه آبجکتهای آن گروه را اضافه کن
|
||||
const oldGroupMembers = state.objects.filter(
|
||||
(o) => o.groupId === obj.groupId
|
||||
(o) => o.groupId === obj.groupId,
|
||||
);
|
||||
oldGroupMembers.forEach((member) => {
|
||||
if (member.type !== "group") {
|
||||
@@ -729,7 +729,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
|
||||
const groupId = `group-${crypto.randomUUID()}`;
|
||||
const objectsToGroup = state.objects.filter(
|
||||
(obj) => allObjectIdsToGroup.has(obj.id) && obj.type !== "group"
|
||||
(obj) => allObjectIdsToGroup.has(obj.id) && obj.type !== "group",
|
||||
);
|
||||
|
||||
if (objectsToGroup.length === 0) return;
|
||||
@@ -891,7 +891,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
pages: state.pages.map((p) =>
|
||||
p.id === state.currentPageId
|
||||
? { ...p, objects: [...updateObjects(p.objects), groupObject] }
|
||||
: p
|
||||
: p,
|
||||
),
|
||||
selectedObjectId: groupId,
|
||||
selectedObjectIds: [groupId],
|
||||
@@ -910,7 +910,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
const updateObjects = (objects: EditorObject[]) =>
|
||||
objects
|
||||
.map((obj) =>
|
||||
obj.groupId === groupId ? { ...obj, groupId: undefined } : obj
|
||||
obj.groupId === groupId ? { ...obj, groupId: undefined } : obj,
|
||||
)
|
||||
.filter((obj) => obj.id !== groupId); // حذف group object
|
||||
|
||||
@@ -920,7 +920,7 @@ export const useEditorStore = create<EditorStoreType>((set, get) => {
|
||||
pages: state.pages.map((p) =>
|
||||
p.id === state.currentPageId
|
||||
? { ...p, objects: updateObjects(p.objects) }
|
||||
: p
|
||||
: p,
|
||||
),
|
||||
selectedObjectId: null,
|
||||
selectedObjectIds: [],
|
||||
|
||||
@@ -17,7 +17,7 @@ const BuyCatalog: FC = () => {
|
||||
mutate({ count: count }, {
|
||||
onSuccess: (data) => {
|
||||
console.log(data);
|
||||
|
||||
// TODO منتقل بشه به صفحه صورت حساب
|
||||
},
|
||||
onError: (error) => {
|
||||
toast(extractErrorMessage(error), 'error')
|
||||
|
||||
Reference in New Issue
Block a user