From 9f463a81f5b33a72acee7fc9ed8ebf4340e385de Mon Sep 17 00:00:00 2001 From: Kwong Tung Nan Date: Fri, 21 Jun 2024 19:58:54 +0800 Subject: [PATCH] dev: Gallery to be standalone --- src/app/app-routing.module.ts | 16 ++++++---------- src/app/gallery/gallery.component.ts | 7 ++++++- src/app/gallery/gallery.module.ts | 14 -------------- 3 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 src/app/gallery/gallery.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index c4a232af..b85d1b3a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -8,7 +8,6 @@ import { import { RouterModule, Routes } from "@angular/router"; import { ConstructionComponent } from "./construction/construction.component"; -import { GalleryComponent } from "./gallery/gallery.component"; import { InsidenMainComponent } from "./insiden/insiden.component"; import { SituasiComponent } from "./situasi/situasi.component"; @@ -88,20 +87,17 @@ const routes: Routes = [ { path: "gallery", title: "MLPTF | Gallery", - loadChildren: async () => { + loadComponent: () => { if (maintenance.gallery.curentlyInMaintenance) { - const module = await import( - "./construction/construction.module" + return import("./construction/construction.component").then( + (m) => m.ConstructionComponent ); - return module.ConstructionModule; } else { - const module = await import("./gallery/gallery.module"); - return module.GalleryModule; + return import("./gallery/gallery.component").then( + (m) => m.GalleryComponent + ); } }, - component: maintenance.spotting.curentlyInMaintenance - ? ConstructionComponent - : GalleryComponent, }, { path: "spotting", diff --git a/src/app/gallery/gallery.component.ts b/src/app/gallery/gallery.component.ts index 6e06251d..05bea535 100644 --- a/src/app/gallery/gallery.component.ts +++ b/src/app/gallery/gallery.component.ts @@ -1,9 +1,12 @@ import { QueryRef } from "apollo-angular"; +import { InViewportModule } from "ng-in-viewport"; +import { NzSpinModule } from "ng-zorro-antd/spin"; import { Subscription } from "rxjs"; import { InputImage } from "src/app/@ui/image-grid/image-grid.component"; +import { ImageGridModule } from "src/app/@ui/image-grid/image-grid.module"; import { getThumbnail } from "src/app/@util/imgur"; -import { KeyValue } from "@angular/common"; +import { CommonModule, KeyValue } from "@angular/common"; import { Component, OnDestroy, OnInit } from "@angular/core"; import { @@ -15,6 +18,8 @@ import { selector: "app-gallery", templateUrl: "./gallery.component.html", styleUrls: ["./gallery.component.scss"], + standalone: true, + imports: [CommonModule, ImageGridModule, InViewportModule, NzSpinModule], }) export class GalleryComponent implements OnInit, OnDestroy { imageDateMaps: { diff --git a/src/app/gallery/gallery.module.ts b/src/app/gallery/gallery.module.ts deleted file mode 100644 index 6244b6c1..00000000 --- a/src/app/gallery/gallery.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { InViewportModule } from "ng-in-viewport"; -import { NzSpinModule } from "ng-zorro-antd/spin"; - -import { CommonModule } from "@angular/common"; -import { NgModule } from "@angular/core"; - -import { ImageGridModule } from "../@ui/image-grid/image-grid.module"; -import { GalleryComponent } from "./gallery.component"; - -@NgModule({ - declarations: [GalleryComponent], - imports: [CommonModule, ImageGridModule, InViewportModule, NzSpinModule], -}) -export class GalleryModule {}