Skip to content

Commit

Permalink
feat(web): use default export in routes
Browse files Browse the repository at this point in the history
  • Loading branch information
PoiScript committed Jul 26, 2023
1 parent 6aa7dab commit 883127a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 28 deletions.
10 changes: 5 additions & 5 deletions web/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from "@angular/core";
import { Component, inject, OnInit } from "@angular/core";
import { MatIconRegistry } from "@angular/material/icon";
import { MatSidenavModule } from "@angular/material/sidenav";
import { DomSanitizer } from "@angular/platform-browser";
Expand Down Expand Up @@ -121,10 +121,10 @@ export class AppComponent implements OnInit {
sidenavShouldOpen = false;
sidenavMode: string = "side";

constructor(
private iconRegistry: MatIconRegistry,
private sanitizer: DomSanitizer
) {
private iconRegistry = inject(MatIconRegistry);
private sanitizer = inject(DomSanitizer);

constructor() {
for (const [name, svg] of icons) {
this.iconRegistry.addSvgIconLiteral(
name,
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/pages/channels-list/channels-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { ChannelTable } from "./channel-table/channel-table";
],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ChannelList implements OnInit {
export default class ChannelList implements OnInit {
private qry = inject(QryService);
private route = inject(ActivatedRoute);
private vtubers = inject(VTuberService);
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/pages/streams-detail/streams-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { StreamViewersChart } from "./stream-viewers-chart/stream-viewers-chart"
selector: "hls-streams-detail",
templateUrl: "streams-detail.html",
})
export class StreamsDetail implements OnInit {
export default class StreamsDetail implements OnInit {
private route = inject(ActivatedRoute);
private router = inject(Router);
private qry = inject(QryService);
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/pages/streams-list/streams-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type QueryKey = ["youtube_streams", StreamsListPageData, string[]];
selector: "hls-streams-list",
templateUrl: "streams-list.html",
})
export class StreamsList implements OnInit {
export default class StreamsList implements OnInit {
private qry = inject(QryService);
private route = inject(ActivatedRoute);
private vtubers = inject(VTuberService);
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/pages/vtubers-detail/vtubers-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { VtuberSummary } from "./vtuber-summary/vtuber-summary";
selector: "hls-vtubers-detail",
templateUrl: "vtubers-detail.html",
})
export class VTubersDetail {
export default class VTubersDetail {
private route = inject(ActivatedRoute);
private router = inject(Router);
private title = inject(Title);
Expand Down
24 changes: 5 additions & 19 deletions web/src/app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,12 @@ import { NotFound } from "./pages/not-found/not-found";
import { ShareTarget } from "./pages/share-target/share-target";
import type { StreamsListPageData } from "./pages/streams-list/streams-list";

const ChannelList = () =>
import(
/* webpackChunkName: "pages/channels-list" */ "./pages/channels-list/channels-list"
).then((m) => m.ChannelList);
const StreamsList = () =>
import(
/* webpackChunkName: "pages/streams-list" */ "./pages/streams-list/streams-list"
).then((m) => m.StreamsList);
const StreamsDetail = () =>
import(
/* webpackChunkName: "pages/streams-detail" */ "./pages/streams-detail/streams-detail"
).then((m) => m.StreamsDetail);
const VTubersDetail = () =>
import(
/* webpackChunkName: "pages/vtubers-detail" */ "./pages/vtubers-detail/vtubers-detail"
).then((m) => m.VTubersDetail);
const ChannelList = () => import("./pages/channels-list/channels-list");
const StreamsList = () => import("./pages/streams-list/streams-list");
const StreamsDetail = () => import("./pages/streams-detail/streams-detail");
const VTubersDetail = () => import("./pages/vtubers-detail/vtubers-detail");
const Settings = () =>
import(
/* webpackChunkName: "pages/settings" */ "./pages/settings/routes"
).then((m) => m.getRoutes());
import("./pages/settings/routes").then((m) => m.getRoutes());

export const getRoutes = (): Routes => [
{ path: "", redirectTo: "/youtube-channel", pathMatch: "full" },
Expand Down

0 comments on commit 883127a

Please sign in to comment.