13 Commits

Author SHA1 Message Date
7cc5cbaac3 Nx migration 2024-05-13 16:59:23 +03:00
cf6128c248 Обновить README.md 2024-03-11 15:38:56 +03:00
1fd6dd632e Merge pull request 'Some additions' (#4) from dev into master
Reviewed-on: #4
2024-03-11 15:37:03 +03:00
e291379602 Icon title translate 2024-03-11 14:37:32 +03:00
1237ee4439 Style updates 2024-03-10 14:36:37 +03:00
935d1f5dd9 Modal window btns cursor fix 2024-03-10 13:56:25 +03:00
2a31e85e50 Hide lang modal on click 2024-03-10 13:56:09 +03:00
c4665737dc Lang save 2024-03-10 13:53:57 +03:00
e3dac5bc83 Merge pull request 'Modal window and translations' (#3) from dev into master
Reviewed-on: #3
2024-03-10 00:20:08 +03:00
90582949d5 Added i18n translations 2024-03-10 00:14:00 +03:00
a9436a5af7 Min sizes 2024-03-09 18:25:06 +03:00
8cd5dd1f8e Added info modal window 2024-03-09 18:16:20 +03:00
f9a7b812fe Merge pull request 'Full reformat' (#2) from dev into master
Reviewed-on: #2
2024-03-09 14:07:55 +03:00
75 changed files with 13669 additions and 5867 deletions

View File

@@ -1,13 +1,9 @@
{ {
"root": true, "root": true,
"ignorePatterns": [ "ignorePatterns": ["**/*"],
"projects/**/*"
],
"overrides": [ "overrides": [
{ {
"files": [ "files": ["*.ts"],
"*.ts"
],
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
@@ -34,14 +30,31 @@
} }
}, },
{ {
"files": [ "files": ["*.html"],
"*.html"
],
"extends": [ "extends": [
"plugin:@angular-eslint/template/recommended", "plugin:@angular-eslint/template/recommended",
"plugin:@angular-eslint/template/accessibility" "plugin:@angular-eslint/template/accessibility"
], ],
"rules": {} "rules": {}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
} }
] ]
} }
]
}
}
],
"plugins": ["@nx"]
}

7
.gitignore vendored
View File

@@ -40,3 +40,10 @@ testem.log
# System files # System files
.DS_Store .DS_Store
Thumbs.db Thumbs.db
.nx/cache
# env
*.env*
!*.env.example

4
.prettierignore Normal file
View File

@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache

View File

@@ -1,4 +1,8 @@
{ {
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 "recommendations": [
"recommendations": ["angular.ng-template"] "angular.ng-template",
"nrwl.angular-console",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
} }

View File

@@ -7,6 +7,6 @@
"**/.DS_Store": true, "**/.DS_Store": true,
"**/Thumbs.db": true, "**/Thumbs.db": true,
"**/node_modules": true, "**/node_modules": true,
"**/.angular": true, "**/.angular": true
} }
} }

View File

@@ -2,26 +2,6 @@
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.2.2. This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.2.2.
## Development server ## Visitor counter
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files. ![NwaifuWeb](https://count.getloli.com/get/@NwaifuWeb?theme=gelbooru)
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.

View File

@@ -1,116 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"cli": {
"packageManager": "pnpm",
"schematicCollections": [
"@angular-eslint/schematics"
]
},
"newProjectRoot": "projects",
"projects": {
"NwaifuWeb": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "less"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/nwaifu-web",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "less",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.less"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "NwaifuWeb:build:production"
},
"development": {
"buildTarget": "NwaifuWeb:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "NwaifuWeb:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "less",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.less"
],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
}
}

View File

@@ -0,0 +1,41 @@
{
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": [
"plugin:@angular-eslint/template/recommended",
"plugin:@angular-eslint/template/accessibility"
],
"rules": {}
}
],
"extends": "../../.eslintrc.json"
}

View File

@@ -0,0 +1,86 @@
{
"name": "NwaifuWeb",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"generators": {
"@schematics/angular:component": {
"style": "less"
}
},
"sourceRoot": "apps/NwaifuWeb/src",
"prefix": "app",
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/apps/NwaifuWeb",
"index": "apps/NwaifuWeb/src/index.html",
"browser": "apps/NwaifuWeb/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/NwaifuWeb/tsconfig.app.json",
"inlineStyleLanguage": "less",
"assets": ["apps/NwaifuWeb/src/favicon.ico", "apps/NwaifuWeb/src/assets"],
"styles": ["apps/NwaifuWeb/src/styles.less"],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"buildTarget": "NwaifuWeb:build:production"
},
"development": {
"buildTarget": "NwaifuWeb:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "NwaifuWeb:build"
}
},
"test": {
"executor": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "apps/NwaifuWeb/tsconfig.spec.json",
"inlineStyleLanguage": "less",
"assets": ["apps/NwaifuWeb/src/favicon.ico", "apps/NwaifuWeb/src/assets"],
"styles": ["apps/NwaifuWeb/src/styles.less"],
"scripts": []
}
},
"lint": {
"executor": "@nx/eslint:lint",
"options": {
"lintFilePatterns": ["apps/NwaifuWeb/**/*.ts", "apps/NwaifuWeb/**/*.html"]
}
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
.main {
display: block;
width: 100%;
height: calc(100% - 2rem);
background-image: url("../assets/img/wallpaper.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}

View File

@@ -1,14 +1,14 @@
import { TestBed } from '@angular/core/testing'; import { TestBed } from "@angular/core/testing";
import { AppComponent } from './app.component'; import { AppComponent } from "./app.component";
describe('AppComponent', () => { describe("AppComponent", () => {
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [AppComponent], imports: [AppComponent],
}).compileComponents(); }).compileComponents();
}); });
it('should create the app', () => { it("should create the app", () => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance; const app = fixture.componentInstance;
expect(app).toBeTruthy(); expect(app).toBeTruthy();
@@ -17,13 +17,13 @@ describe('AppComponent', () => {
it(`should have the 'NwaifuWeb' title`, () => { it(`should have the 'NwaifuWeb' title`, () => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance; const app = fixture.componentInstance;
expect(app.title).toEqual('NwaifuWeb'); expect(app.title).toEqual("NwaifuWeb");
}); });
it('should render title', () => { it("should render title", () => {
const fixture = TestBed.createComponent(AppComponent); const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges(); fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement; const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, NwaifuWeb'); expect(compiled.querySelector("h1")?.textContent).toContain("Hello, NwaifuWeb");
}); });
}); });

View File

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

View File

@@ -0,0 +1,25 @@
import { APP_INITIALIZER, ApplicationConfig } from "@angular/core";
import { provideHttpClient } from "@angular/common/http";
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
import { TranslateService } from "./services/translate.service";
export function setupTranslateServiceFactory(service: TranslateService) {
const lang = localStorage.getItem("lang") ?? "en";
return () => service.use(lang);
}
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes),
provideHttpClient(),
TranslateService,
{
provide: APP_INITIALIZER,
useFactory: setupTranslateServiceFactory,
deps: [TranslateService],
multi: true,
},
],
};

View File

@@ -0,0 +1,19 @@
import { Routes } from "@angular/router";
import { MainPageComponent } from './pages/main/main.component';
import { SecondComponent } from './pages/second/second.component';
export const routes: Routes = [
{
path: '',
children: [
{
path: '',
component: MainPageComponent
},
{
path: 'second',
component: SecondComponent
}
]
},
];

View File

@@ -0,0 +1,4 @@
<div class="desktop-icon">
<img [src]="image" [alt]="alt" [title]="name" />
<span>{{ name }}</span>
</div>

View File

@@ -0,0 +1,9 @@
.desktop-icon {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 3rem;
height: 3rem;
color: white;
}

View File

@@ -0,0 +1,16 @@
import { CommonModule } from '@angular/common';
import { Component, Input } from '@angular/core';
import { RouterModule } from '@angular/router';
@Component({
selector: 'desktop-icon',
templateUrl: './desktop-icon.component.html',
styleUrls: ['./desktop-icon.component.less'],
standalone: true,
imports: [CommonModule, RouterModule]
})
export class DesktopIconComponent {
@Input() image: string = '';
@Input() alt: string = '';
@Input() name: string = '';
}

View File

@@ -16,19 +16,19 @@ export class DockComponent {
id: 0, id: 0,
svg: "../../../assets/svg/logo-telegram.svg", svg: "../../../assets/svg/logo-telegram.svg",
url: "https://t.me/neur0w0men", url: "https://t.me/neur0w0men",
text: "Telegram channel", text: "TELEGRAM_LABEL",
}, },
{ {
id: 1, id: 1,
svg: "../../../assets/svg/logo-github.svg", svg: "../../../assets/svg/logo-github.svg",
url: "https://github.com/MrSedan", url: "https://github.com/MrSedan",
text: "Admin's GitHub", text: "GITHUB_LABEL",
}, },
{ {
id: 2, id: 2,
svg: "../../../assets/svg/logo-gitea.svg", svg: "../../../assets/svg/logo-gitea.svg",
url: "https://git.nwaifu.su", url: "https://git.nwaifu.su",
text: "Gitea", text: "GITEA_LABEL",
}, },
]; ];
} }

View File

@@ -0,0 +1,4 @@
<a [href]="url">
<img [src]="svg" [alt]="url" [title]="text | translate" />
<span>{{ text | translate }}</span>
</a>

View File

@@ -10,7 +10,7 @@ a {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
gap: 0; gap: 0;
transition: 0.3s ease-in-out; transition: 0.5s ease-in-out;
span { span {
opacity: 0; opacity: 0;
visibility: hidden; visibility: hidden;
@@ -21,7 +21,7 @@ a {
font-size: 0.8rem; font-size: 0.8rem;
height: 0; height: 0;
font-weight: 600; font-weight: 600;
transition: opacity 0.3s ease-in-out; transition: all 0.6s ease-in-out;
} }
&:hover { &:hover {
transform: translateY(-1rem); transform: translateY(-1rem);

View File

@@ -1,10 +1,11 @@
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component, Input } from "@angular/core"; import { Component, Input } from "@angular/core";
import { TranslationPipe } from "../../pipes/translation.pipe";
@Component({ @Component({
standalone: true, standalone: true,
selector: "app-link", selector: "app-link",
imports: [CommonModule], imports: [CommonModule, TranslationPipe],
templateUrl: "./link.component.html", templateUrl: "./link.component.html",
styleUrls: ["./link.component.less"], styleUrls: ["./link.component.less"],
}) })

View File

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

View File

@@ -0,0 +1,31 @@
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",
minWidth: "300px",
minHeight: "10rem",
});
}
}

View File

@@ -0,0 +1,29 @@
<div class="panel">
<div class="desktops">
<div class="ellipse"></div>
<div class="circle"></div>
</div>
<div class="time">
<span>{{ time }}</span>
</div>
<div class="right-menu">
<span
class="lang cursor-pointer"
(click)="toggleModal()"
(keydown)="toggleModal()"
tabindex="0"
#lang_btn
>{{ getLang() }}</span
>
<a href="https://git.nwaifu.su/neuro_llc/NwaifuWeb" [title]="source_code_btn_title | translate">
<fa-icon [icon]="faGithub" class="sourcecode-icon"></fa-icon>
</a>
<fa-icon [icon]="faVolume"></fa-icon>
<fa-icon [icon]="faPower"></fa-icon>
</div>
</div>
<div class="lang-choose" #lang_modal>
<p (click)="useLang('en')" (keypress)="useLang('en')" tabindex="0"><b>en</b> - English</p>
<p (click)="useLang('ru')" (keypress)="useLang('ru')" tabindex="0"><b>ru</b> - Русский</p>
<p (click)="useLang('ja')" (keypress)="useLang('ja')" tabindex="0"><b>ja</b> - 日本語</p>
</div>

View File

@@ -1,4 +1,5 @@
.panel { .panel {
z-index: 99999;
position: relative; position: relative;
left: 0; left: 0;
top: 0; top: 0;
@@ -56,9 +57,51 @@
align-items: center; align-items: center;
span { span {
font-weight: 600; font-weight: 600;
user-select: none;
-webkit-user-select: none;
} }
fa-icon { fa-icon {
font-size: 1.2rem; font-size: 1.2rem;
cursor: pointer; cursor: pointer;
} }
} }
.lang-choose {
position: absolute;
display: none;
&.active {
display: flex;
}
top: 0;
flex-direction: column;
justify-content: space-around;
gap: 0;
background-color: var(--black);
margin-block-start: 3rem;
z-index: 9999;
margin-inline-end: 1rem;
color: var(--white);
padding: 1rem 0;
border-radius: 15px;
&::before {
content: "";
position: absolute;
left: 50%;
transform: translateX(-50%) rotate(45deg);
vertical-align: middle;
top: -0.5rem;
width: 0;
height: 0;
border: 10px solid var(--black);
}
p {
line-height: 2rem;
width: 100%;
padding: 0.5rem 1rem;
user-select: none;
-webkit-user-select: none;
cursor: pointer;
&:hover {
background-color: #000;
}
}
}

View File

@@ -0,0 +1,88 @@
import { CommonModule } from "@angular/common";
import { Component, ElementRef, HostListener, ViewChild } from "@angular/core";
import { FontAwesomeModule } from "@fortawesome/angular-fontawesome";
import { faGithub } from "@fortawesome/free-brands-svg-icons";
import { faPowerOff, faVolumeHigh } from "@fortawesome/free-solid-svg-icons";
import { TranslationPipe } from "../../pipes/translation.pipe";
import { PanelSevice } from "../../services/panel.service";
import { TranslateService } from "../../services/translate.service";
@Component({
standalone: true,
selector: "app-panel",
imports: [CommonModule, FontAwesomeModule, TranslationPipe],
templateUrl: "./panel.component.html",
styleUrls: ["./panel.component.less"],
})
export class PanelComponent {
source_code_btn_title = "SOURCE_CODE_TITLE";
public time = "";
faGithub = faGithub;
faVolume = faVolumeHigh;
faPower = faPowerOff;
showLangModalBool = false;
@ViewChild("lang_modal") langModal: ElementRef<HTMLDivElement> | null = null;
@ViewChild("lang_btn") langBtn: ElementRef<HTMLSpanElement> | null = null;
constructor(private panelService: PanelSevice, private translateService: TranslateService) {
this.time = this.getTime();
setInterval(() => {
this.time = this.getTime();
}, 1000);
}
private getTime() {
const time = this.panelService.getTime();
return time.toLocaleDateString(this.translateService.translate("TIME_SCHEMA"), {
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric",
});
}
goToSource() {
window.open("https://git.nwaifu.su/neuro_llc/NwaifuWeb", "_blank");
}
@HostListener("window:resize")
private moveLangModal() {
if (!this.langModal || !this.langBtn) {
return;
}
const x = this.langBtn.nativeElement.getBoundingClientRect().x;
this.langModal.nativeElement.style.left = `calc(${x}px - 3.5rem)`;
}
@HostListener("window:click", ["$event"])
private closeLangModal(event: MouseEvent) {
if (
this.langModal &&
this.langBtn &&
!this.langModal.nativeElement.contains(event.target as Node) &&
!this.langBtn.nativeElement.contains(event.target as Node)
) {
this.langModal.nativeElement.classList.remove("active");
}
}
toggleModal() {
if (this.langModal) {
this.langModal.nativeElement.classList.toggle("active");
if (this.langModal.nativeElement.classList.contains("active")) {
this.moveLangModal();
}
}
}
useLang(lang: string) {
this.langModal && this.langModal.nativeElement.classList.remove("active");
this.translateService.use(lang);
}
getLang() {
return this.translateService.lang;
}
}

View File

@@ -0,0 +1,10 @@
<div class="panel">
<span>{{ modal_title | translate }}</span>
<div class="btns">
<fa-icon [icon]="faMenu"></fa-icon>
<fa-icon [icon]="faClose"></fa-icon>
</div>
</div>
<div class="content">
<h1>{{ modal_text | translate }}</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,22 @@
import { CommonModule } from "@angular/common";
import { Component } from "@angular/core";
import { FontAwesomeModule } from "@fortawesome/angular-fontawesome";
import { faBars, faXmark } from "@fortawesome/free-solid-svg-icons";
import { DialogRef } from "@ngneat/dialog";
import { TranslationPipe } from "../../pipes/translation.pipe";
@Component({
selector: "app-window",
standalone: true,
imports: [CommonModule, FontAwesomeModule, TranslationPipe],
templateUrl: "./window.component.html",
styleUrls: ["./window.component.less"],
// changeDetection: ChangeDetectionStrategy.OnPush,
})
export class WindowComponent {
modal_text = "MODAL_TEXT";
modal_title = "MODAL_TITLE";
faClose = faXmark;
faMenu = faBars;
constructor(public ref: DialogRef) {}
}

View File

@@ -0,0 +1,3 @@
<desktop-icon alt='test' name='test' image='../../../assets/svg/logo-gitea.svg'></desktop-icon>
<app-modal></app-modal>
<app-dock></app-dock>

View File

@@ -0,0 +1,14 @@
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { DesktopIconComponent } from '../../modules/desktop-icon/desktop-icon.component';
import { DockComponent } from '../../modules/dock/dock.component';
import { ModalComponent } from '../../modules/modal/modal.component';
@Component({
selector: 'app-main-page',
templateUrl: './main.component.html',
styleUrls: ['./main.component.less'],
imports: [DockComponent, ModalComponent, CommonModule, DesktopIconComponent],
standalone: true
})
export class MainPageComponent {}

View File

@@ -0,0 +1 @@
<h1>Test</h1>

View File

@@ -0,0 +1,12 @@
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
@Component({
selector: 'app-second',
templateUrl: './second.component.html',
styleUrls: ['./second.component.less'],
standalone: true,
imports: [CommonModule]
})
export class SecondComponent {
}

View File

@@ -0,0 +1,14 @@
import { Pipe, PipeTransform } from "@angular/core";
import { TranslateService } from "../services/translate.service";
@Pipe({
name: "translate",
standalone: true,
pure: false,
})
export class TranslationPipe implements PipeTransform {
constructor(private translateService: TranslateService) {}
transform(key: string) {
return this.translateService.data[key] ?? key;
}
}

View File

@@ -0,0 +1,31 @@
import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
@Injectable({ providedIn: "root" })
export class TranslateService {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: Record<string, any> = {};
lang: string | null = null;
constructor(private http: HttpClient) {}
use(lang: string): Promise<object> {
this.lang = lang ?? "en";
localStorage.setItem("lang", this.lang);
return new Promise<object>((resolve) => {
const langPath = `assets/i18n/${this.lang}.json`;
this.http.get(langPath).subscribe({
next: (response) => {
this.data = response ?? {};
resolve(this.data);
},
error: () => {
this.data = {};
resolve(this.data);
},
});
});
}
translate(key: string) {
return this.data[key] ?? key;
}
}

View File

@@ -0,0 +1,9 @@
{
"MODAL_TITLE": "Info",
"TIME_SCHEMA": "en-US",
"MODAL_TEXT": "Hello, World!",
"TELEGRAM_LABEL": "Telegram channel",
"GITHUB_LABEL": "Admin's Github",
"GITEA_LABEL": "Neuro LLC Gitea",
"SOURCE_CODE_TITLE": "Source code"
}

View File

@@ -0,0 +1,9 @@
{
"MODAL_TITLE": "情報",
"TIME_SCHEMA": "ja-JP",
"MODAL_TEXT": "こんにちは、世界!",
"TELEGRAM_LABEL": "Telegramチャンネル",
"GITHUB_LABEL": "管理者Github",
"GITEA_LABEL": "Neuro LLC Gitea",
"SOURCE_CODE_TITLE": "ソースコード"
}

View File

@@ -0,0 +1,9 @@
{
"MODAL_TITLE": "Информация",
"TIME_SCHEMA": "ru-RU",
"MODAL_TEXT": "Здравствуйте, мир!",
"TELEGRAM_LABEL": "Телеграм канал",
"GITHUB_LABEL": "Github админа",
"GITEA_LABEL": "Neuro LLC Gitea",
"SOURCE_CODE_TITLE": "Исходный код"
}

View File

Before

Width:  |  Height:  |  Size: 470 KiB

After

Width:  |  Height:  |  Size: 470 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,5 @@
import { bootstrapApplication } from "@angular/platform-browser";
import { appConfig } from "./app/app.config";
import { AppComponent } from "./app/app.component";
bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));

View File

@@ -35,3 +35,25 @@ body {
top: 0; top: 0;
left: 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 {
z-index: 999;
cursor: not-allowed;
}
}
.ngneat-drag-marker {
height: 3rem;
}
}
}
}

View File

@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": []
},
"files": ["src/main.ts"],
"include": ["src/**/*.d.ts"]
}

View File

@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"types": ["jasmine"]
},
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
}

43
karma.conf.js Normal file
View File

@@ -0,0 +1,43 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
const { join } = require("path");
const { constants } = require("karma");
module.exports = () => {
return {
basePath: "",
frameworks: ["jasmine", "@angular-devkit/build-angular"],
plugins: [
require("karma-jasmine"),
require("karma-chrome-launcher"),
require("karma-jasmine-html-reporter"),
require("karma-coverage"),
require("@angular-devkit/build-angular/plugins/karma"),
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true, // removes the duplicated traces
},
coverageReporter: {
dir: join(__dirname, "./coverage"),
subdir: ".",
reporters: [{ type: "html" }, { type: "text-summary" }],
},
reporters: ["progress", "kjhtml"],
port: 9876,
colors: true,
logLevel: constants.LOG_INFO,
autoWatch: true,
browsers: ["Chrome"],
singleRun: true,
};
};

0
libs/.gitkeep Normal file
View File

1
nx-cloud.env.example Normal file
View File

@@ -0,0 +1 @@
NX_CLOUD_ACCESS_TOKEN=TOKEN

40
nx.json Normal file
View File

@@ -0,0 +1,40 @@
{
"defaultBase": "main",
"namedInputs": {
"sharedGlobals": [],
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": [
"default",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/**/*.spec.[jt]s",
"!{projectRoot}/karma.conf.js",
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/eslint.config.js"
]
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"],
"cache": true
},
"test": {
"inputs": ["default", "^production", "{workspaceRoot}/karma.conf.js"],
"cache": true
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json", "{workspaceRoot}/eslint.config.js"],
"cache": true
},
"@nx/eslint:lint": {
"cache": true,
"inputs": [
"default",
"{workspaceRoot}/.eslintrc.json",
"{workspaceRoot}/.eslintignore",
"{workspaceRoot}/eslint.config.js"
]
}
},
"nxCloudAccessToken": "${NX_CLOUD_ACCESS_TOKEN}"
}

View File

@@ -3,11 +3,11 @@
"version": "0.0.1", "version": "0.0.1",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "nx serve NwaifuWeb",
"build": "ng build --base-href https://nwaifu.su/ --configuration production", "build": "nx build NwaifuWeb --base-href https://nwaifu.su/ --configuration production",
"watch": "ng build --watch --configuration development", "watch": "nx build NwaifuWeb --watch --configuration development",
"test": "ng test", "test": "nx test",
"lint": "ng lint" "lint": "nx lint"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
@@ -24,31 +24,42 @@
"@fortawesome/free-brands-svg-icons": "^6.4.2", "@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2", "@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2", "@fortawesome/free-solid-svg-icons": "^6.4.2",
"@ngneat/dialog": "5.0.0",
"rxjs": "~7.8.0", "rxjs": "~7.8.0",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"zone.js": "~0.14.3" "zone.js": "~0.14.3"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "^17.2.2", "@angular-devkit/build-angular": "^17.2.2",
"@angular-eslint/builder": "17.2.1", "@angular-devkit/core": "^17.2.2",
"@angular-devkit/schematics": "^17.2.2",
"@angular-eslint/eslint-plugin": "17.2.1", "@angular-eslint/eslint-plugin": "17.2.1",
"@angular-eslint/eslint-plugin-template": "17.2.1", "@angular-eslint/eslint-plugin-template": "17.2.1",
"@angular-eslint/schematics": "17.2.1",
"@angular-eslint/template-parser": "17.2.1", "@angular-eslint/template-parser": "17.2.1",
"@angular/cli": "^17.2.2", "@angular/cli": "^17.2.2",
"@angular/compiler-cli": "^17.2.0", "@angular/compiler-cli": "^17.2.0",
"@nx/angular": "19.0.2",
"@nx/eslint": "19.0.2",
"@nx/js": "19.0.2",
"@nx/workspace": "19.0.2",
"@schematics/angular": "^17.2.2",
"@swc-node/register": "~1.8.0",
"@swc/core": "~1.3.85",
"@swc/helpers": "~0.5.2",
"@types/jasmine": "~5.1.0", "@types/jasmine": "~5.1.0",
"@typescript-eslint/eslint-plugin": "6.19.0", "@typescript-eslint/eslint-plugin": "6.19.0",
"@typescript-eslint/parser": "6.19.0", "@typescript-eslint/parser": "6.19.0",
"autoprefixer": "^10.4.18", "autoprefixer": "^10.4.18",
"eslint": "^8.56.0", "eslint": "~8.57.0",
"jasmine-core": "~5.1.0", "jasmine-core": "~5.1.0",
"karma": "~6.4.0", "karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0", "karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0", "karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0", "karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0", "karma-jasmine-html-reporter": "~2.1.0",
"nx": "19.0.2",
"postcss": "^8.4.35", "postcss": "^8.4.35",
"prettier": "^2.6.2",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.1",
"typescript": "~5.3.2" "typescript": "~5.3.2"
} }

18318
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
.main {
display: block;
width: 100%;
height: calc(100% - 2rem);
background: url("../assets/img/wallpaper.png");
background-size: cover;
}

View File

@@ -1,8 +0,0 @@
import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [provideRouter(routes)]
};

View File

@@ -1,3 +0,0 @@
import { Routes } from '@angular/router';
export const routes: Routes = [];

View File

@@ -1,4 +0,0 @@
<a [href]="url">
<img [src]="svg" [alt]="url" [title]="text" />
<span>{{ text }}</span>
</a>

View File

@@ -1,17 +0,0 @@
<div class="panel">
<div class="desktops">
<div class="ellipse"></div>
<div class="circle"></div>
</div>
<div class="time">
<span>{{ time }}</span>
</div>
<div class="right-menu">
<span class="lang">en</span>
<a href="https://git.nwaifu.su/neuro_llc/NwaifuWeb">
<fa-icon [icon]="faGithub" class="sourcecode-icon" title="Source code"></fa-icon>
</a>
<fa-icon [icon]="faVolume"></fa-icon>
<fa-icon [icon]="faPower"></fa-icon>
</div>
</div>

View File

@@ -1,40 +0,0 @@
import { CommonModule } from "@angular/common";
import { Component } from "@angular/core";
import { FontAwesomeModule } from "@fortawesome/angular-fontawesome";
import { faGithub } from "@fortawesome/free-brands-svg-icons";
import { faPowerOff, faVolumeHigh } from "@fortawesome/free-solid-svg-icons";
import { PanelSevice } from "../../services/panel.service";
@Component({
standalone: true,
selector: "app-panel",
imports: [CommonModule, FontAwesomeModule],
templateUrl: "./panel.component.html",
styleUrls: ["./panel.component.less"],
})
export class PanelComponent {
public time = "";
faGithub = faGithub;
faVolume = faVolumeHigh;
faPower = faPowerOff;
constructor(private panelService: PanelSevice) {
this.time = this.getTime();
setInterval(() => {
this.time = this.getTime();
}, 1000);
}
private getTime() {
const time = this.panelService.getTime();
return time.toLocaleDateString("en-US", {
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric",
});
}
goToSource() {
window.open("https://git.nwaifu.su/neuro_llc/NwaifuWeb", "_blank");
}
}

View File

@@ -1,6 +0,0 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, appConfig)
.catch((err) => console.error(err));

View File

12
tools/tsconfig.tools.json Normal file
View File

@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "../dist/out-tsc/tools",
"rootDir": ".",
"module": "commonjs",
"target": "es5",
"types": ["node"],
"importHelpers": false
},
"include": ["**/*.ts"]
}

View File

@@ -1,14 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
]
}

View File

@@ -1,4 +1,3 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{ {
"compileOnSave": false, "compileOnSave": false,
"compilerOptions": { "compilerOptions": {
@@ -19,15 +18,16 @@
"target": "ES2022", "target": "ES2022",
"module": "ES2022", "module": "ES2022",
"useDefineForClassFields": false, "useDefineForClassFields": false,
"lib": [ "lib": ["ES2022", "dom"],
"ES2022", "paths": {},
"dom" "baseUrl": ".",
] "rootDir": "."
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false, "enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true, "strictInjectionParameters": true,
"strictInputAccessModifiers": true, "strictInputAccessModifiers": true,
"strictTemplates": true "strictTemplates": true
} },
"exclude": ["node_modules", "tmp"]
} }

View File

@@ -1,14 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}