Skip to content

Commit

Permalink
Merge pull request #2253 from aura-nw/baseline/main_20230823
Browse files Browse the repository at this point in the history
Baseline/main 20230823
  • Loading branch information
nhphuc2411 authored Aug 24, 2023
2 parents 4ebda3e + a3ea673 commit af22be0
Show file tree
Hide file tree
Showing 39 changed files with 518 additions and 414 deletions.
6 changes: 3 additions & 3 deletions src/app/core/constants/chart.constant.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const AURA_TOP_STATISTIC_RANGE = {
D_1: '1',
D_3: '3',
D_7: '7',
Range1: '3',
Range2: '15',
Range3: '30',
};

export const TABS_TITLE_TOP_STATISTICS = [
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/helpers/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function exportStatisticChart(data: any, type: string, currDate: string)
case 'unique-addresses':
label = 'Aura Unique Addresses Data';
break;
case 'cumulative-addresses':
case 'daily_active_addresses':
label = 'Active Aura Addresses Data';
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/services/contract.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class ContractService extends CommonService {
updated_at
creator
}
smart_contract_aggregate(where: {${typeQuery} ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) {
smart_contract_aggregate(where: {${typeQuery} ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}, status: {_eq: "LATEST"}}) {
aggregate {
count
}
Expand Down
52 changes: 26 additions & 26 deletions src/app/core/services/statistic.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,44 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import * as _ from 'lodash';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { EnvironmentService } from '../data-services/environment.service';
import { CommonService } from './common.service';

@Injectable()
export class StatisticService extends CommonService {
chainInfo = this.environmentService.configValue.chain_info;
indexerUrl = `${this.environmentService.configValue.indexerUri}`;

constructor(private http: HttpClient, private environmentService: EnvironmentService) {
super(http, environmentService);
}

getListAccountStatistic(dayRange, limit): Observable<any> {
const params = _({
chainId: this.chainInfo.chainId,
dayRange : dayRange,
limit : limit,
})
.omitBy(_.isNull)
.omitBy(_.isUndefined)
.value();
return this.http.get<any>(`${this.indexerUrl}/account-statistics`, {
params,
});
getListAccountStatistic(): Observable<any> {
return this.http.get<any>(`${this.horoscopeApi}/statistics/top-accounts?chainid=${this.chainId}`);
}

getDailyTxStatistic(property: "daily_txs" | "daily_active_addresses" | "unique_addresses", startDate, endDate): Observable<any> {
const params = _({
chainId: this.chainInfo.chainId,
property,
startDate,
endDate
})
.omitBy(_.isNull)
.omitBy(_.isUndefined)
.value();
return this.http.get<any>(`${this.indexerUrl}/daily-tx-statistics`, {
params,
});
getDataStatistic(startDate, endDate): Observable<any> {
const operationsDoc = `
query queryStatisticChart($startDate: timestamptz = null, $endDate: timestamptz = null) {
${this.envDB} {
daily_statistics(where: {date: {_gte: $startDate, _lte: $endDate}}, order_by: {date: asc}) {
daily_active_addresses
daily_txs
date
unique_addresses
}
}
}
`;
return this.http
.post<any>(this.graphUrl, {
query: operationsDoc,
variables: {
startDate: startDate,
endDate: endDate,
},
operationName: 'queryStatisticChart',
})
.pipe(map((res) => (res?.data ? res?.data[this.envDB] : null)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</a>
</li>
<li class="nav-item dropdown mx-5 mx-lg-4 mx-xl-8" *ngIf="i > 0">
<ng-container *ngIf="(item.name === 'More' && wallet) || item.name !== 'More'">
<ng-container >
<button
(click)="onMenuClick($event)"
class="button nav-link dropdown-toggle arrow-none d-flex align-items-center mb-0">
Expand All @@ -115,10 +115,6 @@
<span class="nav-link__panel nav-link__panel-more" *ngIf="menuLink.length > 0">
<ng-container *ngFor="let subMenu of item.subItems">
<a
*ngIf="
subMenu.label !== 'Account Bound Token' ||
(subMenu.label === 'Account Bound Token' && lengthSBT > 0 && isAllowInABTWhiteList)
"
[routerLink]="subMenu.link"
class="d-flex align-items-center mb-0 nav-link__item nav-link__sub-item py-0"
[class.active]="checkMenuActive(subMenu.link)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,13 @@ export class HorizontaltopbarComponent implements OnInit, AfterViewInit {
.subscribe((wallet) => {
if (wallet) {
this.currentAddress = this.walletService.wallet?.bech32Address;
this.checkWL();
} else {
this.currentAddress = null;
this.isAllowInABTWhiteList = false;
}
});
}

checkWL() {
this.soulboundService.getListWL().subscribe((res) => {
if (!res?.data?.find((k) => k.account_address === this.currentAddress)) {
this.isAllowInABTWhiteList = false;
}
});
}

checkEnv() {
this.env = this.environmentService.configValue.env;
this.innerWidth = window.innerWidth;
Expand Down
44 changes: 16 additions & 28 deletions src/app/layouts/horizontaltopbar/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ export const MENU: MenuItem[] = [
name: MenuName.ChartStats,
icon: 'line-segments',
},
// {
// id: 2,
// label: 'MENUITEMS.TOP-STATISTICS',
// link: '/statistics/top-statistic',
// name: MenuName.TopStatistics,
// icon: 'chart-line-up',
// },
{
id: 2,
label: 'MENUITEMS.TOP-STATISTICS',
link: '/statistics/top-statistic',
name: MenuName.TopStatistics,
icon: 'chart-line-up',
},
],
},
{
Expand All @@ -145,12 +145,6 @@ export const MENU: MenuItem[] = [
icon: 'list',
name: MenuName.More,
subItems: [
// {
// id: 2,
// label: 'Multi-send',
// link: '/fee',
// icon: 'users-three',
// },
{
id: 1,
label: 'Fee Grant',
Expand All @@ -159,7 +153,7 @@ export const MENU: MenuItem[] = [
},
{
id: 2,
label: 'Account Bound Token',
label: 'ABT Creator',
link: '/accountbound',
icon: 'medal',
},
Expand Down Expand Up @@ -267,13 +261,13 @@ export const MENU_MOB: MenuItem[] = [
name: MenuName.ChartStats,
icon: 'line-segments',
},
// {
// id: 4,
// label: 'MENUITEMS.TOP-STATISTICS',
// link: '/statistics/top-statistic',
// name: MenuName.TopStatistics,
// icon: 'chart-line-up',
// },
{
id: 4,
label: 'MENUITEMS.TOP-STATISTICS',
link: '/statistics/top-statistic',
name: MenuName.TopStatistics,
icon: 'chart-line-up',
},
],
},
{
Expand All @@ -282,12 +276,6 @@ export const MENU_MOB: MenuItem[] = [
icon: 'list',
name: MenuName.More,
subItems: [
// {
// id: 2,
// label: 'Multi-send',
// link: '/fee',
// icon: 'users-three',
// },
{
id: 1,
label: 'Fee Grant',
Expand All @@ -296,7 +284,7 @@ export const MENU_MOB: MenuItem[] = [
},
{
id: 2,
label: 'Account Bound Token',
label: 'ABT Creator',
link: '/accountbound',
icon: 'medal',
},
Expand Down
5 changes: 4 additions & 1 deletion src/app/layouts/layout.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@

<app-dialog></app-dialog>
<!-- button scroll to top -->
<button class="button-float {{pageYOffset > 0 ? 'show' : ''}}" [class.active]="scrolling" (click)="scrollToTop()"></button>
<button
class="button-float {{ pageYOffset > 0 ? 'show' : '' }}"
[class.active]="scrolling"
(click)="scrollToTop()"></button>
1 change: 0 additions & 1 deletion src/app/layouts/layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export class LayoutComponent implements OnInit {
}

ngAfterViewInit() {}

/**
* Check if the horizontal layout is requested
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
">
</ng-container>
</ng-container>
<ng-container *ngIf="item.name === menuName.More && wallet">
<ng-container *ngIf="item.name === menuName.More">
<ng-container
*ngTemplateOutlet="
btnDropdown;
Expand Down Expand Up @@ -134,10 +134,7 @@
<ul class="justify-content-around mb-0 p-0">
<ng-container *ngFor="let item of menu[4].subItems">
<ng-container
*ngIf="item.label !== 'Account Bound Token' || (item.label === 'Account Bound Token' && lengthSBT > 0 && isAllowInABTWhiteList)">
<ng-container
*ngTemplateOutlet="menuItem; context: { data: { link: item.link, icon: item.icon, label: item.label } }">
</ng-container>
*ngTemplateOutlet="menuItem; context: { data: { link: item.link, icon: item.icon, label: item.label } }">
</ng-container>
</ng-container>
</ul>
Expand Down
9 changes: 0 additions & 9 deletions src/app/layouts/menu-bottom-bar/menu-bottom-bar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export class MenuBottomBarComponent implements OnInit {
.subscribe((wallet) => {
if (wallet) {
this.currentAddress = this.walletService.wallet?.bech32Address;
this.checkWL();
} else {
this.currentAddress = null;
this.isAllowInABTWhiteList = false;
Expand Down Expand Up @@ -99,14 +98,6 @@ export class MenuBottomBarComponent implements OnInit {
}
}

checkWL() {
this.soulboundService.getListWL().subscribe((res) => {
if (!res?.data?.find((k) => k.account_address === this.currentAddress)) {
this.isAllowInABTWhiteList = false;
}
});
}

overLayClickEvent() {
this.overlayPanel = false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 class="mb-0 text--white">Account Bound Tokens ({{ assetSoulBound?.length || 0 }})</h2>
<h2 class="mb-0 text--white">ABT Creators ({{ assetSoulBound?.length || 0 }})</h2>
<div class="card mt-3">
<div class="card-body">
<div *ngIf="loading" class="m-auto mt-10">
Expand Down
21 changes: 17 additions & 4 deletions src/app/pages/fee-grant/fee-grant.component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<h1 class="text--white mb-lg-0">Fee Grant</h1>
<!-- Tabs -->
<ul
*ngIf="currentAddress"
ngbNav
#customNav="ngbNav"
[activeId]="!isGrantees ? 1 : 0"
class="aura-nav-tabs nav-tabs nav-tabs-custom mb-4 d-flex">
class="aura-nav-tabs nav-tabs nav-tabs-custom mt-4 mb-4 d-flex">
<ng-container *ngFor="let tab of TAB; index as index">
<li [ngbNavItem]="index" class="flex-shrink-0 flex-grow-1 flex-lg-shrink-1 flex-lg-grow-0 px-lg-4">
<a ngbNavLink (click)="changeType(tab.id === 0)" class="fw-semibold">
Expand All @@ -13,7 +15,18 @@
</ng-container>
</ul>
<!-- Main -->
<div class="mt-4 mt-lg-8">
<app-my-grantees *ngIf="isGrantees"></app-my-grantees>
<app-my-granters *ngIf="!isGrantees"></app-my-granters>
<div class="mt-4 mt-lg-8" *ngIf="currentAddress">
<ng-container>
<app-my-grantees *ngIf="isGrantees"></app-my-grantees>
<app-my-granters *ngIf="!isGrantees"></app-my-granters>
</ng-container>
</div>
<ng-container *ngIf="!currentAddress">
<div class="mt-lg-5 card">
<div class="card-body">
<div class="mt-4">
<app-table-no-data [textNull]="'Kindly connect wallet to experience feegrant functions'"></app-table-no-data>
</div>
</div>
</div>
</ng-container>
10 changes: 7 additions & 3 deletions src/app/pages/fee-grant/fee-grant.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { WalletService } from 'src/app/core/services/wallet.service';
})
export class FeeGrantComponent implements OnInit {
isGrantees = true;
currentAddress = null;
TAB = [
{
id: 0,
Expand All @@ -21,7 +22,7 @@ export class FeeGrantComponent implements OnInit {
value: 'My Granters',
},
];
constructor(public walletService: WalletService, private router: Router) {}
constructor(public walletService: WalletService, private router: Router,) {}

ngOnInit(): void {
from([1])
Expand All @@ -31,8 +32,11 @@ export class FeeGrantComponent implements OnInit {
)
.subscribe((wallet) => {
const urlPath = window.location.pathname.replace(/^\/([^\/]*).*$/, '$1');
if (!wallet && urlPath === 'fee-grant') {
this.router.navigate(['/']);
if (wallet) {
this.currentAddress = wallet.bech32Address;
}
else{
this.currentAddress = null;
}
});
}
Expand Down
Loading

0 comments on commit af22be0

Please sign in to comment.