Refactoring
This commit is contained in:
@@ -2,8 +2,8 @@ import { Component, OnInit, AfterContentInit } from '@angular/core';
|
||||
import { MAT_DATE_LOCALE, MAT_DATE_FORMATS, provideNativeDateAdapter } from '@angular/material/core';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
|
||||
import { FullComponent } from 'src/app/components/shared/layout';
|
||||
import { UserService } from "src/app/core/services";
|
||||
import { FullComponent } from '@components/shared/layout';
|
||||
import { UserService } from "@services";
|
||||
|
||||
export const MY_FORMATS = {
|
||||
parse: {
|
||||
|
||||
@@ -12,8 +12,8 @@ import { EMPTY } from "rxjs";
|
||||
registerLocaleData(localeFr);
|
||||
|
||||
import { routes } from './app.routes';
|
||||
import { apiInterceptor, tokenInterceptor, errorInterceptor } from "src/app/core/interceptors";
|
||||
import { JwtService, UserService } from "src/app/core/services";
|
||||
import { apiInterceptor, tokenInterceptor, errorInterceptor } from "@interceptors";
|
||||
import { JwtService, UserService } from "@services";
|
||||
|
||||
export function initAuth(jwtService: JwtService, userService: UserService) {
|
||||
return () => (jwtService.getToken() ? userService.getCurrentUser() : EMPTY);
|
||||
|
||||
@@ -13,12 +13,12 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { HistoryTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { BarsChartComponent, PieChartComponent } from 'src/app/components/shared/helpers-chart';
|
||||
import { Jump, AeronefsPageData } from 'src/app/core/models';
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { AeronefByImat, AeronefByYear } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { HistoryTableComponent } from '@components/shared/helpers-jump';
|
||||
import { BarsChartComponent, PieChartComponent } from '@components/shared/helpers-chart';
|
||||
import { Jump, AeronefsPageData } from '@models';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { AeronefByImat, AeronefByYear } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-aeronefs',
|
||||
|
||||
@@ -10,9 +10,9 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { Errors } from 'src/app/core/models';
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { ListErrorsComponent, ShowAuthedDirective } from 'src/app/components/shared';
|
||||
import { Errors } from '@models';
|
||||
import { UserService } from '@services';
|
||||
import { ListErrorsComponent, ShowAuthedDirective } from '@components/shared';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
|
||||
@@ -17,9 +17,9 @@ import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
||||
import { BaseChartDirective } from 'ng2-charts';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { CalculatorInfo, CalculatorResult, CalculatorState, InputParams, Jump, LineConfig, WeightSizeRange, TableHeader, User, WeightSize, weightSizes } from 'src/app/core/models';
|
||||
import { CalculatorService, JumpsService, UserService, UtilitiesService } from 'src/app/core/services';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { CalculatorInfo, CalculatorResult, CalculatorState, InputParams, Jump, LineConfig, WeightSizeRange, TableHeader, User, WeightSize, weightSizes } from '@models';
|
||||
import { CalculatorService, JumpsService, UserService, UtilitiesService } from '@services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-calculator',
|
||||
|
||||
@@ -12,12 +12,12 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { HistoryTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { BarsChartComponent, PieChartComponent } from 'src/app/components/shared/helpers-chart';
|
||||
import { Jump, CanopiesPageData } from 'src/app/core/models';
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { CanopyBySize, CanopyByYear, CanopyModelBySize, CanopyModelByYear } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { HistoryTableComponent } from '@components/shared/helpers-jump';
|
||||
import { BarsChartComponent, PieChartComponent } from '@components/shared/helpers-chart';
|
||||
import { Jump, CanopiesPageData } from '@models';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { CanopyBySize, CanopyByYear, CanopyModelBySize, CanopyModelByYear } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-canopies',
|
||||
|
||||
@@ -7,16 +7,16 @@ import { ActivatedRoute, Data, Router } from '@angular/router';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { Aeronef, AeronefByImat, Canopy, CanopyModelBySize, DropZone, DropZoneByYear, Errors, Jump, User } from 'src/app/core/models';
|
||||
//import { AeronefsService, CanopiesService, DropZonesService, UserService } from 'src/app/core/services';
|
||||
import { JumpsService, UserService } from 'src/app/core/services';
|
||||
import { ShowAuthedDirective } from 'src/app/components/shared/show-authed.directive';
|
||||
import { Aeronef, AeronefByImat, Canopy, CanopyModelBySize, DropZone, DropZoneByYear, Errors, Jump, User } from '@models';
|
||||
//import { AeronefsService, CanopiesService, DropZonesService, UserService } from '@services';
|
||||
import { JumpsService, UserService } from '@services';
|
||||
import { ShowAuthedDirective } from '@components/shared/show-authed.directive';
|
||||
import {
|
||||
AeronefsPieComponent, AeronefsBarComponent,
|
||||
CanopiesModelsComponent, CanopiesSizesComponent,
|
||||
DropzonesPieComponent, DropzonesBarComponent,
|
||||
JumpsByMonthComponent
|
||||
} from 'src/app/components/shared/dashboard-components';
|
||||
} from '@components/shared/dashboard-components';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
|
||||
@@ -11,9 +11,9 @@ import { MatSliderModule } from '@angular/material/slider';
|
||||
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { Errors, User } from 'src/app/core/models';
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { ListErrorsComponent } from 'src/app/components/shared';
|
||||
import { Errors, User } from '@models';
|
||||
import { UserService } from '@services';
|
||||
import { ListErrorsComponent } from '@components/shared';
|
||||
|
||||
@Component({
|
||||
selector: 'app-demo',
|
||||
|
||||
@@ -15,11 +15,11 @@ import { MatMenuModule } from '@angular/material/menu';
|
||||
//import { AxisOptions, Label } from 'chartist';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { BarsChartComponent, PieChartComponent } from 'src/app/components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { DropZoneByOaci, DropZoneByYear, DropZonesPageData, Jump } from 'src/app/core/models';
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { BarsChartComponent, PieChartComponent } from '@components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from '@components/shared/helpers-jump';
|
||||
import { DropZoneByOaci, DropZoneByYear, DropZonesPageData, Jump } from '@models';
|
||||
import { UtilitiesService } from '@services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dropzones',
|
||||
|
||||
@@ -12,9 +12,9 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatStepperIntl, MatStepperModule } from '@angular/material/stepper';
|
||||
|
||||
import { ListErrorsComponent } from 'src/app/components/shared';
|
||||
import { Errors } from 'src/app/core/models';
|
||||
import { HWGuildRaid, HWGuildRaidAttacker, HWGuildRaidAttackers, HWGuildRaidStage, HWMember } from 'src/app/core/models/herowars';
|
||||
import { ListErrorsComponent } from '@components/shared';
|
||||
import { Errors } from '@models';
|
||||
import { HWGuildRaid, HWGuildRaidAttacker, HWGuildRaidAttackers, HWGuildRaidStage, HWMember } from '@models/herowars';
|
||||
|
||||
import guildRaids from 'src/files-data/hw-guild-raids.json'; // page Asgard -> Guild Raid -> Log
|
||||
|
||||
|
||||
@@ -15,193 +15,199 @@
|
||||
</div>
|
||||
<mat-divider class="mt-2 mb-3"></mat-divider>
|
||||
|
||||
<mat-tab-group [selectedIndex]="0" color="warn">
|
||||
<mat-tab label="Clan">
|
||||
<mat-tab-group [selectedIndex]="0" color="primary">
|
||||
<mat-tab label="Guild">
|
||||
<div class="row g-0">
|
||||
<div class="col-12 pe-md-2 border-1 border-top">
|
||||
<!--<app-guildwar-attack [members]="getMembers()"></app-guildwar-attack>-->
|
||||
<div class="d-flex mt-3">
|
||||
<div class="flex-fill">
|
||||
<h2>
|
||||
@if (clanLoaded) {
|
||||
<span class="border-1 border-bottom">{{ getClan().title }} <span class="fs-4"> – Server {{ getClan().serverId }}</span></span>
|
||||
}
|
||||
</h2>
|
||||
</div>
|
||||
<span class="flex-spacer"></span>
|
||||
<div class="align-self-center me-2 text-end">
|
||||
<span class="fs-4">Members: {{ getClan().membersCount }}/30</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-0 my-3">
|
||||
<div class="col-2">
|
||||
<div class="d-flex align-items-start flex-column me-1" role="group" aria-label="Vertical button group">
|
||||
@if (clanLoaded) {
|
||||
<button mat-stroked-button color="warn" (click)="syncClan()" class="mb-1">Sync clan</button>
|
||||
}
|
||||
@else {
|
||||
<button mat-stroked-button color="megna" (click)="loadClan()" class="mb-1">Load clan</button>
|
||||
}
|
||||
@if (membersLoaded) {
|
||||
<button mat-stroked-button color="warn" (click)="syncMembers()" class="mb-1">Sync members</button>
|
||||
}
|
||||
@else {
|
||||
<button mat-stroked-button color="megna" (click)="loadMembers()" [disabled]="!clanLoaded" class="mb-1">Load members</button>
|
||||
}
|
||||
@if (clanLoaded) {
|
||||
<app-card-container [colors]="getColors('raspberry')" [title]="getClanViewModel().getTitle()" subtitle="Members: {{ getClanViewModel().getMembersCount() }}/{{ maxClanMembers }}">
|
||||
<!--<app-guildwar-defence [members]="getMembers()" type="heroes"></app-guildwar-defence>-->
|
||||
<div class="d-flex mt-3">
|
||||
<div class="flex-fill">
|
||||
<h2>
|
||||
<span class="border-1 border-bottom">{{ getClanViewModel().getTitle() }} <span class="fs-4"> – Server {{ getClanViewModel().getServer() }}</span></span>
|
||||
</h2>
|
||||
</div>
|
||||
<span class="flex-spacer"></span>
|
||||
<div class="align-self-center me-2 text-end">
|
||||
<span class="fs-4">Members: {{ getClanViewModel().getMembersCount() }}/{{ maxClanMembers }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-0 my-3">
|
||||
<div class="col-2">
|
||||
<div class="d-flex align-items-start flex-column me-1" role="group" aria-label="Vertical button group">
|
||||
<button mat-stroked-button color="warn" (click)="syncClan()" [disabled]="!clanLoaded" class="mb-1">Sync clan</button>
|
||||
<button mat-stroked-button color="warn" (click)="syncMembers()" [disabled]="!membersLoaded" class="mb-1">Sync members</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<dl class="dl-horizontal m-0">
|
||||
<dt>country</dt>
|
||||
<dd>{{ getClanViewModel().getCountry() }}</dd>
|
||||
<dt>serverId</dt>
|
||||
<dd>{{ getClanViewModel().getServer() }}</dd>
|
||||
<dt>description</dt>
|
||||
<dd>{{ getClanViewModel().getDescription() }}</dd>
|
||||
<dt>level</dt>
|
||||
<dd>{{ getClanViewModel().getLevel() }}</dd>
|
||||
<dt>minLevel</dt>
|
||||
<dd>{{ getClanViewModel().getMinLevel() }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<dl class="dl-horizontal m-0">
|
||||
<dt>topActivity</dt>
|
||||
<dd>{{ getClanViewModel().getTopActivity() | number : '1.0' }}</dd>
|
||||
<dt>topDungeon</dt>
|
||||
<dd>{{ getClanViewModel().getTopDungeon() | number : '1.0' }}</dd>
|
||||
<dt>disbanding</dt>
|
||||
<dd>{{ getClanViewModel().getDisbanding() }}</dd>
|
||||
<dt>frameId</dt>
|
||||
<dd>{{ getClanViewModel().getFrameId() }}</dd>
|
||||
<dt>ownerId</dt>
|
||||
<dd>{{ getClanViewModel().getOwnerId() | number : '1.0' }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</app-card-container>
|
||||
}
|
||||
@else {
|
||||
<div class="d-flex mt-3">
|
||||
<button mat-stroked-button color="warn" (click)="loadData()" class="mb-1">Load Data</button>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<dl class="dl-horizontal m-0">
|
||||
<dt>country</dt>
|
||||
<dd>{{ getClan().country }}</dd>
|
||||
<dt>serverId</dt>
|
||||
<dd>{{ getClan().serverId }}</dd>
|
||||
<dt>description</dt>
|
||||
<dd>{{ getClan().description }}</dd>
|
||||
<dt>level</dt>
|
||||
<dd>{{ getClan().level }}</dd>
|
||||
<dt>minLevel</dt>
|
||||
<dd>{{ getClan().minLevel }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<dl class="dl-horizontal m-0">
|
||||
<dt>topActivity</dt>
|
||||
<dd>{{ getClan().topActivity | number : '1.0' }}</dd>
|
||||
<dt>topDungeon</dt>
|
||||
<dd>{{ getClan().topDungeon | number : '1.0' }}</dd>
|
||||
<dt>disbanding</dt>
|
||||
<dd>{{ getClan().disbanding }}</dd>
|
||||
<dt>frameId</dt>
|
||||
<dd>{{ getClan().frameId }}</dd>
|
||||
<dt>ownerId</dt>
|
||||
<dd>{{ getClan().ownerId }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive p-0">
|
||||
<table class="table table-striped table-condensed border-top border-light">
|
||||
<thead>
|
||||
<tr role="row" class="text-bg-raspberry bg-opacity-60">
|
||||
<th scope="col" class="align-middle w-auto ps-4">
|
||||
<div class="text-start">
|
||||
#
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
ID
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
Name
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
Clan
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
Server
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
Last Login
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
Level
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-end">
|
||||
Heroes
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto pe-4">
|
||||
<div class="text-end">
|
||||
Titans
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (member of getMembers(); track member; let index = $index) {
|
||||
<tr role="row" class="align-middle">
|
||||
<td class="cell text-start ps-4">
|
||||
{{ (index+1) }}
|
||||
</td>
|
||||
<td class="cell font-monospace text-start">
|
||||
<span class="me-3">{{ member.id }}</span>
|
||||
</td>
|
||||
<td class="cell text-start">
|
||||
{{ member.name }}
|
||||
</td>
|
||||
<td class="cell text-start">
|
||||
{{ member.clanTitle }}
|
||||
</td>
|
||||
<td class="cell text-start">
|
||||
{{ member.serverId }}
|
||||
</td>
|
||||
<td class="cell font-monospace text-start">
|
||||
<span class="me-3">{{ member.lastLoginTime + '000' | date: 'dd/MM HH:mm' }}</span>
|
||||
</td>
|
||||
<td class="cell font-monospace text-start">
|
||||
{{ member.level }}
|
||||
</td>
|
||||
<td class="cell font-monospace text-end">
|
||||
{{ member.heroes.power | number : '1.0' }}
|
||||
</td>
|
||||
<td class="cell font-monospace text-end pe-4">
|
||||
{{ member.titans.power | number : '1.0' }}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="Attack">
|
||||
<div class="row g-0">
|
||||
<div class="col col-md-6 pe-md-2">
|
||||
<!--<app-guildwar-defence [members]="getMembers()" type="heroes"></app-guildwar-defence>-->
|
||||
</div>
|
||||
<div class="col col-md-6 ps-md-2">
|
||||
<!--<app-guildwar-defence [members]="getMembers()" type="titans"></app-guildwar-defence>-->
|
||||
}
|
||||
@if (membersLoaded) {
|
||||
<app-card-container [colors]="getColors('raspberry')" title="Members" subtitle="List of guild members">
|
||||
<div class="table-responsive p-0">
|
||||
<table class="table table-striped table-condensed border-top border-light">
|
||||
<thead>
|
||||
<tr role="row" class="text-bg-raspberry bg-opacity-60">
|
||||
<th scope="col" class="align-middle w-auto ps-4">
|
||||
<div class="text-start">
|
||||
#
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="d-flex align-items-center text-start">
|
||||
Name
|
||||
<mat-icon fontIcon="arrow_upward" class="ms-1 icon-xsmall"></mat-icon>
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
ID
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
Last Login
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
Dismissal Delay
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
Clan
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-start">
|
||||
Server
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto">
|
||||
<div class="text-end">
|
||||
Heroes
|
||||
</div>
|
||||
</th>
|
||||
<th scope="col" class="align-middle w-auto pe-4">
|
||||
<div class="text-end">
|
||||
Titans
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (memberVM of getMembersViewModel().getMembers(); track memberVM.getId(); let index = $index) {
|
||||
<tr role="row" class="align-middle">
|
||||
<td class="cell text-start ps-4">
|
||||
{{ (index+1) }}
|
||||
</td>
|
||||
<td class="cell text-start">
|
||||
<div class="d-flex">
|
||||
<mat-icon [fontIcon]="memberVM.isChampion() ? 'gpp_good' : 'gpp_bad'" class="me-2 icon-small {{ memberVM.isChampion() ? 'text-green' : 'text-muted' }}"></mat-icon>
|
||||
<span [class]="memberVM.isChampion() ? 'text-green' : ''">{{ memberVM.getName() }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="cell font-monospace text-start">
|
||||
<span class="me-2">{{ memberVM.getId() }}</span> <small class="me-3">[{{ memberVM.getLevel() }}]</small>
|
||||
</td>
|
||||
<td class="cell font-monospace text-start">
|
||||
<span class="me-3">{{ memberVM.getLastLoginTime() + '000' | date: 'dd/MM HH:mm' }}</span>
|
||||
</td>
|
||||
<td class="cell font-monospace text-start">
|
||||
<span [class]="memberVM.getInactivity().daysLeft < daysToWarn ? 'text-red' : ''">{{ memberVM.getInactivity().dropDelay }}</span>
|
||||
</td>
|
||||
<td class="cell text-start">
|
||||
{{ memberVM.getClanTitle() }}
|
||||
</td>
|
||||
<td class="cell text-start">
|
||||
{{ memberVM.getServerId() }}
|
||||
</td>
|
||||
<td class="cell font-monospace text-end">
|
||||
{{ memberVM.getMemberHeroes().power | number : '1.0' }}
|
||||
</td>
|
||||
<td class="cell font-monospace text-end pe-4">
|
||||
{{ memberVM.getMemberTitans().power | number : '1.0' }}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</app-card-container>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="Defense">
|
||||
<div class="row g-0">
|
||||
<div class="col">
|
||||
<mat-card class="my-3">
|
||||
<mat-card-header class="d-flex rounded-top text-bg-raspberry py-2 px-3">
|
||||
<div class="flex-fill">
|
||||
<mat-card-title>
|
||||
{{ title }}
|
||||
</mat-card-title>
|
||||
</div>
|
||||
<span class="flex-spacer"></span>
|
||||
<div class="align-self-center text-end">
|
||||
<span class="fs-5 font-light">{{ subtitle }}</span>
|
||||
</div>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="table-responsive p-0">
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<div class="col col-md-6 pe-md-2">
|
||||
<app-card-container [colors]="getColors('accent')" title="Heroes Fortifications" subtitle="Defense overview">
|
||||
<!--<app-guildwar-defence [members]="getMembers()" type="heroes"></app-guildwar-defence>-->
|
||||
</app-card-container>
|
||||
</div>
|
||||
<div class="col col-md-6 ps-md-2">
|
||||
<app-card-container [colors]="getColors('accent')" title="Titans Fortifications" subtitle="Defense overview">
|
||||
<!--<app-guildwar-defence [members]="getMembers()" type="titans"></app-guildwar-defence>-->
|
||||
</app-card-container>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="Info">
|
||||
<mat-tab label="Attack">
|
||||
<div class="row g-0">
|
||||
<div class="col col-md-6 ps-md-2">
|
||||
<app-card-container [colors]="getColors('accent')" title="Heroes Fortifications" subtitle="Attack overview">
|
||||
<!--<app-guildwar-attack [members]="getMembers()" type="heroes"></app-guildwar-attack>-->
|
||||
</app-card-container>
|
||||
</div>
|
||||
<div class="col col-md-6 ps-md-2">
|
||||
<app-card-container [colors]="getColors('accent')" title="Titans Fortifications" subtitle="Attack overview">
|
||||
<!--<app-guildwar-attack [members]="getMembers()" type="titans"></app-guildwar-attack>-->
|
||||
</app-card-container>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
<mat-tab label="Raids">
|
||||
<div class="row g-0">
|
||||
<div class="col">
|
||||
<app-card-container [colors]="getColors('megna')" title="Guild Raids" subtitle="Statistics">
|
||||
<!---->
|
||||
</app-card-container>
|
||||
</div>
|
||||
</div>
|
||||
</mat-tab>
|
||||
|
||||
@@ -11,18 +11,20 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
|
||||
import { ListErrorsComponent, GuildwarAttackComponent, GuildwarDefenceComponent } from 'src/app/components/shared';
|
||||
import { Errors, HWActivityStat, HWGuildClan, HWMember, HWMemberStat, HWWeekStat } from 'src/app/core/models';
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { CardContainerComponent, ListErrorsComponent, GuildwarAttackComponent, GuildwarDefenceComponent } from '@components/shared';
|
||||
import { CardColors, Errors, HWActivityStat, HWGuildClan, HWMember } from '@models';
|
||||
import { ClanViewModel, MembersViewModel } from '@viewmodels/herowars';
|
||||
import { HWClanService, HWMemberService, UtilitiesService } from '@services';
|
||||
import { MAX_CLAN_MEMBERS } from '@constants';
|
||||
|
||||
import guildData from 'src/files-data/hw-guild-data.json'; // page Membres
|
||||
import guildStatistics from 'src/files-data/hw-guild-statistics.json'; // page Overview -> Statistics
|
||||
import guildData from '@data/hw-guild-data.json'; // page Membres
|
||||
import guildStatistics from '@data/hw-guild-statistics.json'; // page Overview -> Statistics
|
||||
|
||||
@Component({
|
||||
selector: 'app-herowars-guildwar',
|
||||
standalone: true,
|
||||
imports: [
|
||||
DatePipe, DecimalPipe, FormsModule, ListErrorsComponent,
|
||||
DatePipe, DecimalPipe, FormsModule, CardContainerComponent, ListErrorsComponent,
|
||||
MatButtonModule, MatCardModule, MatDividerModule, MatFormFieldModule,
|
||||
MatIconModule, MatInputModule, MatTabsModule,
|
||||
GuildwarAttackComponent, GuildwarDefenceComponent
|
||||
@@ -44,151 +46,76 @@ import guildStatistics from 'src/files-data/hw-guild-statistics.json'; // page O
|
||||
]
|
||||
})
|
||||
export class HerowarsGuildwarComponent implements OnInit {
|
||||
public destroyRef = inject(DestroyRef);
|
||||
public title = 'Guild War';
|
||||
public subtitle = 'Log';
|
||||
public description = 'Tools in working progress.';
|
||||
public colors: CardColors = { background: 'bg-raspberry', text: 'text-bg-primary' };
|
||||
public errors: Errors = { errors: {} };
|
||||
public destroyRef = inject(DestroyRef);
|
||||
public now = new Date();
|
||||
public daysToWarn = 1;
|
||||
public maxClanMembers = MAX_CLAN_MEMBERS;
|
||||
public clanLoaded = false;
|
||||
public membersLoaded = false;
|
||||
public clanViewModel: ClanViewModel = {} as ClanViewModel;
|
||||
public membersViewModel: MembersViewModel = {} as MembersViewModel;
|
||||
private _guildClan: HWGuildClan = {} as HWGuildClan;
|
||||
private _guildMembers: HWMember[] = [];
|
||||
private _guildInfo: HWActivityStat = {} as HWActivityStat;
|
||||
|
||||
constructor(
|
||||
private _titleService: Title,
|
||||
private _utilitiesService: UtilitiesService
|
||||
private _utilitiesService: UtilitiesService,
|
||||
private _clanService: HWClanService,
|
||||
private _memberService: HWMemberService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this._titleService.setTitle(this.title);
|
||||
}
|
||||
|
||||
private _resetActivity(): HWActivityStat {
|
||||
const activity: HWActivityStat = { activity: 0, prestige: 0, titanite: 0, war: 0, adventure: 0, gifts: 0, score: 0, scoreGifts: 0, warGifts: 0, rewards: 0 };
|
||||
return activity;
|
||||
getClanViewModel(): ClanViewModel {
|
||||
return this.clanViewModel;
|
||||
}
|
||||
|
||||
private _importMembers() {
|
||||
try {
|
||||
const oneDayInSec = (24 * 60 * 60);
|
||||
const daysToKick = parseInt(guildData.clan.daysToKick);
|
||||
this.daysToWarn = (parseInt(guildData.clan.daysToKick) / 2);
|
||||
for (const data of Object.entries(guildData.clan.members)) {
|
||||
const member: HWMember = {} as HWMember;
|
||||
Object.assign(member, data[1]);
|
||||
if (guildData.clan.warriors.indexOf(parseInt(member.id)) !== -1) {
|
||||
member.champion = true;
|
||||
} else {
|
||||
member.champion = false;
|
||||
}
|
||||
member.heroes = { power: 0, teams: []};
|
||||
member.titans = { power: 0, teams: []};
|
||||
this._guildMembers.push(member);
|
||||
}
|
||||
this._guildMembers.map((data) => {
|
||||
const last = new Date((parseInt(data.lastLoginTime) * 1000));
|
||||
const exp = new Date(last.getTime() + ((daysToKick * oneDayInSec) * 1000));
|
||||
const diff = Math.floor(((exp.getTime() - this.now.getTime()) / 1000));
|
||||
const daysLeft = Math.floor((diff / oneDayInSec));
|
||||
let timeLeft = diff;
|
||||
if (daysLeft >= 1) {
|
||||
timeLeft = (diff - (daysLeft * oneDayInSec));
|
||||
}
|
||||
data.inactivity = {
|
||||
daysLeft: daysLeft,
|
||||
timeLeft: timeLeft,
|
||||
dropDelay: `${daysLeft}d, ${this._utilitiesService.secondsToDuration(timeLeft)}`,
|
||||
dropDate: Math.floor((exp.getTime() / 1000))
|
||||
};
|
||||
data.raids = [];
|
||||
data.raidsInfo = {
|
||||
variationAvg: 0,
|
||||
variationSum: 0
|
||||
};
|
||||
data.stat = {} as HWMemberStat;
|
||||
let index = guildData.membersStat.findIndex(stat => stat.userId === data.id);
|
||||
if (index !== -1) {
|
||||
delete (guildData.membersStat[index] as {userId?: string}).userId;
|
||||
Object.assign(data.stat, guildData.membersStat[index]);
|
||||
//data.stat = guildData.membersStat[index];
|
||||
}
|
||||
index = guildStatistics.stat.findIndex(stat => stat.id === data.id);
|
||||
if (index !== -1) {
|
||||
delete (guildStatistics.stat[index] as {id?: string}).id;
|
||||
const stat: HWWeekStat = {} as HWWeekStat;
|
||||
Object.assign(stat, guildStatistics.stat[index]);
|
||||
data.weekStat = stat;
|
||||
data.adventureSum = guildStatistics.stat[index].adventureStat.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
||||
data.clanGiftsSum = guildStatistics.stat[index].clanGifts.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
||||
data.clanWarSum = guildStatistics.stat[index].clanWarStat.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
||||
this._guildClan.sumTotal.adventure += data.adventureSum;
|
||||
this._guildClan.sumTotal.gifts += data.clanGiftsSum;
|
||||
this._guildClan.sumTotal.war += data.clanWarSum;
|
||||
}
|
||||
getMembersViewModel(): MembersViewModel {
|
||||
return this.membersViewModel;
|
||||
}
|
||||
|
||||
data.score = (data.stat.dungeonActivitySum + data.stat.activitySum + data.stat.prestigeSum);
|
||||
data.warGifts = (((this._guildClan.giftsCount / 2) * ((data.clanWarSum * 10) / 100)) / 20);
|
||||
|
||||
this._guildClan.todayTotal.activity += data.stat.todayActivity;
|
||||
this._guildClan.todayTotal.prestige += data.stat.todayPrestige;
|
||||
this._guildClan.todayTotal.titanite += data.stat.todayDungeonActivity;
|
||||
this._guildClan.todayTotal.score += (data.stat.todayDungeonActivity + data.stat.todayActivity + data.stat.todayPrestige);
|
||||
this._guildClan.sumTotal.activity += data.stat.activitySum;
|
||||
this._guildClan.sumTotal.prestige += data.stat.prestigeSum;
|
||||
this._guildClan.sumTotal.titanite += data.stat.dungeonActivitySum;
|
||||
this._guildClan.sumTotal.score += data.score;
|
||||
this._guildClan.sumTotal.warGifts += data.warGifts;
|
||||
|
||||
data.scoreGifts = 0;
|
||||
data.rewards = 0;
|
||||
return data;
|
||||
});
|
||||
this._guildClan.sumTotal.scoreGifts = (this._guildClan.giftsCount - Math.floor(this._guildClan.sumTotal.warGifts));
|
||||
this._guildClan.todayAverages.activity = (this._guildClan.todayTotal.activity / this._guildMembers.length);
|
||||
this._guildClan.todayAverages.prestige = (this._guildClan.todayTotal.prestige / this._guildMembers.length);
|
||||
this._guildClan.todayAverages.titanite = (this._guildClan.todayTotal.titanite / this._guildMembers.length);
|
||||
this._guildClan.todayAverages.score = (this._guildClan.todayTotal.score / this._guildMembers.length);
|
||||
this._guildClan.sumAverages.activity = (this._guildClan.sumTotal.activity / this._guildMembers.length);
|
||||
this._guildClan.sumAverages.prestige = (this._guildClan.sumTotal.prestige / this._guildMembers.length);
|
||||
this._guildClan.sumAverages.titanite = (this._guildClan.sumTotal.titanite / this._guildMembers.length);
|
||||
this._guildClan.sumAverages.war = (this._guildClan.sumTotal.war / 20);
|
||||
this._guildClan.sumAverages.adventure = (this._guildClan.sumTotal.adventure / this._guildMembers.length);
|
||||
this._guildClan.sumAverages.gifts = (this._guildClan.sumTotal.gifts / this._guildMembers.length);
|
||||
this._guildClan.sumAverages.score = (this._guildClan.sumTotal.score / this._guildMembers.length);
|
||||
|
||||
this._guildMembers.map((data) => {
|
||||
data.scoreGifts = ((data.score / this._guildClan.sumTotal.score) * this._guildClan.sumTotal.scoreGifts);
|
||||
data.rewards = Math.floor((data.scoreGifts + data.warGifts));
|
||||
this._guildClan.sumTotal.rewards += data.rewards;
|
||||
return data;
|
||||
});
|
||||
this._guildClan.sumAverages.rewards = (this._guildClan.sumTotal.rewards / this._guildMembers.length);
|
||||
|
||||
console.log(this._guildClan);
|
||||
console.log(this._guildMembers);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
getColors(color = 'megna'): CardColors {
|
||||
if (color === 'accent') {
|
||||
this.colors = { background: 'bg-accent', text: 'text-navy' };
|
||||
} else if (color === 'raspberry') {
|
||||
this.colors = { background: 'bg-raspberry', text: 'text-bg-primary' };
|
||||
} else {
|
||||
this.colors = { background: 'bg-megna', text: 'text-bg-primary' };
|
||||
}
|
||||
}
|
||||
|
||||
getClan(): HWGuildClan {
|
||||
return this._guildClan;
|
||||
return this.colors;
|
||||
}
|
||||
|
||||
loadClan(): void {
|
||||
Object.assign(this._guildClan, guildData.clan);
|
||||
this._guildClan.sumAverages = this._resetActivity();
|
||||
this._guildClan.sumTotal = this._resetActivity();
|
||||
this._guildClan.todayAverages = this._resetActivity();
|
||||
this._guildClan.todayTotal = this._resetActivity();
|
||||
this._guildClan = this._clanService.loadClan();
|
||||
this.clanViewModel = new ClanViewModel(this._guildClan);
|
||||
this.clanLoaded = true;
|
||||
}
|
||||
|
||||
loadData(): void {
|
||||
this._guildClan = this._clanService.loadClan();
|
||||
this._guildMembers = this._memberService.loadMembers(this._guildClan);
|
||||
this._guildClan = this._clanService.loadClanStats(this._guildClan, this._guildMembers);
|
||||
this.daysToWarn = (parseInt(this._guildClan.daysToKick) / 2);
|
||||
this.clanViewModel = new ClanViewModel(this._guildClan);
|
||||
this.clanLoaded = true;
|
||||
this.membersViewModel = new MembersViewModel(this._guildMembers);
|
||||
this.membersLoaded = true;
|
||||
console.log(this._guildClan);
|
||||
console.log(this._guildMembers);
|
||||
}
|
||||
|
||||
loadMembers(): void {
|
||||
this._importMembers();
|
||||
this._guildMembers = this._memberService.loadMembers(this._guildClan);
|
||||
this.membersViewModel = new MembersViewModel(this._guildMembers);
|
||||
this._guildClan = this._clanService.loadClanStats(this._guildClan, this._guildMembers);
|
||||
this.membersLoaded = true;
|
||||
}
|
||||
|
||||
@@ -198,10 +125,12 @@ export class HerowarsGuildwarComponent implements OnInit {
|
||||
|
||||
syncClan(): void {
|
||||
console.log(this._guildClan);
|
||||
console.log(guildData);
|
||||
}
|
||||
|
||||
syncMembers(): void {
|
||||
console.log(this._guildMembers);
|
||||
console.log(guildStatistics);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import {
|
||||
ListErrorsComponent,
|
||||
GuildCardComponent, GuildraidsLogComponent, GuildwarChampionsComponent,
|
||||
GuildwarAttackComponent, GuildwarDefenceComponent, GuildwarTeamsComponent, MembersStatisticsComponent
|
||||
} from 'src/app/components/shared';
|
||||
import { Errors, HWMember } from 'src/app/core/models';
|
||||
} from '@components/shared';
|
||||
import { Errors, HWMember } from '@models';
|
||||
import guildData from 'src/files-data/hw-guild-data.json'; // page Membres
|
||||
//import guildWarData from 'src/files-data/hw-guild-war.json'; // page Overview -> Statistics | page Guild War -> Guild War
|
||||
//import guildStatistics from 'src/files-data/hw-guild-statistics.json'; // page Overview -> Statistics
|
||||
|
||||
@@ -6,10 +6,10 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { ListErrorsComponent } from 'src/app/components/shared';
|
||||
import { Errors } from 'src/app/core/models';
|
||||
//import { UtilitiesService } from 'src/app/core/services';
|
||||
//import { UserService } from 'src/app/core/services';
|
||||
import { ListErrorsComponent } from '@components/shared';
|
||||
import { Errors } from '@models';
|
||||
//import { UtilitiesService } from '@services';
|
||||
//import { UserService } from '@services';
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
standalone: true,
|
||||
|
||||
@@ -9,8 +9,8 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { ListErrorsComponent, MenuItems } from 'src/app/components/shared';
|
||||
import { Errors, Jump, JumpPageData } from 'src/app/core/models';
|
||||
import { ListErrorsComponent, MenuItems } from '@components/shared';
|
||||
import { Errors, Jump, JumpPageData } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jump',
|
||||
|
||||
@@ -12,10 +12,10 @@ import { MatMenuModule } from '@angular/material/menu';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { BarsChartComponent, CircleChartComponent, LineChartComponent, LineAreaChartComponent } from 'src/app/components/shared/helpers-chart';
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { Jump, JumpByCategorie, JumpByDate, JumpByDateByModule, JumpByModule, JumpsPageData, JumpYears } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { BarsChartComponent, CircleChartComponent, LineChartComponent, LineAreaChartComponent } from '@components/shared/helpers-chart';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { Jump, JumpByCategorie, JumpByDate, JumpByDateByModule, JumpByModule, JumpsPageData, JumpYears } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jumps',
|
||||
|
||||
@@ -14,8 +14,8 @@ import { MatSelectModule } from '@angular/material/select';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { map, startWith, take } from 'rxjs/operators';
|
||||
|
||||
import { AeronefByImat, CanopyModelBySize, DropZoneByOaci, Errors, Jump, JumpAddParams, JumpByModule, JumpFile, JumpFileType } from 'src/app/core/models';
|
||||
import { AeronefsService, CanopiesService, DropZonesService, JumpsService } from 'src/app/core/services';
|
||||
import { AeronefByImat, CanopyModelBySize, DropZoneByOaci, Errors, Jump, JumpAddParams, JumpByModule, JumpFile, JumpFileType } from '@models';
|
||||
import { AeronefsService, CanopiesService, DropZonesService, JumpsService } from '@services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jump-add-dialog',
|
||||
|
||||
@@ -4,7 +4,7 @@ import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { Jump } from 'src/app/core/models';
|
||||
import { Jump } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jump-delete-dialog',
|
||||
|
||||
@@ -14,8 +14,8 @@ import { MatSelectModule } from '@angular/material/select';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { map, startWith } from 'rxjs/operators';
|
||||
|
||||
import { AeronefByImat, CanopyModelBySize, DropZoneByOaci, Jump, JumpByModule } from 'src/app/core/models';
|
||||
import { AeronefsService, CanopiesService, DropZonesService, JumpsService } from 'src/app/core/services';
|
||||
import { AeronefByImat, CanopyModelBySize, DropZoneByOaci, Jump, JumpByModule } from '@models';
|
||||
import { AeronefsService, CanopiesService, DropZonesService, JumpsService } from '@services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jump-edit-dialog',
|
||||
|
||||
@@ -5,7 +5,7 @@ import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/materia
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { Jump } from 'src/app/core/models';
|
||||
import { Jump } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jump-view-dialog',
|
||||
|
||||
@@ -16,10 +16,10 @@ import { MatSnackBar, MatSnackBarConfig, MatSnackBarHorizontalPosition, MatSnack
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { JumpAddDialogComponent } from 'src/app/components/logbook/dialogs';
|
||||
import { MenuItems, JumpTableComponent } from 'src/app/components/shared';
|
||||
import { Errors, Jump, JumpFile, JumpFileType, JumpListConfig, Range, User, X2Data } from 'src/app/core/models';
|
||||
import { JumpsService, JumpTableService, UserService } from 'src/app/core/services';
|
||||
import { JumpAddDialogComponent } from '@components/logbook/dialogs';
|
||||
import { MenuItems, JumpTableComponent } from '@components/shared';
|
||||
import { Errors, Jump, JumpFile, JumpFileType, JumpListConfig, Range, User, X2Data } from '@models';
|
||||
import { JumpsService, JumpTableService, UserService } from '@services';
|
||||
import data from 'src/jumps.json';
|
||||
//import data from 'src/jumps_02.json';
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { ListErrorsComponent, } from 'src/app/components/shared';
|
||||
import { Errors, Article, ArticlePageData } from 'src/app/core/models';
|
||||
import { ListErrorsComponent, } from '@components/shared';
|
||||
import { Errors, Article, ArticlePageData } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-page',
|
||||
|
||||
@@ -9,8 +9,8 @@ import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { ListErrorsComponent, } from 'src/app/components/shared';
|
||||
import { Errors, Product, ProductPageData } from 'src/app/core/models';
|
||||
import { ListErrorsComponent, } from '@components/shared';
|
||||
import { Errors, Product, ProductPageData } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-product',
|
||||
|
||||
@@ -10,8 +10,8 @@ import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { ListErrorsComponent, } from 'src/app/components/shared';
|
||||
import { Errors, Product, ProductsPageData } from 'src/app/core/models';
|
||||
import { ListErrorsComponent, } from '@components/shared';
|
||||
import { Errors, Product, ProductsPageData } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-products',
|
||||
|
||||
@@ -8,9 +8,9 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
import { Errors, User } from 'src/app/core/models';
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { ListErrorsComponent } from 'src/app/components/shared';
|
||||
import { Errors, User } from '@models';
|
||||
import { UserService } from '@services';
|
||||
import { ListErrorsComponent } from '@components/shared';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
|
||||
@@ -14,10 +14,10 @@ import { MatSelectModule } from '@angular/material/select';
|
||||
import { interval, Observable, Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { ListErrorsComponent } from 'src/app/components/shared';
|
||||
import { Errors, Qcm, QcmCategory, QcmQuestion, QcmQuestionState, User } from 'src/app/core/models';
|
||||
import { QcmService, UserService } from 'src/app/core/services';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { ListErrorsComponent } from '@components/shared';
|
||||
import { Errors, Qcm, QcmCategory, QcmQuestion, QcmQuestionState, User } from '@models';
|
||||
import { QcmService, UserService } from '@services';
|
||||
import data from 'src/qcm-bpa.json';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -11,9 +11,9 @@ import { MatInputModule } from '@angular/material/input';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { Errors, User } from 'src/app/core/models';
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { ListErrorsComponent } from 'src/app/components/shared';
|
||||
import { Errors, User } from '@models';
|
||||
import { UserService } from '@services';
|
||||
import { ListErrorsComponent } from '@components/shared';
|
||||
|
||||
@Component({
|
||||
selector: 'app-credentials',
|
||||
|
||||
@@ -12,9 +12,9 @@ import { MatSelectModule } from '@angular/material/select';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { Errors, User } from 'src/app/core/models';
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { ListErrorsComponent } from 'src/app/components/shared';
|
||||
import { Errors, User } from '@models';
|
||||
import { UserService } from '@services';
|
||||
import { ListErrorsComponent } from '@components/shared';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings-page',
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<mat-card class="my-3">
|
||||
<mat-card-header class="{{ colors.background }} {{ colors.text }} d-flex rounded-top py-2 px-3">
|
||||
<div class="flex-fill">
|
||||
<mat-card-title>
|
||||
{{ title }}
|
||||
</mat-card-title>
|
||||
</div>
|
||||
<span class="flex-spacer"></span>
|
||||
<div class="align-self-center text-end">
|
||||
<span class="fs-5 font-light">{{ subtitle }}</span>
|
||||
</div>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="table-responsive p-0">
|
||||
<ng-content></ng-content>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { NgForOf, NgIf } from "@angular/common";
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
|
||||
import { CardColors } from 'src/app/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-card-container',
|
||||
templateUrl: './card-container.component.html',
|
||||
standalone: true,
|
||||
imports: [NgIf, NgForOf, MatCardModule]
|
||||
})
|
||||
export class CardContainerComponent {
|
||||
errorList: string[] = [];
|
||||
@Input() colors: CardColors = { background: 'bg-megna', text: 'text-bg-primary' };
|
||||
@Input() title: string = 'Title';
|
||||
@Input() subtitle: string = 'Subtitle';
|
||||
}
|
||||
+5
-5
@@ -8,11 +8,11 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { BarHorizontalChartComponent } from 'src/app/components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { UtilitiesService, AeronefsService } from 'src/app/core/services';
|
||||
import { AeronefByImat, AeronefByYear } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { BarHorizontalChartComponent } from '@components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from '@components/shared/helpers-jump';
|
||||
import { UtilitiesService, AeronefsService } from '@services';
|
||||
import { AeronefByImat, AeronefByYear } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-aeronefs-bar',
|
||||
|
||||
+5
-5
@@ -9,11 +9,11 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { HistoryTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { PieChartComponent } from 'src/app/components/shared/helpers-chart';
|
||||
import { UtilitiesService, AeronefsService } from 'src/app/core/services';
|
||||
import { AeronefByImat, AeronefByYear } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { HistoryTableComponent } from '@components/shared/helpers-jump';
|
||||
import { PieChartComponent } from '@components/shared/helpers-chart';
|
||||
import { UtilitiesService, AeronefsService } from '@services';
|
||||
import { AeronefByImat, AeronefByYear } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-aeronefs-pie',
|
||||
|
||||
+5
-5
@@ -8,11 +8,11 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { PieChartComponent } from 'src/app/components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { UtilitiesService, CanopiesService } from 'src/app/core/services';
|
||||
import { CanopyModelBySize, CanopyModelByYear } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { PieChartComponent } from '@components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from '@components/shared/helpers-jump';
|
||||
import { UtilitiesService, CanopiesService } from '@services';
|
||||
import { CanopyModelBySize, CanopyModelByYear } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-canopies-models',
|
||||
|
||||
+5
-5
@@ -9,11 +9,11 @@ import { MatMenuModule } from '@angular/material/menu';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { PieChartComponent } from 'src/app/components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { UtilitiesService, CanopiesService } from 'src/app/core/services';
|
||||
import { CanopyBySize, CanopyByYear } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { PieChartComponent } from '@components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from '@components/shared/helpers-jump';
|
||||
import { UtilitiesService, CanopiesService } from '@services';
|
||||
import { CanopyBySize, CanopyByYear } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-canopies-sizes',
|
||||
|
||||
+4
-4
@@ -11,10 +11,10 @@ import { ChartistModule, Configuration } from 'ng-chartist';
|
||||
import { AxisOptions, Label } from 'chartist';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { HistoryTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { UtilitiesService, DropZonesService } from 'src/app/core/services';
|
||||
import { DropZoneByOaci, DropZoneByYear } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { HistoryTableComponent } from '@components/shared/helpers-jump';
|
||||
import { UtilitiesService, DropZonesService } from '@services';
|
||||
import { DropZoneByOaci, DropZoneByYear } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dropzones-bar',
|
||||
|
||||
+5
-5
@@ -9,11 +9,11 @@ import { MatMenuModule } from '@angular/material/menu';
|
||||
//import { ChartConfiguration } from 'chart.js';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { PieChartComponent } from 'src/app/components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from 'src/app/components/shared/helpers-jump';
|
||||
import { UtilitiesService, DropZonesService } from 'src/app/core/services';
|
||||
import { DropZoneByOaci, DropZoneByYear } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { PieChartComponent } from '@components/shared/helpers-chart';
|
||||
import { HistoryTableComponent } from '@components/shared/helpers-jump';
|
||||
import { UtilitiesService, DropZonesService } from '@services';
|
||||
import { DropZoneByOaci, DropZoneByYear } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dropzones-pie',
|
||||
|
||||
+3
-3
@@ -12,9 +12,9 @@ import { AxisOptions, Label } from 'chartist';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { MenuItems } from 'src/app/components/shared';
|
||||
import { UtilitiesService, JumpsService } from 'src/app/core/services';
|
||||
import { JumpByDate } from 'src/app/core/models';
|
||||
import { MenuItems } from '@components/shared';
|
||||
import { UtilitiesService, JumpsService } from '@services';
|
||||
import { JumpByDate } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jumps-by-month',
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Component, Input, OnChanges } from '@angular/core';
|
||||
import { ChartDataset } from 'chart.js';
|
||||
import { BaseChartDirective } from 'ng2-charts';
|
||||
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { BarConfig } from 'src/app/core/models';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { BarConfig } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bar-chart',
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Component, Input, OnChanges } from '@angular/core';
|
||||
import { ChartDataset } from 'chart.js';
|
||||
import { BaseChartDirective } from 'ng2-charts';
|
||||
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { BarConfig } from 'src/app/core/models';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { BarConfig } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bar-horizontal-chart',
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Component, Input, OnChanges, AfterContentChecked } from '@angular/core'
|
||||
import { ChartDataset } from 'chart.js';
|
||||
import { BaseChartDirective } from 'ng2-charts';
|
||||
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { BarConfig } from 'src/app/core/models';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { BarConfig } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-bars-chart',
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Component, Input, OnChanges } from '@angular/core';
|
||||
//import { ChartDataset } from 'chart.js';
|
||||
import { BaseChartDirective } from 'ng2-charts';
|
||||
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { CircleConfig } from 'src/app/core/models';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { CircleConfig } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-circle-chart',
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Component, Input, OnChanges } from '@angular/core';
|
||||
import { ChartDataset, Point } from 'chart.js';
|
||||
import { BaseChartDirective } from 'ng2-charts';
|
||||
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { LineConfig } from 'src/app/core/models';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { LineConfig } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-line-chart',
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Component, Input, OnChanges } from '@angular/core';
|
||||
import { ChartDataset } from 'chart.js';
|
||||
import { BaseChartDirective } from 'ng2-charts';
|
||||
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { LineConfig } from 'src/app/core/models';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { LineConfig } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-linearea-chart',
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Component, Input, OnChanges } from '@angular/core';
|
||||
//import { ChartDataset } from 'chart.js';
|
||||
import { BaseChartDirective } from 'ng2-charts';
|
||||
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { DoughnutConfig } from 'src/app/core/models';
|
||||
import { UtilitiesService } from '@services';
|
||||
import { DoughnutConfig } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pie-chart',
|
||||
|
||||
@@ -6,8 +6,8 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { Errors, Jump, JumpList, JumpListConfig } from 'src/app/core/models';
|
||||
import { JumpsService } from 'src/app/core/services';
|
||||
import { Errors, Jump, JumpList, JumpListConfig } from '@models';
|
||||
import { JumpsService } from '@services';
|
||||
import { JumpPreviewComponent } from './jump-preview.component';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, Input } from '@angular/core';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { RouterLink } from '@angular/router';
|
||||
|
||||
import { Jump } from 'src/app/core/models';
|
||||
import { Jump } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jump-meta',
|
||||
|
||||
@@ -7,8 +7,8 @@ import { MatDividerModule } from '@angular/material/divider';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { JumpMetaComponent } from './jump-meta.component';
|
||||
import { Jump } from 'src/app/core/models';
|
||||
import { JumpsService } from 'src/app/core/services';
|
||||
import { Jump } from '@models';
|
||||
import { JumpsService } from '@services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-jump-preview',
|
||||
|
||||
@@ -20,10 +20,10 @@ import { Observable, Subscription } from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
|
||||
|
||||
import { FrenchPaginator } from 'src/app/components/shared/french-paginator.component';
|
||||
import { ColumnDefinition, Errors, Jump, JumpByDay, JumpFile, JumpFileType, JumpList, JumpListConfig, jumpColumns } from 'src/app/core/models';
|
||||
import { JumpsService, JumpTableService } from 'src/app/core/services';
|
||||
import { JumpAddDialogComponent, JumpDeleteDialogComponent, JumpEditDialogComponent, JumpViewDialogComponent } from 'src/app/components/logbook/dialogs'
|
||||
import { FrenchPaginator } from '@components/shared/french-paginator.component';
|
||||
import { ColumnDefinition, Errors, Jump, JumpByDay, JumpFile, JumpFileType, JumpList, JumpListConfig, jumpColumns } from '@models';
|
||||
import { JumpsService, JumpTableService } from '@services';
|
||||
import { JumpAddDialogComponent, JumpDeleteDialogComponent, JumpEditDialogComponent, JumpViewDialogComponent } from '@components/logbook/dialogs'
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
//import { Errors } from 'src/app/core/models';
|
||||
//import { HWMember, HWGuildWarFortification, HWGuildWarHeroTeam, HWGuildWarTitanTeam } from 'src/app/core/models';
|
||||
import { HWGuildWarFortification, HWMember } from 'src/app/core/models';
|
||||
//import { Errors } from '@models';
|
||||
//import { HWMember, HWGuildWarFortification, HWGuildWarHeroTeam, HWGuildWarTitanTeam } from '@models';
|
||||
import { HWGuildWarFortification, HWMember } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-fortification-card-content',
|
||||
|
||||
@@ -4,7 +4,7 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { HWGuildData, HWGuildClan, HWGuildStat } from 'src/app/core/models';
|
||||
import { HWGuildData, HWGuildClan, HWGuildStat } from '@models';
|
||||
|
||||
import guildData from 'src/files-data/hw-guild-data.json'; // page Membres
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import { MatInputModule } from '@angular/material/input';
|
||||
import { MatStepperIntl, MatStepperModule } from '@angular/material/stepper';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
|
||||
import { HWGuildRaid, HWGuildRaidAttacker, HWGuildRaidAttackers, HWGuildRaidStage, HWMember } from 'src/app/core/models';
|
||||
import { HWGuildRaid, HWGuildRaidAttacker, HWGuildRaidAttackers, HWGuildRaidStage, HWMember } from '@models';
|
||||
|
||||
import guildRaids from 'src/files-data/hw-guild-raids.json'; // page Asgard -> Guild Raid -> Log
|
||||
|
||||
|
||||
+2
-2
@@ -4,11 +4,11 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { FortificationCardContentComponent } from 'src/app/components/shared';
|
||||
import { FortificationCardContentComponent } from '@components/shared';
|
||||
import {
|
||||
HWGuildWarEnemySlot, HWGuildWarEnemyTeam, HWGuildWarFortification,
|
||||
HWGuildWarHeroTeam, HWGuildWarTitanTeam, HWGuildWarSlots, HWMember
|
||||
} from 'src/app/core/models';
|
||||
} from '@models';
|
||||
|
||||
/* JSON data */
|
||||
import guildWarData from 'src/files-data/hw-guild-war.json'; // page Overview -> Statistics | page Guild War -> Guild War
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { HWMember } from 'src/app/core/models';
|
||||
//import { HWGuildWarFortification, HWMember } from 'src/app/core/models';
|
||||
import { HWMember } from '@models';
|
||||
//import { HWGuildWarFortification, HWMember } from '@models';
|
||||
|
||||
@Component({
|
||||
selector: 'app-guildwar-champions',
|
||||
|
||||
+6
-6
@@ -4,9 +4,9 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { FortificationCardContentComponent } from 'src/app/components/shared';
|
||||
//import { HWMember } from 'src/app/core/models';
|
||||
import { HWGuildWarFortification, HWGuildWarHeroTeam, HWGuildWarSlots, HWGuildWarTitanTeam, HWMember } from 'src/app/core/models';
|
||||
import { FortificationCardContentComponent } from '@components/shared';
|
||||
//import { HWMember } from '@models';
|
||||
import { HWGuildWarFortification, HWGuildWarHeroTeam, HWGuildWarSlots, HWGuildWarTitanTeam, HWMember } from '@models';
|
||||
|
||||
/* JSON data */
|
||||
import guildWarData from 'src/files-data/hw-guild-war.json'; // page Overview -> Statistics | page Guild War -> Guild War
|
||||
@@ -170,17 +170,17 @@ export class GuildwarDefenceComponent implements OnInit {
|
||||
}
|
||||
|
||||
getGatesOfNature(): HWGuildWarFortification {
|
||||
const indexes: number[] = [4, 9, 14, 19];
|
||||
const indexes: number[] = [5, 10, 15, 16];
|
||||
return this._getFortification(indexes, 'titans', 'Gates Of Nature');
|
||||
}
|
||||
|
||||
getBastionOfFire(): HWGuildWarFortification {
|
||||
const indexes: number[] = [5, 10, 15, 16];
|
||||
const indexes: number[] = [6, 11, 12, 17];
|
||||
return this._getFortification(indexes, 'titans', 'Bastion Of Fire');
|
||||
}
|
||||
|
||||
getBastionOfIce(): HWGuildWarFortification {
|
||||
const indexes: number[] = [6, 11, 12, 17];
|
||||
const indexes: number[] = [4, 9, 14, 19];
|
||||
return this._getFortification(indexes, 'titans', 'Bastion Of Ice');
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { HWGuildWarHeroTeam, HWGuildWarTitanTeam, HWMember } from 'src/app/core/models';
|
||||
import { HWGuildWarHeroTeam, HWGuildWarTitanTeam, HWMember } from '@models';
|
||||
|
||||
import guildWarData from 'src/files-data/hw-guild-war.json'; // page Overview -> Statistics | page Guild War -> Guild War
|
||||
|
||||
|
||||
+2
-2
@@ -4,8 +4,8 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { HWActivityStat, HWGuildClan, HWGuildData, HWMember, HWMemberStat, HWWeekStat } from 'src/app/core/models/herowars';
|
||||
import { UtilitiesService } from 'src/app/core/services';
|
||||
import { HWActivityStat, HWGuildClan, HWGuildData, HWMember, HWMemberStat, HWWeekStat } from '@models/herowars';
|
||||
import { UtilitiesService } from '@services';
|
||||
|
||||
import guildData from 'src/files-data/hw-guild-data.json'; // page Membres
|
||||
import guildStatistics from 'src/files-data/hw-guild-statistics.json'; // page Overview -> Statistics
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from './accordion';
|
||||
export * from './card-container/card-container.component';
|
||||
export * from './dashboard-components';
|
||||
export * from './helpers-chart';
|
||||
export * from './helpers-jump';
|
||||
|
||||
@@ -11,12 +11,12 @@ import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { Menu, User } from 'src/app/core/models';
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { MenuItems, ShowAuthedDirective, AccordionAnchorDirective, AccordionLinkDirective, AccordionDirective } from 'src/app/components/shared';
|
||||
//import { SpinnerComponent } from 'src/app/components/shared';
|
||||
//import { HeaderComponent, FooterComponent } from 'src/app/components/shared/layout';
|
||||
import { FooterComponent } from 'src/app/components/shared/layout';
|
||||
import { Menu, User } from '@models';
|
||||
import { UserService } from '@services';
|
||||
import { MenuItems, ShowAuthedDirective, AccordionAnchorDirective, AccordionLinkDirective, AccordionDirective } from '@components/shared';
|
||||
//import { SpinnerComponent } from '@components/shared';
|
||||
//import { HeaderComponent, FooterComponent } from '@components/shared/layout';
|
||||
import { FooterComponent } from '@components/shared/layout';
|
||||
|
||||
|
||||
/** @title Responsive sidenav */
|
||||
|
||||
@@ -9,8 +9,8 @@ import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { User } from 'src/app/core/models';
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { User } from '@models';
|
||||
import { UserService } from '@services';
|
||||
|
||||
@Component({
|
||||
selector: 'app-layout-header',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Menu } from 'src/app/core/models/menu.model';
|
||||
import { Menu } from '@models/menu.model';
|
||||
|
||||
const MENUAUTH: Menu[] = [
|
||||
{ state: 'home', type: 'link', name: 'Accueil', icon: 'home', icontype: 'mat', desc: '' },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Directive, Input, OnInit, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { UserService } from '@services';
|
||||
|
||||
@Directive({
|
||||
selector: '[appShowAuthed]',
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Application-wide constants
|
||||
*/
|
||||
|
||||
// Guild/Clan constants
|
||||
export const MAX_CLAN_MEMBERS = 30;
|
||||
|
||||
// Default values
|
||||
export const DEFAULT_PAGE_SIZE = 10;
|
||||
export const DEFAULT_TIMEOUT = 30000; // ms
|
||||
@@ -0,0 +1 @@
|
||||
export * from './app.constants';
|
||||
@@ -2,7 +2,7 @@ import { inject } from '@angular/core';
|
||||
import { CanActivateFn, Router } from '@angular/router';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { UserService } from '@services';
|
||||
|
||||
export const adminGuard: CanActivateFn = () => {
|
||||
const router = inject(Router);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { inject } from '@angular/core';
|
||||
import { CanActivateFn, Router } from '@angular/router';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { UserService } from '@services';
|
||||
|
||||
export const authGuard: CanActivateFn = () => {
|
||||
const router = inject(Router);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CanActivateFn } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { UserService } from '@services';
|
||||
|
||||
export const noauthGuard: CanActivateFn = (): Observable<boolean> => {
|
||||
/*
|
||||
|
||||
@@ -4,3 +4,4 @@ export * from './interceptors';
|
||||
export * from './models';
|
||||
export * from './resolvers';
|
||||
export * from './services';
|
||||
export * from './viewmodels';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { HttpInterceptorFn } from "@angular/common/http";
|
||||
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { environment } from '@environments/environment';
|
||||
|
||||
export const apiInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
const apiReq = req.clone({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { inject } from "@angular/core";
|
||||
import { HttpInterceptorFn } from "@angular/common/http";
|
||||
import { JwtService } from "src/app/core/services/jwt.service";
|
||||
import { JwtService } from "@services/jwt.service";
|
||||
|
||||
export const tokenInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
const token = inject(JwtService).getToken();
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface CardColors {
|
||||
background: string;
|
||||
text: string;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { HWClan } from './clan.model';
|
||||
import { PageLinks, PageMeta } from '../shared.model';
|
||||
|
||||
export interface HWClanPageData {
|
||||
clan: HWClan;
|
||||
_links: PageLinks;
|
||||
_meta: PageMeta;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { HWMember } from './member.model';
|
||||
import { HWActivityStat, HWGuildStat, HWMemberStat } from './stat.model';
|
||||
import { PageLinks, PageMeta } from '../shared.model';
|
||||
import { HWActivityStat, HWClanIcon, HWGuildStat, HWMemberStat } from './stat.model';
|
||||
|
||||
export interface HWGuildClan {
|
||||
id: string;
|
||||
@@ -8,13 +7,7 @@ export interface HWGuildClan {
|
||||
level: string;
|
||||
title: string;
|
||||
description: string;
|
||||
icon: {
|
||||
flagColor1: number;
|
||||
flagColor2: number;
|
||||
flagShape: number;
|
||||
iconColor: number;
|
||||
iconShape: number;
|
||||
};
|
||||
icon: HWClanIcon;
|
||||
country: string;
|
||||
minLevel: string;
|
||||
serverId: string;
|
||||
@@ -58,13 +51,7 @@ export interface HWClan {
|
||||
description: string;
|
||||
disbanding: boolean;
|
||||
frameId: number;
|
||||
icon: {
|
||||
flagColor1: number;
|
||||
flagColor2: number;
|
||||
flagShape: number;
|
||||
iconColor: number;
|
||||
iconShape: number;
|
||||
};
|
||||
icon: HWClanIcon;
|
||||
level: string;
|
||||
members: {[key: string]: HWMember};
|
||||
membersCount: string;
|
||||
@@ -76,9 +63,3 @@ export interface HWClan {
|
||||
topActivity: string;
|
||||
topDungeon: string;
|
||||
}
|
||||
|
||||
export interface HWClanPageData {
|
||||
clan: HWClan;
|
||||
_links: PageLinks;
|
||||
_meta: PageMeta;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
export * from './clan.model';
|
||||
export * from './clan-list-config.model';
|
||||
export * from './clan-list.model';
|
||||
export * from './clan.model';
|
||||
export * from './clan-page-data.model';
|
||||
export * from './fortification.model';
|
||||
export * from './guildwar.model';
|
||||
//export * from './hw.model';
|
||||
export * from './member.model';
|
||||
export * from './member-list-config.model';
|
||||
export * from './member-list.model';
|
||||
export * from './member-page-data.model';
|
||||
export * from './raid.model';
|
||||
export * from './stat.model';
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
export interface HWMemberListConfig {
|
||||
type: string;
|
||||
filters: HWMemberListFilters;
|
||||
}
|
||||
|
||||
export interface HWMemberListFilters {
|
||||
id?: string;
|
||||
name?: string;
|
||||
clanId?: string;
|
||||
clanTitle?: string;
|
||||
serverId?: string;
|
||||
level?: string;
|
||||
commander?: boolean;
|
||||
champion?: boolean;
|
||||
leagueId?: number;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { HWMember } from './member.model';
|
||||
|
||||
export interface HWMemberList {
|
||||
members: Array<HWMember>;
|
||||
membersCount: number;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { HWMember } from './member.model';
|
||||
import { PageLinks, PageMeta } from '../shared.model';
|
||||
|
||||
export interface HWMemberPageData {
|
||||
member: HWMember;
|
||||
_links: PageLinks;
|
||||
_meta: PageMeta;
|
||||
}
|
||||
@@ -1,18 +1,14 @@
|
||||
import { HWGuildRaid } from './raid.model';
|
||||
import { HWMemberStat, HWWeekStat } from './stat.model';
|
||||
import { HWGuildWarHeroTeam, HWGuildWarTitanTeam } from './guildwar.model';
|
||||
import {
|
||||
HWMemberStat, HWWeekStat, HWClanIcon, HWInactivity,
|
||||
HWRaidsInfo, HWMemberHeroes, HWMemberTitans
|
||||
} from './stat.model';
|
||||
|
||||
export interface HWMember {
|
||||
id: string;
|
||||
allowPm: string;
|
||||
avatarId: string;
|
||||
clanIcon: {
|
||||
flagColor1: number;
|
||||
flagColor2: number;
|
||||
flagShape: number;
|
||||
iconColor: number;
|
||||
iconShape: number;
|
||||
};
|
||||
clanIcon: HWClanIcon;
|
||||
clanId: string;
|
||||
clanRole: string;
|
||||
clanTitle: string;
|
||||
@@ -26,21 +22,10 @@ export interface HWMember {
|
||||
serverId: string;
|
||||
showProfile: boolean;
|
||||
champion: boolean;
|
||||
heroes: {
|
||||
power: number;
|
||||
teams: HWGuildWarHeroTeam[];
|
||||
};
|
||||
titans: {
|
||||
power: number;
|
||||
teams: HWGuildWarTitanTeam[];
|
||||
};
|
||||
heroes: HWMemberHeroes;
|
||||
titans: HWMemberTitans;
|
||||
stat: HWMemberStat;
|
||||
inactivity: {
|
||||
daysLeft: number,
|
||||
timeLeft: number,
|
||||
dropDate: number;
|
||||
dropDelay: string;
|
||||
}
|
||||
inactivity: HWInactivity;
|
||||
adventureSum: number;
|
||||
clanGiftsSum: number;
|
||||
clanWarSum: number;
|
||||
@@ -50,8 +35,5 @@ export interface HWMember {
|
||||
warGifts: number;
|
||||
rewards: number;
|
||||
raids: HWGuildRaid[];
|
||||
raidsInfo: {
|
||||
variationAvg: number;
|
||||
variationSum: number;
|
||||
}
|
||||
raidsInfo: HWRaidsInfo;
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
import { HWGuildWarHeroTeam, HWGuildWarTitanTeam } from './guildwar.model';
|
||||
|
||||
export interface HWGuildStat {
|
||||
todayActivity: number;
|
||||
activitySum: number;
|
||||
@@ -39,4 +41,34 @@ export interface HWMemberStat {
|
||||
wasChampion: boolean;
|
||||
todayPrestige: number;
|
||||
prestigeSum: number;
|
||||
}
|
||||
|
||||
export interface HWClanIcon {
|
||||
flagColor1: number;
|
||||
flagColor2: number;
|
||||
flagShape: number;
|
||||
iconColor: number;
|
||||
iconShape: number;
|
||||
}
|
||||
|
||||
export interface HWInactivity {
|
||||
daysLeft: number;
|
||||
timeLeft: number;
|
||||
dropDate: number;
|
||||
dropDelay: string;
|
||||
}
|
||||
|
||||
export interface HWRaidsInfo {
|
||||
variationAvg: number;
|
||||
variationSum: number;
|
||||
}
|
||||
|
||||
export interface HWMemberHeroes {
|
||||
power: number;
|
||||
teams: HWGuildWarHeroTeam[];
|
||||
}
|
||||
|
||||
export interface HWMemberTitans {
|
||||
power: number;
|
||||
teams: HWGuildWarTitanTeam[];
|
||||
}
|
||||
@@ -9,6 +9,7 @@ export * from './application-list-config.model';
|
||||
export * from './brand.model';
|
||||
export * from './calculator.model';
|
||||
export * from './canopy.model';
|
||||
export * from './card-colors.model';
|
||||
export * from './category.model';
|
||||
export * from './chart.model';
|
||||
export * from './dropzone.model';
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { AeronefsPageData } from 'src/app/core/models';
|
||||
import { PagesService } from 'src/app/core/services';
|
||||
import { AeronefsPageData } from '@models';
|
||||
import { PagesService } from '@services';
|
||||
|
||||
export const aeronefsPageResolver: ResolveFn<AeronefsPageData> = () => {
|
||||
return inject(PagesService).getAeronefsPage().pipe(take(1));
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { ArticlePageData } from 'src/app/core/models';
|
||||
import { ArticlesService } from 'src/app/core/services';
|
||||
import { ArticlePageData } from '@models';
|
||||
import { ArticlesService } from '@services';
|
||||
|
||||
export const articleResolver: ResolveFn<ArticlePageData> = (
|
||||
route: ActivatedRouteSnapshot
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { Article } from 'src/app/core/models';
|
||||
import { ArticlesService } from 'src/app/core/services';
|
||||
import { Article } from '@models';
|
||||
import { ArticlesService } from '@services';
|
||||
|
||||
export const articlesResolver: ResolveFn<Array<Article>> = () => {
|
||||
return inject(ArticlesService).getAll().pipe(take(1));
|
||||
|
||||
@@ -2,7 +2,7 @@ import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { UserService } from '@services';
|
||||
|
||||
export const authResolver: ResolveFn<boolean> = () => {
|
||||
return inject(UserService).isAuthenticated.pipe(take(1));
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { CanopiesPageData } from 'src/app/core/models';
|
||||
import { PagesService } from 'src/app/core/services';
|
||||
import { CanopiesPageData } from '@models';
|
||||
import { PagesService } from '@services';
|
||||
|
||||
export const canopiesPageResolver: ResolveFn<CanopiesPageData> = () => {
|
||||
return inject(PagesService).getCanopiesPage().pipe(take(1));
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { DropZonesPageData } from 'src/app/core/models';
|
||||
import { PagesService } from 'src/app/core/services';
|
||||
import { DropZonesPageData } from '@models';
|
||||
import { PagesService } from '@services';
|
||||
|
||||
export const dropZonesPageResolver: ResolveFn<DropZonesPageData> = () => {
|
||||
return inject(PagesService).getDropZonesPage().pipe(take(1));
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { JumpPageData } from 'src/app/core/models';
|
||||
import { JumpsService } from 'src/app/core/services';
|
||||
import { JumpPageData } from '@models';
|
||||
import { JumpsService } from '@services';
|
||||
|
||||
export const jumpResolver: ResolveFn<JumpPageData> = (
|
||||
route: ActivatedRouteSnapshot
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { JumpsPageData } from 'src/app/core/models';
|
||||
import { PagesService } from 'src/app/core/services';
|
||||
import { JumpsPageData } from '@models';
|
||||
import { PagesService } from '@services';
|
||||
|
||||
export const jumpsPageResolver: ResolveFn<JumpsPageData> = () => {
|
||||
return inject(PagesService).getJumpsPage().pipe(take(1));
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { Jump } from 'src/app/core/models';
|
||||
import { JumpsService } from 'src/app/core/services';
|
||||
import { Jump } from '@models';
|
||||
import { JumpsService } from '@services';
|
||||
|
||||
export const jumpsResolver: ResolveFn<Array<Jump>> = () => {
|
||||
return inject(JumpsService).getAll().pipe(take(1));
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { Jump } from 'src/app/core/models';
|
||||
import { JumpsService } from 'src/app/core/services';
|
||||
import { Jump } from '@models';
|
||||
import { JumpsService } from '@services';
|
||||
|
||||
export const lastjumpResolver: ResolveFn<Jump> = () => {
|
||||
return inject(JumpsService).getLastJump().pipe(take(1));
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { ProductPageData } from 'src/app/core/models';
|
||||
import { ProductsService } from 'src/app/core/services';
|
||||
import { ProductPageData } from '@models';
|
||||
import { ProductsService } from '@services';
|
||||
|
||||
export const productResolver: ResolveFn<ProductPageData> = (
|
||||
route: ActivatedRouteSnapshot
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { ProductsPageData } from 'src/app/core/models';
|
||||
import { ProductsService } from 'src/app/core/services';
|
||||
import { ProductsPageData } from '@models';
|
||||
import { ProductsService } from '@services';
|
||||
|
||||
export const productsResolver: ResolveFn<ProductsPageData> = (
|
||||
route: ActivatedRouteSnapshot
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { Profile } from 'src/app/core/models';
|
||||
import { ProfilesService } from 'src/app/core/services';
|
||||
import { Profile } from '@models';
|
||||
import { ProfilesService } from '@services';
|
||||
|
||||
export const profileResolver: ResolveFn<Profile> = (
|
||||
route: ActivatedRouteSnapshot
|
||||
|
||||
@@ -2,8 +2,8 @@ import { inject } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
import { Qcm } from 'src/app/core/models';
|
||||
import { QcmService } from 'src/app/core/services';
|
||||
import { Qcm } from '@models';
|
||||
import { QcmService } from '@services';
|
||||
|
||||
export const qcmResolver: ResolveFn<Qcm> = (
|
||||
route: ActivatedRouteSnapshot
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
//import { environment } from 'src/environments/environment';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ApiService {
|
||||
constructor(
|
||||
|
||||
@@ -3,11 +3,12 @@ import { HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { ApiService } from './api.service';
|
||||
import { Application, ApplicationList, ApplicationListConfig, ApplicationListFilters } from 'src/app/core/models';
|
||||
import { Application, ApplicationList, ApplicationListConfig, ApplicationListFilters } from '@models';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ApplicationsService {
|
||||
private _apiVersion = '/v1';
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
@@ -22,7 +23,7 @@ export class ApplicationsService {
|
||||
};
|
||||
return this.apiService
|
||||
.get(
|
||||
'/applications' + ((config.type === 'feed') ? '/feed' : ''),
|
||||
`${this._apiVersion}/applications` + ((config.type === 'feed') ? '/feed' : ''),
|
||||
new HttpParams({ fromObject: <{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}>params })
|
||||
@@ -30,22 +31,22 @@ export class ApplicationsService {
|
||||
}
|
||||
|
||||
get(slug: string): Observable<Application> {
|
||||
return this.apiService.get(`/applications/${slug}`)
|
||||
return this.apiService.get(`${this._apiVersion}/applications/${slug}`)
|
||||
.pipe(map(data => data.application));
|
||||
}
|
||||
|
||||
destroy(slug: string): Observable<boolean> {
|
||||
return this.apiService.delete(`/applications/${slug}`).pipe(map(data => data.deleted));
|
||||
return this.apiService.delete(`${this._apiVersion}/applications/${slug}`).pipe(map(data => data.deleted));
|
||||
}
|
||||
|
||||
save(application: Application): Observable<Application> {
|
||||
if (application.slug) {
|
||||
// If we're updating an existing application
|
||||
return this.apiService.put(`/applications/${application.slug}`, { application: application })
|
||||
return this.apiService.put(`${this._apiVersion}/applications/${application.slug}`, { application: application })
|
||||
.pipe(map(data => data.application));
|
||||
} else {
|
||||
// Otherwise, create a new application
|
||||
return this.apiService.post('/applications/', { application: application })
|
||||
return this.apiService.post(`${this._apiVersion}/applications/`, { application: application })
|
||||
.pipe(map(data => data.application));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { ApiService } from './api.service';
|
||||
import { Article, ArticleList, ArticleListConfig, ArticleListFilters, ArticlePageData } from 'src/app/core/models';
|
||||
import { Article, ArticleList, ArticleListConfig, ArticleListFilters, ArticlePageData } from '@models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ArticlesService {
|
||||
private _apiVersion = '/v2';
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
@@ -18,7 +19,7 @@ export class ArticlesService {
|
||||
Object.assign(params, config.filters);
|
||||
return this.apiService
|
||||
.get(
|
||||
'/articles' + ((config.type === 'feed') ? '/feed' : ''),
|
||||
`${this._apiVersion}/articles` + ((config.type === 'feed') ? '/feed' : ''),
|
||||
new HttpParams({ fromObject: <{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}>params })
|
||||
@@ -26,49 +27,49 @@ export class ArticlesService {
|
||||
}
|
||||
|
||||
get(slug: string): Observable<ArticlePageData> {
|
||||
/*return this.apiService.get('/articles/' + slug).pipe(map(data => {
|
||||
/*return this.apiService.get(`${this._apiVersion}/articles/${slug}`).pipe(map(data => {
|
||||
data.article.tagList = data.article.tagNameTagTagLists;
|
||||
delete data.article.tagNameTagTagLists;
|
||||
return data;
|
||||
}));*/
|
||||
return this.apiService.get(`/articles/${slug}`);
|
||||
return this.apiService.get(`${this._apiVersion}/articles/${slug}`);
|
||||
}
|
||||
|
||||
getAll(): Observable<Array<Article>> {
|
||||
return this.apiService.get('/articles').pipe(map(data => data.articles));
|
||||
return this.apiService.get(`${this._apiVersion}/articles`).pipe(map(data => data.articles));
|
||||
}
|
||||
|
||||
create(article: Article): Observable<Article> {
|
||||
return this.apiService.post('/articles/', { article: article }).pipe(map(data => data.article));
|
||||
return this.apiService.post(`${this._apiVersion}/articles/`, { article: article }).pipe(map(data => data.article));
|
||||
}
|
||||
|
||||
update(article: Article): Observable<Article> {
|
||||
return this.apiService.put(`/articles/${article.slug}`, { article: article }).pipe(map(data => data.article));
|
||||
return this.apiService.put(`${this._apiVersion}/articles/${article.slug}`, { article: article }).pipe(map(data => data.article));
|
||||
}
|
||||
|
||||
destroy(slug: string): Observable<boolean> {
|
||||
return this.apiService.delete(`/products/${slug}`).pipe(map(data => data.deleted));
|
||||
return this.apiService.delete(`${this._apiVersion}/articles/${slug}`).pipe(map(data => data.deleted));
|
||||
}
|
||||
|
||||
save(article: Article): Observable<Article> {
|
||||
// If we're updating an existing article
|
||||
if (article.slug) {
|
||||
return this.apiService.put('/articles/' + article.slug, { article: article })
|
||||
return this.apiService.put(`${this._apiVersion}/articles/${article.slug}`, { article: article })
|
||||
.pipe(map(data => data.article));
|
||||
|
||||
// Otherwise, create a new article
|
||||
} else {
|
||||
return this.apiService.post('/articles/', { article: article })
|
||||
return this.apiService.post(`${this._apiVersion}/articles/`, { article: article })
|
||||
.pipe(map(data => data.article));
|
||||
}
|
||||
}
|
||||
|
||||
favorite(slug: string): Observable<Article> {
|
||||
return this.apiService.post('/articles/' + slug + '/favorite');
|
||||
return this.apiService.post(`${this._apiVersion}/articles/${slug}/favorite`);
|
||||
}
|
||||
|
||||
unfavorite(slug: string): Observable<Article> {
|
||||
return this.apiService.delete('/articles/' + slug + '/favorite');
|
||||
return this.apiService.delete(`${this._apiVersion}/articles/${slug}/favorite`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { ApiService } from '../api.service';
|
||||
import {
|
||||
HWActivityStat, HWClan, HWClanList, HWClanListConfig,
|
||||
HWClanListFilters, HWClanPageData, HWGuildClan,
|
||||
HWMember
|
||||
} from '@models';
|
||||
|
||||
import guildData from 'src/files-data/hw-guild-data.json'; // page Membres
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class HWClanService {
|
||||
private apiVersion = '/v3';
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
private _resetActivity(): HWActivityStat {
|
||||
const activity: HWActivityStat = { activity: 0, prestige: 0, titanite: 0, war: 0, adventure: 0, gifts: 0, score: 0, scoreGifts: 0, warGifts: 0, rewards: 0 };
|
||||
return activity;
|
||||
}
|
||||
|
||||
query(config: HWClanListConfig): Observable<HWClanList> {
|
||||
// Convert any filters over to Angular's URLSearchParams
|
||||
const params: HWClanListFilters = {} as HWClanListFilters;
|
||||
Object.assign(params, config.filters);
|
||||
return this.apiService
|
||||
.get(
|
||||
`${this.apiVersion}/clans`,
|
||||
new HttpParams({ fromObject: <{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}>params })
|
||||
);
|
||||
}
|
||||
|
||||
get(id: string): Observable<HWClanPageData> {
|
||||
return this.apiService.get(`${this.apiVersion}/clans/${id}`);
|
||||
}
|
||||
|
||||
getAll(): Observable<Array<HWClan>> {
|
||||
return this.apiService.get(`${this.apiVersion}/clans`).pipe(map(data => data.clans));
|
||||
}
|
||||
|
||||
create(clan: HWClan): Observable<HWClan> {
|
||||
return this.apiService.post(`${this.apiVersion}/clans/`, { clan: clan }).pipe(map(data => data.clan));
|
||||
}
|
||||
|
||||
update(clan: HWClan): Observable<HWClan> {
|
||||
return this.apiService.put(`${this.apiVersion}/clans/${clan.id}`, { clan: clan }).pipe(map(data => data.clan));
|
||||
}
|
||||
|
||||
destroy(id: string): Observable<boolean> {
|
||||
return this.apiService.delete(`${this.apiVersion}/clans/${id}`).pipe(map(data => data.deleted));
|
||||
}
|
||||
|
||||
save(clan: HWClan): Observable<HWClan> {
|
||||
// If we're updating an existing clan
|
||||
if (clan.id) {
|
||||
return this.apiService.put(`${this.apiVersion}/clans/${clan.id}`, { clan: clan }).pipe(map(data => data.clan));
|
||||
// Otherwise, create a new clan
|
||||
} else {
|
||||
return this.apiService.post(`${this.apiVersion}/clans/`, { clan: clan }).pipe(map(data => data.clan));
|
||||
}
|
||||
}
|
||||
|
||||
loadClan(): HWGuildClan {
|
||||
const guildClan: HWGuildClan = {} as HWGuildClan;
|
||||
Object.assign(guildClan, guildData.clan);
|
||||
guildClan.sumAverages = this._resetActivity();
|
||||
guildClan.sumTotal = this._resetActivity();
|
||||
guildClan.todayAverages = this._resetActivity();
|
||||
guildClan.todayTotal = this._resetActivity();
|
||||
|
||||
return guildClan;
|
||||
}
|
||||
|
||||
loadClanStats(clan: HWGuildClan, members: HWMember[]): HWGuildClan {
|
||||
members.map((member: HWMember) => {
|
||||
clan.sumTotal.adventure += member.adventureSum;
|
||||
clan.sumTotal.gifts += member.clanGiftsSum;
|
||||
clan.sumTotal.war += member.clanWarSum;
|
||||
clan.todayTotal.activity += member.stat.todayActivity;
|
||||
clan.todayTotal.prestige += member.stat.todayPrestige;
|
||||
clan.todayTotal.titanite += member.stat.todayDungeonActivity;
|
||||
clan.todayTotal.score += (member.stat.todayDungeonActivity + member.stat.todayActivity + member.stat.todayPrestige);
|
||||
clan.sumTotal.activity += member.stat.activitySum;
|
||||
clan.sumTotal.prestige += member.stat.prestigeSum;
|
||||
clan.sumTotal.titanite += member.stat.dungeonActivitySum;
|
||||
clan.sumTotal.score += member.score;
|
||||
clan.sumTotal.warGifts += member.warGifts;
|
||||
});
|
||||
clan.sumTotal.scoreGifts = (clan.giftsCount - Math.floor(clan.sumTotal.warGifts));
|
||||
clan.todayAverages.activity = (clan.todayTotal.activity / members.length);
|
||||
clan.todayAverages.prestige = (clan.todayTotal.prestige / members.length);
|
||||
clan.todayAverages.titanite = (clan.todayTotal.titanite / members.length);
|
||||
clan.todayAverages.score = (clan.todayTotal.score / members.length);
|
||||
clan.sumAverages.activity = (clan.sumTotal.activity / members.length);
|
||||
clan.sumAverages.prestige = (clan.sumTotal.prestige / members.length);
|
||||
clan.sumAverages.titanite = (clan.sumTotal.titanite / members.length);
|
||||
if (clan.league === '3') {
|
||||
clan.sumAverages.war = (clan.sumTotal.war / 10);
|
||||
} else if (clan.league === '2') {
|
||||
clan.sumAverages.war = (clan.sumTotal.war / 15);
|
||||
} else if (clan.league === '1') {
|
||||
clan.sumAverages.war = (clan.sumTotal.war / 20);
|
||||
}
|
||||
clan.sumAverages.adventure = (clan.sumTotal.adventure / members.length);
|
||||
clan.sumAverages.gifts = (clan.sumTotal.gifts / members.length);
|
||||
clan.sumAverages.score = (clan.sumTotal.score / members.length);
|
||||
clan.sumAverages.scoreGifts = (clan.sumTotal.scoreGifts / members.length);
|
||||
clan.sumAverages.warGifts = (clan.sumTotal.warGifts / members.length);
|
||||
members.map((data) => {
|
||||
data.scoreGifts = ((data.score / clan.sumTotal.score) * clan.sumTotal.scoreGifts);
|
||||
data.rewards = Math.floor((data.scoreGifts + data.warGifts));
|
||||
clan.sumTotal.rewards += data.rewards;
|
||||
return data;
|
||||
});
|
||||
clan.sumAverages.rewards = (clan.sumTotal.rewards / members.length);
|
||||
|
||||
return clan;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { ApiService, UtilitiesService } from '@services';
|
||||
import {
|
||||
HWGuildClan, HWWeekStat,
|
||||
HWMember, HWMemberList, HWMemberListConfig,
|
||||
HWMemberListFilters, HWMemberPageData, HWMemberStat
|
||||
} from '@models';
|
||||
|
||||
import guildData from 'src/files-data/hw-guild-data.json'; // page Membres
|
||||
import guildStatistics from 'src/files-data/hw-guild-statistics.json'; // page Overview -> Statistics
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class HWMemberService {
|
||||
private apiVersion = '/v3';
|
||||
constructor(
|
||||
private _apiService: ApiService,
|
||||
private _utilitiesService: UtilitiesService
|
||||
) { }
|
||||
|
||||
query(config: HWMemberListConfig): Observable<HWMemberList> {
|
||||
// Convert any filters over to Angular's URLSearchParams
|
||||
const params: HWMemberListFilters = {} as HWMemberListFilters;
|
||||
Object.assign(params, config.filters);
|
||||
return this._apiService
|
||||
.get(
|
||||
`${this.apiVersion}/members`,
|
||||
new HttpParams({ fromObject: <{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}>params })
|
||||
);
|
||||
}
|
||||
|
||||
get(id: string): Observable<HWMemberPageData> {
|
||||
return this._apiService.get(`${this.apiVersion}/members/${id}`);
|
||||
}
|
||||
|
||||
getAll(): Observable<Array<HWMember>> {
|
||||
return this._apiService.get(`${this.apiVersion}/members`).pipe(map(data => data.members));
|
||||
}
|
||||
|
||||
create(member: HWMember): Observable<HWMember> {
|
||||
return this._apiService.post(`${this.apiVersion}/members/`, { member: member }).pipe(map(data => data.member));
|
||||
}
|
||||
|
||||
update(member: HWMember): Observable<HWMember> {
|
||||
return this._apiService.put(`${this.apiVersion}/members/${member.id}`, { member: member }).pipe(map(data => data.member));
|
||||
}
|
||||
|
||||
destroy(id: string): Observable<boolean> {
|
||||
return this._apiService.delete(`${this.apiVersion}/members/${id}`).pipe(map(data => data.deleted));
|
||||
}
|
||||
|
||||
save(member: HWMember): Observable<HWMember> {
|
||||
// If we're updating an existing member
|
||||
if (member.id) {
|
||||
return this._apiService.put(`${this.apiVersion}/members/${member.id}`, { member: member }).pipe(map(data => data.member));
|
||||
// Otherwise, create a new member
|
||||
} else {
|
||||
return this._apiService.post(`${this.apiVersion}/members/`, { member: member }).pipe(map(data => data.member));
|
||||
}
|
||||
}
|
||||
|
||||
loadMembers(clan: HWGuildClan): HWMember[] {
|
||||
const guildMembers: HWMember[] = [];
|
||||
const now = new Date();
|
||||
const oneDayInSec = (24 * 60 * 60);
|
||||
const daysToKick = parseInt(guildData.clan.daysToKick);
|
||||
for (const data of Object.entries(guildData.clan.members)) {
|
||||
const member: HWMember = {} as HWMember;
|
||||
Object.assign(member, data[1]);
|
||||
if (guildData.clan.warriors.indexOf(parseInt(member.id)) !== -1) {
|
||||
member.champion = true;
|
||||
} else {
|
||||
member.champion = false;
|
||||
}
|
||||
member.heroes = { power: 0, teams: []};
|
||||
member.titans = { power: 0, teams: []};
|
||||
guildMembers.push(member);
|
||||
}
|
||||
guildMembers.map((data: HWMember) => {
|
||||
const last = new Date((parseInt(data.lastLoginTime) * 1000));
|
||||
const exp = new Date(last.getTime() + ((daysToKick * oneDayInSec) * 1000));
|
||||
const diff = Math.floor(((exp.getTime() - now.getTime()) / 1000));
|
||||
const daysLeft = Math.floor((diff / oneDayInSec));
|
||||
let timeLeft = diff;
|
||||
if (daysLeft >= 1) {
|
||||
timeLeft = (diff - (daysLeft * oneDayInSec));
|
||||
}
|
||||
data.inactivity = {
|
||||
daysLeft: daysLeft,
|
||||
timeLeft: timeLeft,
|
||||
dropDelay: `${daysLeft}d, ${this._utilitiesService.secondsToDuration(timeLeft)}`,
|
||||
dropDate: Math.floor((exp.getTime() / 1000))
|
||||
};
|
||||
data.raids = [];
|
||||
data.raidsInfo = {
|
||||
variationAvg: 0,
|
||||
variationSum: 0
|
||||
};
|
||||
data.stat = {} as HWMemberStat;
|
||||
let index = guildData.membersStat.findIndex(stat => stat.userId === data.id);
|
||||
if (index !== -1) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
||||
const { userId, ...memberStatWithoutUserId } = guildData.membersStat[index] as any;
|
||||
Object.assign(data.stat, memberStatWithoutUserId);
|
||||
}
|
||||
index = guildStatistics.stat.findIndex(stat => stat.id === data.id);
|
||||
if (index !== -1) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
||||
const { id, ...weekStatSource } = guildStatistics.stat[index] as any;
|
||||
const stat: HWWeekStat = {} as HWWeekStat;
|
||||
Object.assign(stat, weekStatSource);
|
||||
data.weekStat = stat;
|
||||
data.adventureSum = guildStatistics.stat[index].adventureStat.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
||||
data.clanGiftsSum = guildStatistics.stat[index].clanGifts.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
||||
data.clanWarSum = guildStatistics.stat[index].clanWarStat.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
||||
} else {
|
||||
data.weekStat = {} as HWWeekStat;
|
||||
data.adventureSum = 0;
|
||||
data.clanGiftsSum = 0;
|
||||
data.clanWarSum = 0;
|
||||
}
|
||||
|
||||
data.score = (data.stat.dungeonActivitySum + data.stat.activitySum + data.stat.prestigeSum);
|
||||
data.warGifts = (((clan.giftsCount / 2) * ((data.clanWarSum * 10) / 100)) / 20);
|
||||
data.scoreGifts = 0;
|
||||
data.rewards = 0;
|
||||
return data;
|
||||
});
|
||||
|
||||
return guildMembers;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
export * from './hwclan.service';
|
||||
export * from './hwmember.service';
|
||||
@@ -1,60 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { ApiService } from './api.service';
|
||||
import {
|
||||
HWClan, HWClanList, HWClanListConfig, HWClanListFilters, HWClanPageData
|
||||
} from 'src/app/core/models';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class HWClanService {
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
query(config: HWClanListConfig): Observable<HWClanList> {
|
||||
// Convert any filters over to Angular's URLSearchParams
|
||||
const params: HWClanListFilters = {} as HWClanListFilters;
|
||||
Object.assign(params, config.filters);
|
||||
return this.apiService
|
||||
.get(
|
||||
'/clans',
|
||||
new HttpParams({ fromObject: <{
|
||||
[param: string]: string | number | boolean | readonly (string | number | boolean)[];
|
||||
}>params })
|
||||
);
|
||||
}
|
||||
|
||||
get(id: string): Observable<HWClanPageData> {
|
||||
return this.apiService.get(`/clans/${id}`);
|
||||
}
|
||||
|
||||
getAll(): Observable<Array<HWClan>> {
|
||||
return this.apiService.get('/clans').pipe(map(data => data.clans));
|
||||
}
|
||||
|
||||
create(clan: HWClan): Observable<HWClan> {
|
||||
return this.apiService.post('/clans/', { clan: clan }).pipe(map(data => data.clan));
|
||||
}
|
||||
|
||||
update(clan: HWClan): Observable<HWClan> {
|
||||
return this.apiService.put(`/clans/${clan.id}`, { clan: clan }).pipe(map(data => data.clan));
|
||||
}
|
||||
|
||||
destroy(id: string): Observable<boolean> {
|
||||
return this.apiService.delete(`/clans/${id}`).pipe(map(data => data.deleted));
|
||||
}
|
||||
|
||||
save(clan: HWClan): Observable<HWClan> {
|
||||
// If we're updating an existing clan
|
||||
if (clan.id) {
|
||||
return this.apiService.put(`/clans/${clan.id}`, { clan: clan }).pipe(map(data => data.clan));
|
||||
// Otherwise, create a new clan
|
||||
} else {
|
||||
return this.apiService.post('/clans/', { clan: clan }).pipe(map(data => data.clan));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user