site builder
This commit is contained in:
parent
e792a4b886
commit
7bb707f359
@ -4,7 +4,7 @@
|
|||||||
<div class="dg-wrapper">
|
<div class="dg-wrapper">
|
||||||
<div class="clr-row">
|
<div class="clr-row">
|
||||||
<div class="clr-col-8">
|
<div class="clr-col-8">
|
||||||
<h3>DesignLbrary </h3>
|
<h3>Design Library </h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="clr-col-4" style="text-align: right;">
|
<div class="clr-col-4" style="text-align: right;">
|
||||||
<button *ngIf="cardButton" id="add" class="btn btn-primary btn-icon" (click)="changeView()">
|
<button *ngIf="cardButton" id="add" class="btn btn-primary btn-icon" (click)="changeView()">
|
||||||
|
|||||||
@ -31,6 +31,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
<button class="control-btn" (click)="saveTreeData()" title="Save">
|
||||||
|
<i class="fas fa-save"></i>
|
||||||
|
</button>
|
||||||
<button class="control-btn" (click)="zoomIn()" title="Zoom In">
|
<button class="control-btn" (click)="zoomIn()" title="Zoom In">
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -40,9 +43,7 @@
|
|||||||
<button class="control-btn" (click)="resetZoom()" title="Reset Zoom">
|
<button class="control-btn" (click)="resetZoom()" title="Reset Zoom">
|
||||||
<i class="fas fa-expand"></i>
|
<i class="fas fa-expand"></i>
|
||||||
</button>
|
</button>
|
||||||
<button class="control-btn" (click)="saveTreeData()" title="Save">
|
|
||||||
<i class="fas fa-save"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -51,9 +52,7 @@
|
|||||||
<div class="editor-title">Edit Section: {{ selectedSection.type }}</div>
|
<div class="editor-title">Edit Section: {{ selectedSection.type }}</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">Content</label>
|
<label class="form-label">Content</label>
|
||||||
<textarea
|
<textarea class="form-textarea" [(ngModel)]="selectedSection.content"></textarea>
|
||||||
class="form-textarea"
|
|
||||||
[(ngModel)]="selectedSection.content"></textarea>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button class="btn btn-secondary" (click)="cancelEdit()">Cancel</button>
|
<button class="btn btn-secondary" (click)="cancelEdit()">Cancel</button>
|
||||||
@ -67,7 +66,8 @@
|
|||||||
<button class="close-btn" (click)="closeOffcanvas()">×</button>
|
<button class="close-btn" (click)="closeOffcanvas()">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="offcanvas-body">
|
<div class="offcanvas-body">
|
||||||
<div class="section-template" *ngFor="let template of sectionTemplates" (click)="addSectionFromTemplate(template)">
|
<div class="section-template" *ngFor="let template of sectionTemplates"
|
||||||
|
(click)="addSectionFromTemplate(template)">
|
||||||
<div class="section-template-title">{{ template.type }}</div>
|
<div class="section-template-title">{{ template.type }}</div>
|
||||||
<div class="section-template-desc">{{ template.description }}</div>
|
<div class="section-template-desc">{{ template.description }}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -79,7 +79,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Content</label>
|
<label class="form-label">Content</label>
|
||||||
<textarea class="form-control" [(ngModel)]="customSectionContent" rows="4" placeholder="Enter content"></textarea>
|
<textarea class="form-control" [(ngModel)]="customSectionContent" rows="4"
|
||||||
|
placeholder="Enter content"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary" [disabled]="!customSectionType" (click)="addCustomSection()">
|
<button class="btn btn-primary" [disabled]="!customSectionType" (click)="addCustomSection()">
|
||||||
Add Custom Section
|
Add Custom Section
|
||||||
@ -103,7 +104,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" (click)="closeAddChildModal()">Cancel</button>
|
<button type="button" class="btn btn-secondary" (click)="closeAddChildModal()">Cancel</button>
|
||||||
<button type="button" class="btn btn-primary" [disabled]="!newPageName" (click)="addChildPage()">Add Page</button>
|
<button type="button" class="btn btn-primary" [disabled]="!newPageName" (click)="addChildPage()">Add
|
||||||
|
Page</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -113,47 +115,41 @@
|
|||||||
<div class="loading-text">Processing...</div>
|
<div class="loading-text">Processing...</div>
|
||||||
</div>
|
</div>
|
||||||
<ng-template #pageTemplate let-page>
|
<ng-template #pageTemplate let-page>
|
||||||
<div class="node-container"
|
<div class="node-container" draggable="true" (dragstart)="onPageDragStart(page)" (dragend)="onPageDragEnd()"
|
||||||
draggable="true"
|
(dragover)="$event.preventDefault()" (drop)="onPageDrop(page); $event.preventDefault()">
|
||||||
(dragstart)="onPageDragStart(page)"
|
|
||||||
(dragend)="onPageDragEnd()"
|
|
||||||
(dragover)="$event.preventDefault()"
|
|
||||||
(drop)="onPageDrop(page); $event.preventDefault()">
|
|
||||||
<div class="connection-line" *ngIf="page.parent && page.parent !== rootPage"></div>
|
<div class="connection-line" *ngIf="page.parent && page.parent !== rootPage"></div>
|
||||||
<div class="node-card"
|
<div class="node-card" [class.selected]="selectedPage === page" (click)="selectPage(page)">
|
||||||
[class.selected]="selectedPage === page"
|
|
||||||
(click)="selectPage(page)">
|
|
||||||
<div class="node-header">
|
<div class="node-header">
|
||||||
<i class="node-icon" [class]="getNodeIcon(page)"></i>
|
<i class="node-icon" [class]="getNodeIcon(page)"></i>
|
||||||
<span class="node-title">{{ page.name }}</span>
|
<span class="node-title">{{ page.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="sections-container" cdkDropList [cdkDropListData]="page.sections">
|
<div class="sections-container" cdkDropList [cdkDropListData]="page.sections">
|
||||||
<!-- Update the section card template within the #pageTemplate -->
|
<!-- Update the section card template within the #pageTemplate -->
|
||||||
<!-- Section card with improved hover button placement -->
|
<!-- Section card with improved hover button placement -->
|
||||||
<div class="section-card" *ngFor="let section of page.sections; let i = index"
|
<div class="section-card" *ngFor="let section of page.sections; let i = index" cdkDrag
|
||||||
cdkDrag
|
(click)="selectSection(section); $event.stopPropagation()">
|
||||||
(click)="selectSection(section); $event.stopPropagation()">
|
<div class="section-title">{{ section.type }}</div>
|
||||||
<div class="section-title">{{ section.type }}</div>
|
<div class="section-content" [innerHTML]="getSectionContentHtml(section.content)"></div>
|
||||||
<div class="section-content" [innerHTML]="getSectionContentHtml(section.content)"></div>
|
<div class="section-actions">
|
||||||
<div class="section-actions">
|
<button class="section-action-btn" title="Edit Section" (click)="editSection(section, $event)">
|
||||||
<button class="section-action-btn" title="Edit Section" (click)="editSection(section, $event)">
|
<i class="fas fa-pencil-alt"></i>
|
||||||
<i class="fas fa-pencil-alt"></i>
|
</button>
|
||||||
</button>
|
<button class="section-action-btn" title="Delete Section" (click)="deleteSection(section, page, $event)">
|
||||||
<button class="section-action-btn" title="Delete Section" (click)="deleteSection(section, page, $event)">
|
<i class="fas fa-trash"></i>
|
||||||
<i class="fas fa-trash"></i>
|
</button>
|
||||||
</button>
|
</div>
|
||||||
</div>
|
<!-- Repositioned add button that appears on hover -->
|
||||||
<!-- Repositioned add button that appears on hover -->
|
<div class="add-section-hover-btn" (click)="openSectionOffcanvas(page, i, $event)" title="Add Section">
|
||||||
<div class="add-section-hover-btn" (click)="openSectionOffcanvas(page, i, $event)" title="Add Section">
|
<i class="fas fa-plus"></i>
|
||||||
<i class="fas fa-plus"></i>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<!-- <div class="add-section-btn" (click)="openSectionOffcanvas(page); $event.stopPropagation()">
|
<!-- <div class="add-section-btn" (click)="openSectionOffcanvas(page); $event.stopPropagation()">
|
||||||
<i class="fas fa-plus"></i> Add Section
|
<i class="fas fa-plus"></i> Add Section
|
||||||
</div> -->
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="node-actions">
|
<div class="node-actions">
|
||||||
<button class="node-action-btn" title="Add Child Page" (click)="showAddChildPageModal(page); $event.stopPropagation()">
|
<button class="node-action-btn" title="Add Child Page"
|
||||||
|
(click)="showAddChildPageModal(page); $event.stopPropagation()">
|
||||||
<i class="fas fa-plus"></i>
|
<i class="fas fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
<button class="node-action-btn" title="Delete Page" (click)="deletePage(page, $event)">
|
<button class="node-action-btn" title="Delete Page" (click)="deletePage(page, $event)">
|
||||||
@ -171,4 +167,4 @@ cdkDrag
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</div>
|
</div>
|
||||||
@ -4,6 +4,7 @@ import { Subject } from 'rxjs';
|
|||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop';
|
import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop';
|
||||||
import { SiteTreeservice } from '../SiteBuilderGrid/SiteTree.service';
|
import { SiteTreeservice } from '../SiteBuilderGrid/SiteTree.service';
|
||||||
|
import { ToastrService } from 'ngx-toastr';
|
||||||
|
|
||||||
interface Section {
|
interface Section {
|
||||||
type: string;
|
type: string;
|
||||||
@ -27,23 +28,23 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
// Canvas properties
|
// Canvas properties
|
||||||
@ViewChild('canvasContainer') canvasContainer!: ElementRef;
|
@ViewChild('canvasContainer') canvasContainer!: ElementRef;
|
||||||
private destroy$ = new Subject<void>();
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
// Grid movement properties
|
// Grid movement properties
|
||||||
private isDraggingCanvas = false;
|
private isDraggingCanvas = false;
|
||||||
private startX = 0;
|
private startX = 0;
|
||||||
private startY = 0;
|
private startY = 0;
|
||||||
private panning = false;
|
private panning = false;
|
||||||
|
|
||||||
// Zoom properties
|
// Zoom properties
|
||||||
currentScale = 1;
|
currentScale = 1;
|
||||||
private maxScale = 2;
|
private maxScale = 2;
|
||||||
private minScale = 0.5;
|
private minScale = 0.5;
|
||||||
private scaleFactor = 0.1;
|
private scaleFactor = 0.1;
|
||||||
|
|
||||||
// Grid position
|
// Grid position
|
||||||
gridTranslateX = 0;
|
gridTranslateX = 0;
|
||||||
gridTranslateY = 0;
|
gridTranslateY = 0;
|
||||||
|
|
||||||
// Site structure data
|
// Site structure data
|
||||||
rootPage: Page | null = null;
|
rootPage: Page | null = null;
|
||||||
selectedPage: Page | null = null;
|
selectedPage: Page | null = null;
|
||||||
@ -52,19 +53,19 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
siteId: number = 0;
|
siteId: number = 0;
|
||||||
loading = false;
|
loading = false;
|
||||||
hasUnsavedChanges = false;
|
hasUnsavedChanges = false;
|
||||||
|
|
||||||
// Section management
|
// Section management
|
||||||
availableSectionTypes: string[] = [];
|
availableSectionTypes: string[] = [];
|
||||||
showOffcanvas = false;
|
showOffcanvas = false;
|
||||||
currentParentPage: Page | null = null;
|
currentParentPage: Page | null = null;
|
||||||
customSectionType = '';
|
customSectionType = '';
|
||||||
customSectionContent = '';
|
customSectionContent = '';
|
||||||
|
|
||||||
// Adding child pages
|
// Adding child pages
|
||||||
showAddChildModal = false;
|
showAddChildModal = false;
|
||||||
newPageName = '';
|
newPageName = '';
|
||||||
currentParentForChild: Page | null = null;
|
currentParentForChild: Page | null = null;
|
||||||
|
|
||||||
// For drag and drop
|
// For drag and drop
|
||||||
draggedPage: Page | null = null;
|
draggedPage: Page | null = null;
|
||||||
draggedSection: Section | null = null;
|
draggedSection: Section | null = null;
|
||||||
@ -72,7 +73,7 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
|
|
||||||
currentSectionIndex: number = -1;
|
currentSectionIndex: number = -1;
|
||||||
|
|
||||||
|
|
||||||
// Section templates with better descriptions
|
// Section templates with better descriptions
|
||||||
sectionTemplates = [
|
sectionTemplates = [
|
||||||
{
|
{
|
||||||
@ -129,174 +130,177 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private siteTreeService: SiteTreeservice,
|
private siteTreeService: SiteTreeservice,
|
||||||
private route: ActivatedRoute
|
private route: ActivatedRoute,
|
||||||
) {}
|
private toastr: ToastrService
|
||||||
|
|
||||||
|
|
||||||
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.siteId = this.route.snapshot.params['id'];
|
this.siteId = this.route.snapshot.params['id'];
|
||||||
this.fetchSiteTree();
|
this.fetchSiteTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
this.initCanvasControls();
|
this.initCanvasControls();
|
||||||
|
|
||||||
// Set up touch events for mobile
|
// Set up touch events for mobile
|
||||||
const canvas = this.canvasContainer.nativeElement;
|
const canvas = this.canvasContainer.nativeElement;
|
||||||
canvas.addEventListener('touchstart', this.handleTouchStart.bind(this));
|
canvas.addEventListener('touchstart', this.handleTouchStart.bind(this));
|
||||||
canvas.addEventListener('touchmove', this.handleTouchMove.bind(this));
|
canvas.addEventListener('touchmove', this.handleTouchMove.bind(this));
|
||||||
canvas.addEventListener('touchend', this.handleTouchEnd.bind(this));
|
canvas.addEventListener('touchend', this.handleTouchEnd.bind(this));
|
||||||
|
|
||||||
// Center grid after initial load
|
// Center grid after initial load
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.centerGrid();
|
this.centerGrid();
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
// Auto-save changes before component destruction
|
// Auto-save changes before component destruction
|
||||||
if (this.hasUnsavedChanges) {
|
if (this.hasUnsavedChanges) {
|
||||||
this.saveTreeData(true);
|
this.saveTreeData(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.destroy$.next();
|
this.destroy$.next();
|
||||||
this.destroy$.complete();
|
this.destroy$.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
// GRID MOVEMENT METHODS
|
// GRID MOVEMENT METHODS
|
||||||
|
|
||||||
initCanvasControls(): void {
|
initCanvasControls(): void {
|
||||||
const canvas = this.canvasContainer.nativeElement;
|
const canvas = this.canvasContainer.nativeElement;
|
||||||
|
|
||||||
// Mouse down event for dragging
|
// Mouse down event for dragging
|
||||||
canvas.addEventListener('mousedown', (e: MouseEvent) => {
|
canvas.addEventListener('mousedown', (e: MouseEvent) => {
|
||||||
// Only initiate drag if not clicking on interactive elements
|
// Only initiate drag if not clicking on interactive elements
|
||||||
if ((e.target as HTMLElement).closest('.node-card, .node-header, button, input, select, textarea, .modal, .editor-form, .section-card, .add-button')) {
|
if ((e.target as HTMLElement).closest('.node-card, .node-header, button, input, select, textarea, .modal, .editor-form, .section-card, .add-button')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.panning = true;
|
this.panning = true;
|
||||||
this.startX = e.clientX - this.gridTranslateX;
|
this.startX = e.clientX - this.gridTranslateX;
|
||||||
this.startY = e.clientY - this.gridTranslateY;
|
this.startY = e.clientY - this.gridTranslateY;
|
||||||
canvas.style.cursor = 'grabbing';
|
canvas.style.cursor = 'grabbing';
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mouse move for dragging the grid
|
// Mouse move for dragging the grid
|
||||||
document.addEventListener('mousemove', (e: MouseEvent) => {
|
document.addEventListener('mousemove', (e: MouseEvent) => {
|
||||||
if (!this.panning) return;
|
if (!this.panning) return;
|
||||||
|
|
||||||
// Calculate new position
|
// Calculate new position
|
||||||
const newX = e.clientX - this.startX;
|
const newX = e.clientX - this.startX;
|
||||||
const newY = e.clientY - this.startY;
|
const newY = e.clientY - this.startY;
|
||||||
|
|
||||||
// Update position
|
// Update position
|
||||||
this.gridTranslateX = newX;
|
this.gridTranslateX = newX;
|
||||||
this.gridTranslateY = newY;
|
this.gridTranslateY = newY;
|
||||||
this.applyGridTransform();
|
this.applyGridTransform();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mouse up to end dragging
|
// Mouse up to end dragging
|
||||||
document.addEventListener('mouseup', () => {
|
document.addEventListener('mouseup', () => {
|
||||||
this.panning = false;
|
this.panning = false;
|
||||||
canvas.style.cursor = 'grab';
|
canvas.style.cursor = 'grab';
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mouse wheel for zooming
|
// Mouse wheel for zooming
|
||||||
canvas.addEventListener('wheel', (e: WheelEvent) => {
|
canvas.addEventListener('wheel', (e: WheelEvent) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Calculate zoom based on wheel direction
|
// Calculate zoom based on wheel direction
|
||||||
const delta = e.deltaY < 0 ? this.scaleFactor : -this.scaleFactor;
|
const delta = e.deltaY < 0 ? this.scaleFactor : -this.scaleFactor;
|
||||||
const newScale = Math.min(this.maxScale, Math.max(this.minScale, this.currentScale + delta));
|
const newScale = Math.min(this.maxScale, Math.max(this.minScale, this.currentScale + delta));
|
||||||
|
|
||||||
// Get mouse position relative to canvas
|
// Get mouse position relative to canvas
|
||||||
const rect = canvas.getBoundingClientRect();
|
const rect = canvas.getBoundingClientRect();
|
||||||
const mouseX = e.clientX - rect.left;
|
const mouseX = e.clientX - rect.left;
|
||||||
const mouseY = e.clientY - rect.top;
|
const mouseY = e.clientY - rect.top;
|
||||||
|
|
||||||
// Calculate zoom around mouse position
|
// Calculate zoom around mouse position
|
||||||
this.zoomAtPoint(newScale, mouseX, mouseY);
|
this.zoomAtPoint(newScale, mouseX, mouseY);
|
||||||
}, { passive: false });
|
}, { passive: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Touch event handlers for mobile devices
|
// Touch event handlers for mobile devices
|
||||||
handleTouchStart(e: TouchEvent): void {
|
handleTouchStart(e: TouchEvent): void {
|
||||||
if (e.touches.length !== 1) return;
|
if (e.touches.length !== 1) return;
|
||||||
|
|
||||||
const touch = e.touches[0];
|
const touch = e.touches[0];
|
||||||
this.panning = true;
|
this.panning = true;
|
||||||
this.startX = touch.clientX - this.gridTranslateX;
|
this.startX = touch.clientX - this.gridTranslateX;
|
||||||
this.startY = touch.clientY - this.gridTranslateY;
|
this.startY = touch.clientY - this.gridTranslateY;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTouchMove(e: TouchEvent): void {
|
handleTouchMove(e: TouchEvent): void {
|
||||||
if (!this.panning || e.touches.length !== 1) return;
|
if (!this.panning || e.touches.length !== 1) return;
|
||||||
|
|
||||||
const touch = e.touches[0];
|
const touch = e.touches[0];
|
||||||
this.gridTranslateX = touch.clientX - this.startX;
|
this.gridTranslateX = touch.clientX - this.startX;
|
||||||
this.gridTranslateY = touch.clientY - this.startY;
|
this.gridTranslateY = touch.clientY - this.startY;
|
||||||
this.applyGridTransform();
|
this.applyGridTransform();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTouchEnd(): void {
|
handleTouchEnd(): void {
|
||||||
this.panning = false;
|
this.panning = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply transform to the grid
|
// Apply transform to the grid
|
||||||
applyGridTransform(): void {
|
applyGridTransform(): void {
|
||||||
const grid = document.querySelector('.sitemap-grid') as HTMLElement;
|
const grid = document.querySelector('.sitemap-grid') as HTMLElement;
|
||||||
if (!grid) return;
|
if (!grid) return;
|
||||||
|
|
||||||
grid.style.transform = `translate(${this.gridTranslateX}px, ${this.gridTranslateY}px) scale(${this.currentScale})`;
|
grid.style.transform = `translate(${this.gridTranslateX}px, ${this.gridTranslateY}px) scale(${this.currentScale})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Public method to get total transform for template binding
|
// Public method to get total transform for template binding
|
||||||
getTotalTransform(): string {
|
getTotalTransform(): string {
|
||||||
return `translate(${this.gridTranslateX}px, ${this.gridTranslateY}px) scale(${this.currentScale})`;
|
return `translate(${this.gridTranslateX}px, ${this.gridTranslateY}px) scale(${this.currentScale})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zoom at a specific point
|
// Zoom at a specific point
|
||||||
zoomAtPoint(newScale: number, x: number, y: number): void {
|
zoomAtPoint(newScale: number, x: number, y: number): void {
|
||||||
if (newScale === this.currentScale) return;
|
if (newScale === this.currentScale) return;
|
||||||
|
|
||||||
// Calculate offset change to zoom at mouse position
|
// Calculate offset change to zoom at mouse position
|
||||||
const scaleFactor = newScale / this.currentScale;
|
const scaleFactor = newScale / this.currentScale;
|
||||||
const dx = x - x * scaleFactor;
|
const dx = x - x * scaleFactor;
|
||||||
const dy = y - y * scaleFactor;
|
const dy = y - y * scaleFactor;
|
||||||
|
|
||||||
// Apply new position and scale
|
// Apply new position and scale
|
||||||
this.gridTranslateX = this.gridTranslateX * scaleFactor + dx;
|
this.gridTranslateX = this.gridTranslateX * scaleFactor + dx;
|
||||||
this.gridTranslateY = this.gridTranslateY * scaleFactor + dy;
|
this.gridTranslateY = this.gridTranslateY * scaleFactor + dy;
|
||||||
this.currentScale = newScale;
|
this.currentScale = newScale;
|
||||||
|
|
||||||
this.applyGridTransform();
|
this.applyGridTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center the grid in the viewport
|
// Center the grid in the viewport
|
||||||
centerGrid(): void {
|
centerGrid(): void {
|
||||||
const canvas = this.canvasContainer.nativeElement;
|
const canvas = this.canvasContainer.nativeElement;
|
||||||
const grid = document.querySelector('.tree-grid') as HTMLElement;
|
const grid = document.querySelector('.tree-grid') as HTMLElement;
|
||||||
const rootNode = document.querySelector('.home-node') as HTMLElement;
|
const rootNode = document.querySelector('.home-node') as HTMLElement;
|
||||||
|
|
||||||
if (!canvas || !grid) {
|
if (!canvas || !grid) {
|
||||||
setTimeout(() => this.centerGrid(), 100);
|
setTimeout(() => this.centerGrid(), 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const canvasRect = canvas.getBoundingClientRect();
|
const canvasRect = canvas.getBoundingClientRect();
|
||||||
const gridRect = grid.getBoundingClientRect();
|
const gridRect = grid.getBoundingClientRect();
|
||||||
|
|
||||||
// Calculate scale to fit content within the fixed box
|
// Calculate scale to fit content within the fixed box
|
||||||
const scaleX = canvasRect.width / gridRect.width * 0.2;
|
const scaleX = canvasRect.width / gridRect.width * 0.2;
|
||||||
const scaleY = canvasRect.height / gridRect.height * 0.2;
|
const scaleY = canvasRect.height / gridRect.height * 0.2;
|
||||||
const scale = Math.min(Math.max(this.minScale, Math.min(scaleX, scaleY)), 1);
|
const scale = Math.min(Math.max(this.minScale, Math.min(scaleX, scaleY)), 1);
|
||||||
|
|
||||||
// Position the grid - centered horizontally, but align top of tree with top of viewport
|
// Position the grid - centered horizontally, but align top of tree with top of viewport
|
||||||
this.currentScale = scale;
|
this.currentScale = scale;
|
||||||
this.gridTranslateX = -700; // Set left position to -900px
|
this.gridTranslateX = -700; // Set left position to -900px
|
||||||
|
|
||||||
// Position vertically to place root node near top with some padding
|
// Position vertically to place root node near top with some padding
|
||||||
const topPadding = 50; // Pixels from top of viewport
|
const topPadding = 50; // Pixels from top of viewport
|
||||||
if (rootNode) {
|
if (rootNode) {
|
||||||
@ -307,38 +311,38 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
// Fallback if root node not found
|
// Fallback if root node not found
|
||||||
this.gridTranslateY = topPadding;
|
this.gridTranslateY = topPadding;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.applyGridTransform();
|
this.applyGridTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZOOM CONTROL METHODS
|
// ZOOM CONTROL METHODS
|
||||||
|
|
||||||
zoomIn(): void {
|
zoomIn(): void {
|
||||||
const canvas = this.canvasContainer.nativeElement;
|
const canvas = this.canvasContainer.nativeElement;
|
||||||
const rect = canvas.getBoundingClientRect();
|
const rect = canvas.getBoundingClientRect();
|
||||||
const centerX = rect.width / 2;
|
const centerX = rect.width / 2;
|
||||||
const centerY = rect.height / 2;
|
const centerY = rect.height / 2;
|
||||||
|
|
||||||
const newScale = Math.min(this.maxScale, this.currentScale + this.scaleFactor);
|
const newScale = Math.min(this.maxScale, this.currentScale + this.scaleFactor);
|
||||||
this.zoomAtPoint(newScale, centerX, centerY);
|
this.zoomAtPoint(newScale, centerX, centerY);
|
||||||
}
|
}
|
||||||
|
|
||||||
zoomOut(): void {
|
zoomOut(): void {
|
||||||
const canvas = this.canvasContainer.nativeElement;
|
const canvas = this.canvasContainer.nativeElement;
|
||||||
const rect = canvas.getBoundingClientRect();
|
const rect = canvas.getBoundingClientRect();
|
||||||
const centerX = rect.width / 2;
|
const centerX = rect.width / 2;
|
||||||
const centerY = rect.height / 2;
|
const centerY = rect.height / 2;
|
||||||
|
|
||||||
const newScale = Math.max(this.minScale, this.currentScale - this.scaleFactor);
|
const newScale = Math.max(this.minScale, this.currentScale - this.scaleFactor);
|
||||||
this.zoomAtPoint(newScale, centerX, centerY);
|
this.zoomAtPoint(newScale, centerX, centerY);
|
||||||
}
|
}
|
||||||
|
|
||||||
resetZoom(): void {
|
resetZoom(): void {
|
||||||
this.centerGrid();
|
this.centerGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TREE DATA METHODS
|
// TREE DATA METHODS
|
||||||
|
|
||||||
fetchSiteTree(): void {
|
fetchSiteTree(): void {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.siteTreeService.getById(this.siteId).subscribe({
|
this.siteTreeService.getById(this.siteId).subscribe({
|
||||||
@ -348,7 +352,7 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
const raw = typeof res.model === 'string' ? JSON.parse(res.model) : res.model;
|
const raw = typeof res.model === 'string' ? JSON.parse(res.model) : res.model;
|
||||||
const rootTitle = raw.title || 'Site Structure';
|
const rootTitle = raw.title || 'Site Structure';
|
||||||
const pagesObj = raw.data?.Children || raw.Children || raw.data || raw;
|
const pagesObj = raw.data?.Children || raw.Children || raw.data || raw;
|
||||||
this.processSiteData( pagesObj,rootTitle);
|
this.processSiteData(pagesObj, rootTitle);
|
||||||
},
|
},
|
||||||
error: () => {
|
error: () => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@ -356,7 +360,7 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a default structure
|
// Create a default structure
|
||||||
createDefaultStructure(): void {
|
createDefaultStructure(): void {
|
||||||
const defaultData = {
|
const defaultData = {
|
||||||
@ -370,7 +374,7 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
};
|
};
|
||||||
this.processSiteData(defaultData);
|
this.processSiteData(defaultData);
|
||||||
}
|
}
|
||||||
|
|
||||||
processSiteData(pagesObj: any, rootTitle?: string): void {
|
processSiteData(pagesObj: any, rootTitle?: string): void {
|
||||||
// Initialize root with dynamic title
|
// Initialize root with dynamic title
|
||||||
this.rootPage = { id: 'root', name: rootTitle, sections: [], children: [] };
|
this.rootPage = { id: 'root', name: rootTitle, sections: [], children: [] };
|
||||||
@ -398,8 +402,8 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
content: Array.isArray(val)
|
content: Array.isArray(val)
|
||||||
? val.join('\n')
|
? val.join('\n')
|
||||||
: typeof val === 'object'
|
: typeof val === 'object'
|
||||||
? JSON.stringify(val, null, 2)
|
? JSON.stringify(val, null, 2)
|
||||||
: String(val)
|
: String(val)
|
||||||
});
|
});
|
||||||
if (!this.availableSectionTypes.includes(prop)) {
|
if (!this.availableSectionTypes.includes(prop)) {
|
||||||
this.availableSectionTypes.push(prop);
|
this.availableSectionTypes.push(prop);
|
||||||
@ -417,7 +421,7 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
this.rootPage.children = buildPages(pagesObj, this.rootPage);
|
this.rootPage.children = buildPages(pagesObj, this.rootPage);
|
||||||
setTimeout(() => this.centerGrid(), 100);
|
setTimeout(() => this.centerGrid(), 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
createPageFromData(pageName: string, pageData: any, idPrefix: string): Page {
|
createPageFromData(pageName: string, pageData: any, idPrefix: string): Page {
|
||||||
const page: Page = {
|
const page: Page = {
|
||||||
id: idPrefix,
|
id: idPrefix,
|
||||||
@ -425,19 +429,19 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
sections: [],
|
sections: [],
|
||||||
children: []
|
children: []
|
||||||
};
|
};
|
||||||
|
|
||||||
// Extract sections
|
// Extract sections
|
||||||
if (pageData) {
|
if (pageData) {
|
||||||
// Process properties as sections
|
// Process properties as sections
|
||||||
Object.keys(pageData).forEach(key => {
|
Object.keys(pageData).forEach(key => {
|
||||||
if (key !== 'Children') {
|
if (key !== 'Children') {
|
||||||
const value = pageData[key];
|
const value = pageData[key];
|
||||||
|
|
||||||
// Add to available section types if not already included
|
// Add to available section types if not already included
|
||||||
if (!this.availableSectionTypes.includes(key)) {
|
if (!this.availableSectionTypes.includes(key)) {
|
||||||
this.availableSectionTypes.push(key);
|
this.availableSectionTypes.push(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle different value types
|
// Handle different value types
|
||||||
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
||||||
// Object value
|
// Object value
|
||||||
@ -460,7 +464,7 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Process children recursively if the Children key exists
|
// Process children recursively if the Children key exists
|
||||||
if (pageData.Children) {
|
if (pageData.Children) {
|
||||||
let childId = 0;
|
let childId = 0;
|
||||||
@ -472,26 +476,26 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate output JSON from tree structure
|
// Generate output JSON from tree structure
|
||||||
generateOutputJson(): any {
|
generateOutputJson(): any {
|
||||||
const output: any = {};
|
const output: any = {};
|
||||||
|
|
||||||
if (this.rootPage?.children) {
|
if (this.rootPage?.children) {
|
||||||
this.rootPage.children.forEach(page => {
|
this.rootPage.children.forEach(page => {
|
||||||
output[page.name] = this.convertPageToJsonObject(page);
|
output[page.name] = this.convertPageToJsonObject(page);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
convertPageToJsonObject(page: Page): any {
|
convertPageToJsonObject(page: Page): any {
|
||||||
const pageObj: any = {};
|
const pageObj: any = {};
|
||||||
|
|
||||||
// Add sections
|
// Add sections
|
||||||
page.sections.forEach(section => {
|
page.sections.forEach(section => {
|
||||||
try {
|
try {
|
||||||
@ -508,45 +512,45 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
pageObj[section.type] = section.content;
|
pageObj[section.type] = section.content;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add children
|
// Add children
|
||||||
if (page.children && page.children.length > 0) {
|
if (page.children && page.children.length > 0) {
|
||||||
pageObj.Children = {};
|
pageObj.Children = {};
|
||||||
|
|
||||||
page.children.forEach(childPage => {
|
page.children.forEach(childPage => {
|
||||||
pageObj.Children[childPage.name] = this.convertPageToJsonObject(childPage);
|
pageObj.Children[childPage.name] = this.convertPageToJsonObject(childPage);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return pageObj;
|
return pageObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PAGE AND SECTION MANAGEMENT
|
// PAGE AND SECTION MANAGEMENT
|
||||||
|
|
||||||
selectPage(page: Page): void {
|
selectPage(page: Page): void {
|
||||||
this.selectedPage = page;
|
this.selectedPage = page;
|
||||||
this.selectedSection = null;
|
this.selectedSection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
selectSection(section: Section): void {
|
selectSection(section: Section): void {
|
||||||
this.selectedSection = section;
|
this.selectedSection = section;
|
||||||
this.editMode = 'section';
|
this.editMode = 'section';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show modal to add a child page
|
// Show modal to add a child page
|
||||||
showAddChildPageModal(parent: Page): void {
|
showAddChildPageModal(parent: Page): void {
|
||||||
this.currentParentForChild = parent;
|
this.currentParentForChild = parent;
|
||||||
this.newPageName = '';
|
this.newPageName = '';
|
||||||
this.showAddChildModal = true;
|
this.showAddChildModal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a child page
|
// Add a child page
|
||||||
addChildPage(): void {
|
addChildPage(): void {
|
||||||
if (this.currentParentForChild && this.newPageName) {
|
if (this.currentParentForChild && this.newPageName) {
|
||||||
if (!this.currentParentForChild.children) {
|
if (!this.currentParentForChild.children) {
|
||||||
this.currentParentForChild.children = [];
|
this.currentParentForChild.children = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
const newPage: Page = {
|
const newPage: Page = {
|
||||||
id: `page-${Date.now()}`,
|
id: `page-${Date.now()}`,
|
||||||
name: this.newPageName,
|
name: this.newPageName,
|
||||||
@ -554,51 +558,51 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
children: [],
|
children: [],
|
||||||
parent: this.currentParentForChild
|
parent: this.currentParentForChild
|
||||||
};
|
};
|
||||||
|
|
||||||
this.currentParentForChild.children.push(newPage);
|
this.currentParentForChild.children.push(newPage);
|
||||||
this.hasUnsavedChanges = true;
|
this.hasUnsavedChanges = true;
|
||||||
this.closeAddChildModal();
|
this.closeAddChildModal();
|
||||||
|
|
||||||
// Auto-select the new page
|
// Auto-select the new page
|
||||||
this.selectPage(newPage);
|
this.selectPage(newPage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeAddChildModal(): void {
|
closeAddChildModal(): void {
|
||||||
this.showAddChildModal = false;
|
this.showAddChildModal = false;
|
||||||
this.currentParentForChild = null;
|
this.currentParentForChild = null;
|
||||||
this.newPageName = '';
|
this.newPageName = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete a page
|
// Delete a page
|
||||||
deletePage(page: Page, event: Event): void {
|
deletePage(page: Page, event: Event): void {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
if (!page.parent || !page.parent.children) return;
|
if (!page.parent || !page.parent.children) return;
|
||||||
|
|
||||||
if (confirm(`Are you sure you want to delete "${page.name}" and all its children?`)) {
|
if (confirm(`Are you sure you want to delete "${page.name}" and all its children?`)) {
|
||||||
const index = page.parent.children.indexOf(page);
|
const index = page.parent.children.indexOf(page);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
page.parent.children.splice(index, 1);
|
page.parent.children.splice(index, 1);
|
||||||
|
|
||||||
if (this.selectedPage === page) {
|
if (this.selectedPage === page) {
|
||||||
this.selectedPage = null;
|
this.selectedPage = null;
|
||||||
this.editMode = null;
|
this.editMode = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hasUnsavedChanges = true;
|
this.hasUnsavedChanges = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format section content as HTML with colored text
|
// Format section content as HTML with colored text
|
||||||
getSectionContentHtml(content: string): string {
|
getSectionContentHtml(content: string): string {
|
||||||
if (!content) return '';
|
if (!content) return '';
|
||||||
|
|
||||||
// Replace line breaks with <br> for proper display
|
// Replace line breaks with <br> for proper display
|
||||||
return content.replace(/\n/g, '<br>');
|
return content.replace(/\n/g, '<br>');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show add section offcanvas
|
// Show add section offcanvas
|
||||||
openSectionOffcanvas(page: Page, sectionIndex: number = -1, event?: Event): void {
|
openSectionOffcanvas(page: Page, sectionIndex: number = -1, event?: Event): void {
|
||||||
if (event) {
|
if (event) {
|
||||||
@ -610,14 +614,14 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
this.customSectionContent = '';
|
this.customSectionContent = '';
|
||||||
this.showOffcanvas = true;
|
this.showOffcanvas = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the offcanvas
|
// Close the offcanvas
|
||||||
closeOffcanvas(): void {
|
closeOffcanvas(): void {
|
||||||
this.showOffcanvas = false;
|
this.showOffcanvas = false;
|
||||||
this.currentParentPage = null;
|
this.currentParentPage = null;
|
||||||
this.currentSectionIndex = -1;
|
this.currentSectionIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add section from a template
|
// Add section from a template
|
||||||
addSectionFromTemplate(template: any): void {
|
addSectionFromTemplate(template: any): void {
|
||||||
if (this.currentParentPage) {
|
if (this.currentParentPage) {
|
||||||
@ -625,104 +629,104 @@ export class TreeNodeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||||||
type: template.type,
|
type: template.type,
|
||||||
content: template.content
|
content: template.content
|
||||||
};
|
};
|
||||||
|
|
||||||
// Insert at specific position if provided, otherwise add to end
|
// Insert at specific position if provided, otherwise add to end
|
||||||
if (this.currentSectionIndex >= 0) {
|
if (this.currentSectionIndex >= 0) {
|
||||||
this.currentParentPage.sections.splice(this.currentSectionIndex + 1, 0, newSection);
|
this.currentParentPage.sections.splice(this.currentSectionIndex + 1, 0, newSection);
|
||||||
} else {
|
} else {
|
||||||
this.currentParentPage.sections.push(newSection);
|
this.currentParentPage.sections.push(newSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.availableSectionTypes.includes(template.type)) {
|
if (!this.availableSectionTypes.includes(template.type)) {
|
||||||
this.availableSectionTypes.push(template.type);
|
this.availableSectionTypes.push(template.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hasUnsavedChanges = true;
|
this.hasUnsavedChanges = true;
|
||||||
this.closeOffcanvas();
|
this.closeOffcanvas();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add custom section
|
// Add custom section
|
||||||
|
|
||||||
// Similar update for addCustomSection
|
// Similar update for addCustomSection
|
||||||
addCustomSection(): void {
|
addCustomSection(): void {
|
||||||
if (this.currentParentPage && this.customSectionType) {
|
if (this.currentParentPage && this.customSectionType) {
|
||||||
const newSection: Section = {
|
const newSection: Section = {
|
||||||
type: this.customSectionType,
|
type: this.customSectionType,
|
||||||
content: this.customSectionContent || ''
|
content: this.customSectionContent || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
// Insert at specific position if provided, otherwise add to end
|
// Insert at specific position if provided, otherwise add to end
|
||||||
if (this.currentSectionIndex >= 0) {
|
if (this.currentSectionIndex >= 0) {
|
||||||
this.currentParentPage.sections.splice(this.currentSectionIndex + 1, 0, newSection);
|
this.currentParentPage.sections.splice(this.currentSectionIndex + 1, 0, newSection);
|
||||||
} else {
|
} else {
|
||||||
this.currentParentPage.sections.push(newSection);
|
this.currentParentPage.sections.push(newSection);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.availableSectionTypes.includes(this.customSectionType)) {
|
||||||
|
this.availableSectionTypes.push(this.customSectionType);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hasUnsavedChanges = true;
|
||||||
|
this.closeOffcanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.availableSectionTypes.includes(this.customSectionType)) {
|
|
||||||
this.availableSectionTypes.push(this.customSectionType);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.hasUnsavedChanges = true;
|
|
||||||
this.closeOffcanvas();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Edit section
|
// Edit section
|
||||||
editSection(section: Section, event: Event): void {
|
editSection(section: Section, event: Event): void {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.selectedSection = section;
|
this.selectedSection = section;
|
||||||
this.editMode = 'section';
|
this.editMode = 'section';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel edit
|
// Cancel edit
|
||||||
cancelEdit(): void {
|
cancelEdit(): void {
|
||||||
this.editMode = null;
|
this.editMode = null;
|
||||||
this.selectedSection = null;
|
this.selectedSection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save edit
|
// Save edit
|
||||||
saveEdit(): void {
|
saveEdit(): void {
|
||||||
this.editMode = null;
|
this.editMode = null;
|
||||||
this.hasUnsavedChanges = true;
|
this.hasUnsavedChanges = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete section
|
// Delete section
|
||||||
deleteSection(section: Section, page: Page, event: Event): void {
|
deleteSection(section: Section, page: Page, event: Event): void {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
if (confirm(`Are you sure you want to delete this "${section.type}" section?`)) {
|
if (confirm(`Are you sure you want to delete this "${section.type}" section?`)) {
|
||||||
const index = page.sections.indexOf(section);
|
const index = page.sections.indexOf(section);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
page.sections.splice(index, 1);
|
page.sections.splice(index, 1);
|
||||||
|
|
||||||
if (this.selectedSection === section) {
|
if (this.selectedSection === section) {
|
||||||
this.selectedSection = null;
|
this.selectedSection = null;
|
||||||
this.editMode = null;
|
this.editMode = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hasUnsavedChanges = true;
|
this.hasUnsavedChanges = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DRAG AND DROP METHODS
|
// DRAG AND DROP METHODS
|
||||||
|
|
||||||
// Handle page drag start
|
// Handle page drag start
|
||||||
onPageDragStart(page: Page): void {
|
onPageDragStart(page: Page): void {
|
||||||
this.draggedPage = page;
|
this.draggedPage = page;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle page drag end
|
// Handle page drag end
|
||||||
onPageDragEnd(): void {
|
onPageDragEnd(): void {
|
||||||
this.draggedPage = null;
|
this.draggedPage = null;
|
||||||
this.dropTargetPage = null;
|
this.dropTargetPage = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle page drop
|
// Handle page drop
|
||||||
onPageDrop(targetPage: Page): void {
|
onPageDrop(targetPage: Page): void {
|
||||||
if (!this.draggedPage || this.draggedPage === targetPage) return;
|
if (!this.draggedPage || this.draggedPage === targetPage) return;
|
||||||
|
|
||||||
// Remove from current parent
|
// Remove from current parent
|
||||||
if (this.draggedPage.parent && this.draggedPage.parent.children) {
|
if (this.draggedPage.parent && this.draggedPage.parent.children) {
|
||||||
const sourceIndex = this.draggedPage.parent.children.indexOf(this.draggedPage);
|
const sourceIndex = this.draggedPage.parent.children.indexOf(this.draggedPage);
|
||||||
@ -730,19 +734,19 @@ addCustomSection(): void {
|
|||||||
this.draggedPage.parent.children.splice(sourceIndex, 1);
|
this.draggedPage.parent.children.splice(sourceIndex, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add to new parent
|
// Add to new parent
|
||||||
if (!targetPage.children) {
|
if (!targetPage.children) {
|
||||||
targetPage.children = [];
|
targetPage.children = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update parent reference
|
// Update parent reference
|
||||||
this.draggedPage.parent = targetPage;
|
this.draggedPage.parent = targetPage;
|
||||||
targetPage.children.push(this.draggedPage);
|
targetPage.children.push(this.draggedPage);
|
||||||
|
|
||||||
this.hasUnsavedChanges = true;
|
this.hasUnsavedChanges = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle section drag drop
|
// Handle section drag drop
|
||||||
onSectionDrop(event: CdkDragDrop<Section[]>): void {
|
onSectionDrop(event: CdkDragDrop<Section[]>): void {
|
||||||
if (event.previousContainer === event.container) {
|
if (event.previousContainer === event.container) {
|
||||||
@ -757,12 +761,12 @@ addCustomSection(): void {
|
|||||||
event.currentIndex
|
event.currentIndex
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hasUnsavedChanges = true;
|
this.hasUnsavedChanges = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// UI HELPER METHODS
|
// UI HELPER METHODS
|
||||||
|
|
||||||
getNodeIcon(page: Page): string {
|
getNodeIcon(page: Page): string {
|
||||||
if (page.name.toLowerCase() === 'home') {
|
if (page.name.toLowerCase() === 'home') {
|
||||||
return 'fas fa-home';
|
return 'fas fa-home';
|
||||||
@ -772,39 +776,43 @@ addCustomSection(): void {
|
|||||||
return 'fas fa-file';
|
return 'fas fa-file';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save tree data
|
// Save tree data
|
||||||
saveTreeData(silent: boolean = false): void {
|
saveTreeData(silent: boolean = false): void {
|
||||||
const outputData = this.generateOutputJson();
|
const outputData = this.generateOutputJson();
|
||||||
const jsonData = JSON.stringify(outputData, null, 2);
|
const jsonData = JSON.stringify(outputData, null, 2);
|
||||||
|
|
||||||
if (this.siteId) {
|
if (this.siteId) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
this.siteTreeService.update(this.siteId, {
|
this.siteTreeService.update(this.siteId, {
|
||||||
id: this.siteId,
|
id: this.siteId,
|
||||||
model: jsonData
|
model: jsonData
|
||||||
}).subscribe({
|
}).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.hasUnsavedChanges = false;
|
this.hasUnsavedChanges = false;
|
||||||
|
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
alert('Site structure saved successfully');
|
// alert('Site structure saved successfully');
|
||||||
|
this.toastr.success("Site structure saved successfully");
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
console.error('Error saving data:', err);
|
console.error('Error saving data:', err);
|
||||||
|
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
alert('Failed to save site structure');
|
// alert('Failed to save site structure');
|
||||||
|
this.toastr.error("Failed to save site structure");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('window:beforeunload', ['$event'])
|
@HostListener('window:beforeunload', ['$event'])
|
||||||
beforeUnloadHandler(event: BeforeUnloadEvent): void {
|
beforeUnloadHandler(event: BeforeUnloadEvent): void {
|
||||||
if (this.hasUnsavedChanges) {
|
if (this.hasUnsavedChanges) {
|
||||||
@ -812,7 +820,7 @@ addCustomSection(): void {
|
|||||||
event.returnValue = 'You have unsaved changes. Are you sure you want to leave?';
|
event.returnValue = 'You have unsaved changes. Are you sure you want to leave?';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('window:resize')
|
@HostListener('window:resize')
|
||||||
onWindowResize(): void {
|
onWindowResize(): void {
|
||||||
this.centerGrid();
|
this.centerGrid();
|
||||||
|
|||||||
@ -303,50 +303,106 @@ button:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ======= TESTIMONIAL SECTION ======= */
|
/* ======= TESTIMONIAL SECTION ======= */
|
||||||
|
/* 🔲 Main Section */
|
||||||
.testimonial-section {
|
.testimonial-section {
|
||||||
padding: 60px 20px;
|
padding: 80px 40px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
position: relative;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 🔳 Optional Background Overlay */
|
||||||
|
.testimonial-section::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testimonial-section > * {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🏷️ Heading */
|
||||||
.testimonial-heading {
|
.testimonial-heading {
|
||||||
font-size: 28px;
|
font-size: 2rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.testimonial-subtitle {
|
.testimonial-subtitle {
|
||||||
color: #666;
|
color: #ddd;
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 🧑💼 Grid Layout */
|
||||||
.testimonial-grid {
|
.testimonial-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
|
||||||
gap: 20px;
|
gap: 30px;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 📦 Testimonial Card */
|
||||||
.testimonial-card {
|
.testimonial-card {
|
||||||
background: white;
|
background: #fff;
|
||||||
padding: 20px;
|
color: #222;
|
||||||
|
padding: 25px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
|
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
|
||||||
max-width: 320px;
|
max-width: 320px;
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: center;
|
||||||
|
transition: transform 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.testimonial-card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🖼️ Avatar Wrapper with fallback */
|
||||||
|
.testimonial-avatar {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #ccc;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 0 auto 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testimonial-avatar img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🗣️ Quote Text */
|
||||||
|
.testimonial-card blockquote {
|
||||||
|
font-style: italic;
|
||||||
|
color: #444;
|
||||||
|
margin: 15px 0;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ⭐ Star Ratings */
|
||||||
.stars {
|
.stars {
|
||||||
color: #f39c12;
|
color: #f39c12;
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
.author {
|
/* 🔲 Placeholder block */
|
||||||
margin-top: 15px;
|
.profile {
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.author .avatar {
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.testimonial-card .profile {
|
|
||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
background: #ccc;
|
background: #ccc;
|
||||||
@ -354,10 +410,74 @@ button:hover {
|
|||||||
margin: 0 auto 10px;
|
margin: 0 auto 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.testimonial-card blockquote {
|
/* 🧑 Avatar image */
|
||||||
font-style: italic;
|
.avatar {
|
||||||
color: #444;
|
width: 50px;
|
||||||
margin: 10px 0;
|
height: 50px;
|
||||||
|
border-radius: 50%;
|
||||||
|
object-fit: cover;
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🧾 Author Info */
|
||||||
|
.author {
|
||||||
|
margin-top: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🟡 CTA Button */
|
||||||
|
.testimonial-cta {
|
||||||
|
display: inline-block;
|
||||||
|
margin-top: 40px;
|
||||||
|
background: #ffc107;
|
||||||
|
color: #000;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testimonial-cta:hover {
|
||||||
|
background: #e6ac00;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 📞 Contact Info */
|
||||||
|
.testimonial-contact {
|
||||||
|
margin-top: 30px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testimonial-contact p {
|
||||||
|
margin: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 📱 Responsive Adjustments */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.testimonial-heading {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testimonial-subtitle {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testimonial-card {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testimonial-grid {
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.testimonial-cta {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1250,25 +1370,105 @@ button {
|
|||||||
|
|
||||||
|
|
||||||
/* === FAQ === */
|
/* === FAQ === */
|
||||||
|
/* 🔲 Base Layout */
|
||||||
.faq-section {
|
.faq-section {
|
||||||
padding: 60px 20px;
|
padding: 60px 20px;
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Title and Subtitle */
|
||||||
.faq-title {
|
.faq-title {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.faq-subtitle {
|
.faq-subtitle {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
color: #666;
|
color: #666;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 🔍 Search Bar */
|
||||||
|
.faq-search {
|
||||||
|
padding: 12px 20px;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 400px;
|
||||||
|
font-size: 16px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
margin: 0 auto 40px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 📦 Illustration + List Wrapper */
|
||||||
|
.faq-content {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 40px;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🖼️ Left Illustration */
|
||||||
|
.faq-illustration {
|
||||||
|
flex: 1 1 40%;
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq-image {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ❓ Q&A List */
|
||||||
|
.faq-list {
|
||||||
|
flex: 1 1 55%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq-item {
|
||||||
|
border-bottom: 1px solid #eee;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🗂️ Q & A */
|
||||||
.faq-question {
|
.faq-question {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
|
font-size: 1.1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.faq-answer {
|
.faq-answer {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
color: #444;
|
color: #444;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 📱 Responsive */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.faq-content {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq-illustration,
|
||||||
|
.faq-list {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq-title {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.faq-question {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* === Logo Showcase === */
|
/* === Logo Showcase === */
|
||||||
@ -2612,6 +2812,95 @@ button.light {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.blog-template {
|
||||||
|
padding: 60px 30px;
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: auto;
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blog-header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blog-icon {
|
||||||
|
font-size: 2rem;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blog-title {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blog-nav ul {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blog-nav li {
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #007bff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blog-layout {
|
||||||
|
display: flex;
|
||||||
|
gap: 40px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blog-main {
|
||||||
|
flex: 1 1 65%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-block {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-heading {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-text {
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #444;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blog-sidebar {
|
||||||
|
flex: 1 1 30%;
|
||||||
|
background: #f9f9f9;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-widget {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.blog-layout {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
.blog-nav ul {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ✅ Clean and responsive logo section */
|
/* ✅ Clean and responsive logo section */
|
||||||
.logo-cloud {
|
.logo-cloud {
|
||||||
padding: 60px 20px;
|
padding: 60px 20px;
|
||||||
@ -2685,6 +2974,377 @@ button.light {
|
|||||||
background: #555;
|
background: #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* feature section */
|
||||||
|
/* 🔲 Feature Section Base */
|
||||||
|
.feature-section {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 60px 40px;
|
||||||
|
gap: 40px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🖼️ Image Block */
|
||||||
|
.feature-image {
|
||||||
|
flex: 1 1 40%;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 500px;
|
||||||
|
height: auto;
|
||||||
|
object-fit: contain;
|
||||||
|
display: block;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 📄 Text Content */
|
||||||
|
.feature-content {
|
||||||
|
flex: 1 1 50%;
|
||||||
|
max-width: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-description {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #555;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 📋 Feature List */
|
||||||
|
.feature-list {
|
||||||
|
list-style: none;
|
||||||
|
padding-left: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-list li {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 30px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 15px;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-list li::before {
|
||||||
|
content: "✔";
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
color: #008060;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🔁 Responsive Layout */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.feature-section {
|
||||||
|
flex-direction: column;
|
||||||
|
text-align: center;
|
||||||
|
gap: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-content {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-title {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-description {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feature-image {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* 🔲 SECTION WRAPPER */
|
||||||
|
.brand-guideline {
|
||||||
|
padding: 60px 30px;
|
||||||
|
max-width: 1000px;
|
||||||
|
margin: auto;
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🧾 PROJECT INFO */
|
||||||
|
.project-info {
|
||||||
|
margin-bottom: 40px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.brand-title {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.brand-meta {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🖼️ LOGO SECTION */
|
||||||
|
.logo-section {
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
.section-heading {
|
||||||
|
font-size: 1.3rem;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.logo-label {
|
||||||
|
font-weight: 600;
|
||||||
|
margin-top: 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.logo-img,
|
||||||
|
.logo-mono-group,
|
||||||
|
.logo-social-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🔳 INDIVIDUAL LOGOS */
|
||||||
|
.default-img {
|
||||||
|
max-height: 60px;
|
||||||
|
object-fit: contain;
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
padding: 6px;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.logo-primary {
|
||||||
|
height: 60px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-icon {
|
||||||
|
height: 40px;
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-mono {
|
||||||
|
height: 40px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-social-square,
|
||||||
|
.logo-social-round {
|
||||||
|
height: 40px;
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 🎨 BRAND COLORS */
|
||||||
|
.brand-colors {
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
.color-group {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 20px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.color-block {
|
||||||
|
width: 160px;
|
||||||
|
height: 100px;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 10px;
|
||||||
|
color: #000;
|
||||||
|
box-shadow: 0 2px 6px rgba(0,0,0,0.05);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.color-name {
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
.color-usage {
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🎨 COLOR BACKGROUNDS */
|
||||||
|
.color-block.primary-blue {
|
||||||
|
background-color: #1E9FFF;
|
||||||
|
}
|
||||||
|
.color-block.light-grey {
|
||||||
|
background-color: #C6CBD6;
|
||||||
|
}
|
||||||
|
.color-block.charcoal-black {
|
||||||
|
background-color: #2B2B2B;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.color-block.white {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ✍️ TYPOGRAPHY */
|
||||||
|
.typography-section {
|
||||||
|
margin-top: 40px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.font-block {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.font-role {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
.font-family {
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 📱 RESPONSIVE */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.logo-img,
|
||||||
|
.logo-mono-group,
|
||||||
|
.logo-social-group,
|
||||||
|
.color-group {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-block {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-primary,
|
||||||
|
.logo-icon,
|
||||||
|
.logo-mono,
|
||||||
|
.logo-social-square,
|
||||||
|
.logo-social-round {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-grid-section {
|
||||||
|
padding: 60px 30px;
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
||||||
|
gap: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-card {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-img.placeholder {
|
||||||
|
width: 100%;
|
||||||
|
height: 140px;
|
||||||
|
background-color: #eee;
|
||||||
|
border-radius: 6px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
background-image: url('/assets/images/placeholder.png');
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-title {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo-meta {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.logo-guideline {
|
||||||
|
padding: 60px 30px;
|
||||||
|
max-width: 1000px;
|
||||||
|
margin: auto;
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
.guideline-header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
.guideline-title {
|
||||||
|
font-size: 2rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.guideline-meta {
|
||||||
|
color: #666;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
.guideline-section {
|
||||||
|
margin-bottom: 50px;
|
||||||
|
}
|
||||||
|
.section-title {
|
||||||
|
font-size: 1.3rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.section-description {
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #444;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
.cover-version {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 1rem;
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
.cover-title {
|
||||||
|
font-size: 1.6rem;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 8px 0;
|
||||||
|
}
|
||||||
|
.cover-subtitle {
|
||||||
|
color: #666;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
.font-preview {
|
||||||
|
background: #f9f9f9;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 6px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.font-name {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.font-usage {
|
||||||
|
font-size: 0.95rem;
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
.placeholder {
|
||||||
|
background: #eee;
|
||||||
|
border-radius: 6px;
|
||||||
|
height: 180px;
|
||||||
|
background-image: url('/assets/images/placeholder.png');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
background-size: contain;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -324,7 +324,10 @@ HTML Only. No CSS.
|
|||||||
copyToClipboard(pageName: string) {
|
copyToClipboard(pageName: string) {
|
||||||
const fullHtml = Object.values(this.pageSections[pageName]).join('\n');
|
const fullHtml = Object.values(this.pageSections[pageName]).join('\n');
|
||||||
navigator.clipboard.writeText(fullHtml).then(() => {
|
navigator.clipboard.writeText(fullHtml).then(() => {
|
||||||
alert(`📋 HTML copied for page: ${pageName}`);
|
// alert(`📋 HTML copied for page: ${pageName}`);
|
||||||
|
this.toastr.success(`📋 HTML copied for page: ${pageName}`);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 782 B After Width: | Height: | Size: 782 B |
Loading…
x
Reference in New Issue
Block a user