Modal window and translations #3

Merged
sergey merged 3 commits from dev into master 2024-03-10 00:20:09 +03:00
13 changed files with 128 additions and 5 deletions
Showing only changes of commit 8cd5dd1f8e - Show all commits

View File

@@ -24,6 +24,7 @@
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@ngneat/dialog": "5.0.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.3"

18
pnpm-lock.yaml generated
View File

@@ -44,6 +44,9 @@ dependencies:
'@fortawesome/free-solid-svg-icons':
specifier: ^6.4.2
version: 6.5.1
'@ngneat/dialog':
specifier: 5.0.0
version: 5.0.0(@angular/core@17.2.3)
rxjs:
specifier: ~7.8.0
version: 7.8.1
@@ -2433,6 +2436,15 @@ packages:
call-bind: 1.0.7
dev: true
/@ngneat/dialog@5.0.0(@angular/core@17.2.3):
resolution: {integrity: sha512-+qLGaLcNXQ5PVtlv4htqHsJ4JV9TZ+wy89rtYMsno/jZuB63usMITPEB7TgtEPgpbyDDcYVagA6eQqYMEgZPOA==}
peerDependencies:
'@angular/core': '>=17.0.0'
dependencies:
'@angular/core': 17.2.3(rxjs@7.8.1)(zone.js@0.14.4)
tslib: 2.3.1
dev: false
/@ngtools/webpack@17.2.2(@angular/compiler-cli@17.2.3)(typescript@5.3.3)(webpack@5.90.1):
resolution: {integrity: sha512-HgvClGO6WVq4VA5d0ZvlDG5hrj8lQzRH99Gt87URm7G8E5XkatysdOsMqUQsJz+OwFWhP4PvTRWVblpBDiDl/A==}
engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'}
@@ -5893,8 +5905,6 @@ packages:
peerDependenciesMeta:
webpack:
optional: true
webpack-sources:
optional: true
dependencies:
webpack: 5.90.1(esbuild@0.20.0)
webpack-sources: 3.2.3
@@ -8054,6 +8064,10 @@ packages:
strip-bom: 3.0.0
dev: true
/tslib@2.3.1:
resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==}
dev: false
/tslib@2.6.2:
resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==}

View File

@@ -2,5 +2,6 @@
<app-panel></app-panel>
</header>
<main class="main">
<app-modal></app-modal>
<app-dock></app-dock>
</main>

View File

@@ -2,6 +2,7 @@
display: block;
width: 100%;
height: calc(100% - 2rem);
background: url("../assets/img/wallpaper.png");
background-size: cover;
background-image: url("../assets/img/wallpaper.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}

View File

@@ -1,12 +1,13 @@
import { Component } from "@angular/core";
import { RouterOutlet } from "@angular/router";
import { DockComponent } from "./modules/dock/dock.component";
import { ModalComponent } from "./modules/modal/modal.component";
import { PanelComponent } from "./modules/panel/panel.component";
@Component({
selector: "app-root",
standalone: true,
imports: [RouterOutlet, PanelComponent, DockComponent],
imports: [RouterOutlet, PanelComponent, DockComponent, ModalComponent],
templateUrl: "./app.component.html",
styleUrl: "./app.component.less",
})

View File

@@ -0,0 +1 @@
<div class="modal-window" #modal></div>

View File

@@ -0,0 +1,29 @@
import { CommonModule } from "@angular/common";
import { AfterViewInit, Component, ElementRef, ViewChild } from "@angular/core";
import { DialogRef, DialogService } from "@ngneat/dialog";
import { WindowComponent } from "../window/window.component";
@Component({
selector: "app-modal",
templateUrl: "./modal.component.html",
styleUrls: ["./modal.component.less"],
imports: [CommonModule],
standalone: true,
})
export class ModalComponent implements AfterViewInit {
dialogRef: DialogRef | undefined = undefined;
@ViewChild("modal") modal: ElementRef | undefined = undefined;
constructor(private dialogService: DialogService, private ref: ElementRef) {}
ngAfterViewInit(): void {
this.dialogRef = this.dialogService.open(WindowComponent, {
resizable: true,
draggable: true,
backdrop: false,
closeButton: false,
container: this.modal ?? this.ref,
enableClose: false,
dragConstraint: "constrain",
id: "info-modal",
});
}
}

View File

@@ -1,4 +1,5 @@
.panel {
z-index: 99999;
position: relative;
left: 0;
top: 0;

View File

@@ -0,0 +1,10 @@
<div class="panel">
<span>Info</span>
<div class="btns">
<fa-icon [icon]="faMenu"></fa-icon>
<fa-icon [icon]="faClose"></fa-icon>
</div>
</div>
<div class="content">
<h1>Hello</h1>
</div>

View File

@@ -0,0 +1,24 @@
.panel {
width: 100%;
display: flex;
height: 3rem;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0 1rem;
background-color: var(--black);
color: var(--white);
span {
font-size: 600;
}
.btns {
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
gap: 1rem;
}
}
.content {
margin: 1rem;
}

View File

@@ -0,0 +1,19 @@
import { CommonModule } from "@angular/common";
import { ChangeDetectionStrategy, Component } from "@angular/core";
import { FontAwesomeModule } from "@fortawesome/angular-fontawesome";
import { faBars, faXmark } from "@fortawesome/free-solid-svg-icons";
import { DialogRef } from "@ngneat/dialog";
@Component({
selector: "app-window",
standalone: true,
imports: [CommonModule, FontAwesomeModule],
templateUrl: "./window.component.html",
styleUrls: ["./window.component.less"],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class WindowComponent {
faClose = faXmark;
faMenu = faBars;
constructor(public ref: DialogRef) {}
}

View File

@@ -35,3 +35,24 @@ body {
top: 0;
left: 0;
}
ngneat-dialog {
.ngneat-dialog-backdrop {
pointer-events: none;
.ngneat-dialog-content {
pointer-events: all;
border-radius: 10px;
span {
font-weight: 600;
user-select: none;
}
.btns {
fa-icon {
cursor: pointer;
}
}
.ngneat-drag-marker {
height: 3rem;
}
}
}
}