30 lines
924 B
TypeScript
30 lines
924 B
TypeScript
|
// import { useSelectedZoneStore } from "../../../store/useZoneStore";
|
||
|
|
||
|
|
||
|
// type HandleDropTemplateProps = {
|
||
|
// templateId: string;
|
||
|
// };
|
||
|
|
||
|
// export const handleDropTemplate = ({ templateId }: HandleDropTemplateProps): void => {
|
||
|
// const { getTemplate } = useTemplateStore.getState();
|
||
|
// const { setSelectedZone } = useSelectedZoneStore.getState();
|
||
|
|
||
|
// // Find the template by ID
|
||
|
// const template: Template | undefined = getTemplate(templateId);
|
||
|
|
||
|
// if (!template) {
|
||
|
// console.error("Template not found!");
|
||
|
// return;
|
||
|
// }
|
||
|
|
||
|
// // Update the selected zone with the template data
|
||
|
// setSelectedZone((prev) => ({
|
||
|
// ...prev,
|
||
|
// panelOrder: template.panelOrder,
|
||
|
// activeSides: Array.from(new Set([...prev.activeSides, ...template.panelOrder])),
|
||
|
// widgets: template.widgets, // Keep widget structure the same
|
||
|
// }));
|
||
|
|
||
|
// console.log("Dropped template applied:", template);
|
||
|
// };
|