Skip to content

Commit

Permalink
✔ Router Changed ~
Browse files Browse the repository at this point in the history
  • Loading branch information
bifeldy committed Jul 8, 2023
1 parent 8f57f25 commit 08fa320
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 47 deletions.
1 change: 0 additions & 1 deletion dist/fansubid/browser/219.698ea9fdc5aa1276.js

This file was deleted.

1 change: 1 addition & 0 deletions dist/fansubid/browser/219.d349e761baf24a34.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/fansubid/browser/847.8b0c1c266419116e.js

This file was deleted.

1 change: 1 addition & 0 deletions dist/fansubid/browser/847.f0c9a75565fb72cb.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/fansubid/browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<noscript>🎉 Harap Menyalakan JavaScript Untuk Dapat Mengakses Website Ini ✨</noscript>
</div>
<app-root></app-root>
<script src="runtime.f9295dcfab9e9517.js" type="module"></script><script src="polyfills.325a71d3e423341a.js" type="module"></script><script src="scripts.03e7a8120a25f41a.js" defer></script><script src="main.ccb3e1ec97b6c1ba.js" type="module"></script>
<script src="runtime.463af9214fd7531a.js" type="module"></script><script src="polyfills.325a71d3e423341a.js" type="module"></script><script src="scripts.03e7a8120a25f41a.js" defer></script><script src="main.ccb3e1ec97b6c1ba.js" type="module"></script>


</body></html>
16 changes: 8 additions & 8 deletions dist/fansubid/browser/ngsw.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"configVersion": 1,
"timestamp": 1688826396949,
"timestamp": 1688830656896,
"index": "/index.html",
"assetGroups": [
{
Expand All @@ -13,7 +13,7 @@
"urls": [
"/108.d9b1d0ccca7facc0.js",
"/146.b5de9d3328c10e63.js",
"/219.698ea9fdc5aa1276.js",
"/219.d349e761baf24a34.js",
"/229.f048c8b9a061bc52.js",
"/241.36c9047f79f103f2.js",
"/255.3f08f327f791c94a.js",
Expand All @@ -32,7 +32,7 @@
"/772.eebac240ffd089ed.js",
"/794.501a70f2d9e36ba6.js",
"/839.f854a9f9523c5acc.js",
"/847.8b0c1c266419116e.js",
"/847.f0c9a75565fb72cb.js",
"/915.ca5b75d878de0c36.js",
"/925.26c1471aec2759b1.js",
"/938.f033cd0f3b6b92c3.js",
Expand All @@ -43,7 +43,7 @@
"/main.ccb3e1ec97b6c1ba.js",
"/manifest.webmanifest",
"/polyfills.325a71d3e423341a.js",
"/runtime.f9295dcfab9e9517.js",
"/runtime.463af9214fd7531a.js",
"/scripts.03e7a8120a25f41a.js",
"/styles.b697e74e91f54c20.css"
],
Expand Down Expand Up @@ -86,7 +86,7 @@
"hashTable": {
"/108.d9b1d0ccca7facc0.js": "c4361811d33000b84f9e547e55d14bd38f934a4d",
"/146.b5de9d3328c10e63.js": "f478bc37d7a69e458ed48752f2beca80ca602457",
"/219.698ea9fdc5aa1276.js": "48af942baf7deb3a110b467a693164da0493f993",
"/219.d349e761baf24a34.js": "18b11933108a0a0982cf90dfdf7163c642b1df3d",
"/229.f048c8b9a061bc52.js": "bdf5470fdcecb5f3eddf646fcaffe4bcbfd99c0a",
"/241.36c9047f79f103f2.js": "234e537077d9ba1d8606b4b13f6b13255862cec6",
"/255.3f08f327f791c94a.js": "4b36a33a6d90f98bca8fd1d266dfd86c2b7313fb",
Expand All @@ -105,18 +105,18 @@
"/772.eebac240ffd089ed.js": "af356d0dffacda5b8d767f7bac30d11f7bd07f11",
"/794.501a70f2d9e36ba6.js": "5a40bf3a9c9cc2685a5ae28e997167e0cc9f9b7b",
"/839.f854a9f9523c5acc.js": "39f995b5eb8108ae18b098aedfee2609e14bf8f2",
"/847.8b0c1c266419116e.js": "edd99fe3875e731490f72d1414f1c523926dd154",
"/847.f0c9a75565fb72cb.js": "821b81116f7e920cc2eab53fa1c4048a1dfd0687",
"/915.ca5b75d878de0c36.js": "84265922a2db5b06e01c5e414df4f4fad79a7fc0",
"/925.26c1471aec2759b1.js": "4628f848f9bfb50fa5672be193edd6a506f922c4",
"/938.f033cd0f3b6b92c3.js": "2b92ae2baadfb83592b1de3d8b54bd12623d335b",
"/960.5e014ce2e6e49bcf.js": "f853b2cc2ee3b2b356b3aee241491de4c14cba22",
"/common.ac0ed540e3ab82a3.js": "27ad6f976af96ecfe2f83db7a8e582f55ed6d0e9",
"/favicon.ico": "071facb8fab2e4b3493dcfbb0b02d7bd21bca97e",
"/index.html": "a8e22e0fa6c48bb0e430fe748358d0e3f94bd406",
"/index.html": "fbf68ff73b552c10e7f1d1e9288ae4eb13abbd07",
"/main.ccb3e1ec97b6c1ba.js": "aed70640bd2bed4a18a23d57e832faa3b845068a",
"/manifest.webmanifest": "eafb5426cdc9fd714787e5453af315b9972875a3",
"/polyfills.325a71d3e423341a.js": "18f8a8b77e7d11be1385d438c6d218cc68c0edb3",
"/runtime.f9295dcfab9e9517.js": "c2c6f5678a9c18470100c25243853ffaba140320",
"/runtime.463af9214fd7531a.js": "3c4a3164a7708cd2b5c85091f6a9c61fae2a296d",
"/scripts.03e7a8120a25f41a.js": "2f52334f58ca527e57efab741f2fac760e6dd84d",
"/styles.b697e74e91f54c20.css": "972988388aafead5cb07e9a94f2b9c42e53cf768"
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/fansubid/server/main.js

Large diffs are not rendered by default.

27 changes: 24 additions & 3 deletions src/app/_shared/components/discussion/comment/comment.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, OnDestroy, Input } from '@angular/core';
import { Clipboard } from '@angular/cdk/clipboard';
import { Router } from '@angular/router';
import { NavigationEnd, Router } from '@angular/router';
import { MatSnackBar } from '@angular/material/snack-bar';

import { environment } from '../../../../../environments/app/environment';
Expand Down Expand Up @@ -38,6 +38,7 @@ export class CommentComponent implements OnInit, OnDestroy {
subsKomenGetKomen = null;
subsKomenGetReply = null;
subsDelete = null;
subsRouter = null;

constructor(
private clipboard: Clipboard,
Expand All @@ -58,8 +59,7 @@ export class CommentComponent implements OnInit, OnDestroy {

ngOnInit(): void {
if (this.gs.isBrowser) {
this.urlPath = this.router.url.split('?')[0];
this.getComment(true);
this.watchUrlRoute();
}
}

Expand All @@ -68,9 +68,30 @@ export class CommentComponent implements OnInit, OnDestroy {
this.subsKomenGetKomen?.unsubscribe();
this.subsKomenGetReply?.unsubscribe();
this.subsDelete?.unsubscribe();
this.subsRouter?.unsubscribe();
this.urlPath = null;
}

watchUrlRoute(): void {
this.subsRouter = this.router.events.subscribe({
next: evt => {
if (evt instanceof NavigationEnd) {
this.count = 0;
this.page = 1;
this.row = 10;
this.pageFinished = false;
this.recursionCount = 0;
this.rootCommentBox = false;
this.commentToSend = null;
this.parent = null;
this.komentar = [];
this.urlPath = this.router.url.split('?')[0];
this.getComment(true);
}
}
});
}

sendComment(k: KomentarModel): void {
this.gs.log('[KOMENTAR_PARENT_CREATE_REPLY]', k);
const commentData = (k) ? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class HighlightComponent implements OnInit, OnDestroy {
subsKomenGetKomen = null;
subsKomenGetReply = null;
subsDelete = null;
subsQueryParam = null;

constructor(
private clipboard: Clipboard,
Expand All @@ -61,11 +62,7 @@ export class HighlightComponent implements OnInit, OnDestroy {

ngOnInit(): void {
if (this.gs.isBrowser) {
this.urlPath = this.router.url.split('?')[0];
this.highlightId = Number(this.activatedRoute.snapshot.queryParamMap.get('comment') || '');
if (this.highlightId > 0) {
this.getHighlight();
}
this.watchUrlRoute();
}
}

Expand All @@ -75,9 +72,30 @@ export class HighlightComponent implements OnInit, OnDestroy {
this.subsKomenGetReply?.unsubscribe();
this.subsHighlight?.unsubscribe();
this.subsDelete?.unsubscribe();
this.subsQueryParam?.unsubscribe();
this.urlPath = null;
}

watchUrlRoute(): void {
this.subsQueryParam = this.activatedRoute.queryParams.subscribe({
next: qp => {
this.komentarHighlight = null;
this.count = 0;
this.page = 1;
this.pageFinished = false;
this.recursionCount = 0;
this.commentToSend = null;
this.parent = null;
this.komentar = [];
this.urlPath = this.router.url.split('?')[0];
this.highlightId = Number(qp['comment'] || '');
if (this.highlightId > 0) {
this.getHighlight();
}
}
});
}

getHighlight(id = this.highlightId): void {
this.subsHighlight = this.komen.getHighlight({
id,
Expand Down
64 changes: 38 additions & 26 deletions src/app/_shared/components/report/report.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { NavigationEnd, Router } from '@angular/router';

import { ChartType, ChartOptions } from 'chart.js';
import { SingleDataSet, Label, monkeyPatchChartJsLegend, monkeyPatchChartJsTooltip } from 'ng2-charts';
Expand Down Expand Up @@ -121,6 +121,7 @@ export class ReportComponent implements OnInit, OnDestroy {

subsGetReport = null;
subsSetReport = null;
subsRouter = null;

myReport = null;

Expand All @@ -145,6 +146,7 @@ export class ReportComponent implements OnInit, OnDestroy {
ngOnDestroy(): void {
this.subsGetReport?.unsubscribe();
this.subsSetReport?.unsubscribe();
this.subsRouter?.unsubscribe();
}

get LIKE(): string {
Expand All @@ -169,34 +171,44 @@ export class ReportComponent implements OnInit, OnDestroy {

ngOnInit(): void {
if (this.gs.isBrowser) {
this.reportTrackType = this.router.url.split('?')[0].split('/')[1];
this.idSlugUsername = this.router.url.split('?')[0].split('/')[2];
this.ss.socketEmit('track-get', {
trackType: this.reportTrackType,
idSlugUsername: this.idSlugUsername
}, (response: any) => {
this.gs.log(`[SOCKET_TRACK-GET]`, response);
this.barChartUniqueLabels = ['Alamat IP', 'Akun Pengguna', 'Terverifikasi', 'Belum Verifikasi'];
this.barChartUniqueData = [response.unique_ip, response.unique_user, response.verified_user, response.un_verified_user];
this.summary.unique_ip = response.unique_ip;
this.summary.unique_user = response.unique_user;
this.summary.verified_user = response.verified_user;
this.summary.un_verified_user = response.un_verified_user;
this.lineChartVisitorData = [];
this.lineChartVisitorLabels = [];
for (const v of response.visitor) {
this.lineChartVisitorData.push(v.visitor_count || 0);
this.lineChartVisitorLabels.push(
new Date(
new Date(v.visitor_date).getTime() - (new Date(v.visitor_date).getTimezoneOffset() * 60 * 1000)
).toISOString().split('T')[0]
);
}
});
this.getReport();
this.watchUrlRoute();
}
}

watchUrlRoute(): void {
this.subsRouter = this.router.events.subscribe({
next: evt => {
if (evt instanceof NavigationEnd) {
this.reportTrackType = this.router.url.split('?')[0].split('/')[1];
this.idSlugUsername = this.router.url.split('?')[0].split('/')[2];
this.ss.socketEmit('track-get', {
trackType: this.reportTrackType,
idSlugUsername: this.idSlugUsername
}, (response: any) => {
this.gs.log(`[SOCKET_TRACK-GET]`, response);
this.barChartUniqueLabels = ['Alamat IP', 'Akun Pengguna', 'Terverifikasi', 'Belum Verifikasi'];
this.barChartUniqueData = [response.unique_ip, response.unique_user, response.verified_user, response.un_verified_user];
this.summary.unique_ip = response.unique_ip;
this.summary.unique_user = response.unique_user;
this.summary.verified_user = response.verified_user;
this.summary.un_verified_user = response.un_verified_user;
this.lineChartVisitorData = [];
this.lineChartVisitorLabels = [];
for (const v of response.visitor) {
this.lineChartVisitorData.push(v.visitor_count || 0);
this.lineChartVisitorLabels.push(
new Date(
new Date(v.visitor_date).getTime() - (new Date(v.visitor_date).getTimezoneOffset() * 60 * 1000)
).toISOString().split('T')[0]
);
}
});
this.getReport();
}
}
});
}

toggleAllStats(): void {
this.toggleAllStatsValue = !this.toggleAllStatsValue;
}
Expand Down

0 comments on commit 08fa320

Please sign in to comment.