Skip to content

Commit

Permalink
All currency codes and symbols should be environment based (#637)
Browse files Browse the repository at this point in the history
* PAN-382: Adjust targeting helpers for custom values and corner cases
- add todo containing task id for future improvement

* PAN-382: remove comment

* Format chart values according to env values

* Whole app should be based on env currencies

* Format chart values according to environment values

Whole app should be based on env currencies

* Changelog
  • Loading branch information
Meskat authored and PawZar committed Apr 25, 2019
1 parent f89c612 commit 6349371
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 26 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.6.6] - 2019-04-25
### Added
- Values in custom currencies

## [0.6.4] - 2019-04-24
### Added
- Custom currency support
Expand Down Expand Up @@ -70,7 +74,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Advertiser features (Campaigns & Ads)
- Publisher features (Sites & AdUnits)

[Unreleased]: https://github.com/adshares/adserver/compare/v0.6.4...develop
[Unreleased]: https://github.com/adshares/adserver/compare/v0.6.6...develop
[0.6.6]: https://github.com/adshares/adserver/compare/v0.6.4...v0.6.6
[0.6.4]: https://github.com/adshares/adserver/compare/v0.6.1...v0.6.4
[0.6.1]: https://github.com/adshares/adserver/compare/v0.6.0...v0.6.1
[0.6.0]: https://github.com/adshares/adserver/compare/v0.5.4...v0.6.0
Expand Down
4 changes: 2 additions & 2 deletions src/app/admin/finances/finances-settings.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h1 class="dwmth-heading dwmth-heading--primary finances-settings__header">Cold
[type]="'number'"
[step]="10"
[value]="settings.hotwalletMinValue"
[format]="'ADS'"
[format]="cryptoCode"
helper="Set a minimum amount required to run operations. In case the amount drops below the
specified threshold, you will be notified via e-mail"
(valueChanged)="updateSettings($event, 'hotwalletMinValue')"
Expand All @@ -63,7 +63,7 @@ <h1 class="dwmth-heading dwmth-heading--primary finances-settings__header">Cold
[type]="'number'"
[step]="10"
[value]="settings.hotwalletMaxValue"
[format]="'ADS'"
[format]="cryptoCode"
helper="Set a maximum amount that can be stored on a hot wallet. All funds exceeding this amount
will be automatically transferred to your cold wallet."
(valueChanged)="updateSettings($event, 'hotwalletMaxValue')"
Expand Down
2 changes: 2 additions & 0 deletions src/app/admin/finances/finances-settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AppState } from 'models/app-state.model';
import { HandleSubscription } from 'common/handle-subscription';
import { SetAdminSettings, SetAdminSettingsFailure } from "store/admin/admin.actions";
import { AdminSettings } from "models/settings.model";
import { environment } from "environments/environment";

@Component({
selector: 'app-finances-settings',
Expand All @@ -12,6 +13,7 @@ import { AdminSettings } from "models/settings.model";
host: {'class': 'app-finances'},
})
export class FinancesSettingsComponent extends HandleSubscription implements OnInit {
cryptoCode:string = environment.cryptoCode;
settings: AdminSettings;
canSubmit: boolean = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
for="campaign-max-cpc"
class="dwmth-form-label"
>
Max CPC (USD)
Max CPC ({{currencyCode}})
</label>
<input
id="campaign-max-cpc"
Expand Down Expand Up @@ -155,7 +155,7 @@
for="campaign-max-cpm"
class="dwmth-form-label"
>
Max CPM (USD)
Max CPM ({{currencyCode}})
</label>
<input
id="campaign-max-cpm"
Expand Down Expand Up @@ -210,7 +210,7 @@
for="campaign-budget-per-day"
class="dwmth-form-label"
>
Budget (USD / day)
Budget ({{currencyCode}} / day)
</label>
<input
id="campaign-budget-per-day"
Expand Down Expand Up @@ -263,7 +263,7 @@
for="campaign-budget"
class="dwmth-form-label"
>
Budget (USD / hour)
Budget ({{currencyCode}} / hour)
</label>
<input
id="campaign-budget"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ import {appSettings} from 'app-settings';
import {adsToClicks, calcCampaignBudgetPerDay, calcCampaignBudgetPerHour, formatMoney} from 'common/utilities/helpers';
import {AdvertiserService} from "advertiser/advertiser.service";
import { HandleSubscription } from "common/handle-subscription";
import { environment } from "environments/environment";

@Component({
selector: 'app-edit-campaign-basic-information',
templateUrl: './edit-campaign-basic-information.component.html',
styleUrls: ['./edit-campaign-basic-information.component.scss']
})
export class EditCampaignBasicInformationComponent extends HandleSubscription implements OnInit, OnDestroy {
currencyCode: string = environment.currencyCode;
campaignBasicInfoForm: FormGroup;
campaignBasicInformationSubmitted = false;
budgetPerDay: FormControl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { enumToObject, formatMoney } from "common/utilities/helpers";
import { advChartSeriesEnum, pubChartSeriesEnum } from "models/enum/chart.enum";
import { ChartComponent } from "common/components/chart/chart.component";
import { environment } from "environments/environment";

export const adjustLabelFormat = (value, values) => {
const daysSpan = moment(values[values.length - 1]).diff(moment(values[0]), 'days');
Expand Down Expand Up @@ -41,7 +42,7 @@ export const adjustTooltipValueFormat = (value: string): string => {
case options.RPM:
case options.RPC:
const val = parseInt(value);
return `${type}: ${val > 0 ? formatMoney(val, 4) : 0} USD`;
return `${type}: ${val > 0 ? formatMoney(val, 4) : 0} ${environment.currencyCode}`;
default:
return `${type}: ${value}`;
}
Expand All @@ -60,7 +61,7 @@ export const adjustYAxesTics = (value) => {
case options.RPM:
case options.RPC:
const val = parseInt(value);
return `$${val > 0 ? formatMoney(val,4) : 0}`;
return `${environment.currencySymbol}${val > 0 ? formatMoney(val,4) : 0}`;
default:
return `${value}`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
for="amount"
class="dwmth-form-label"
>
Withdraw Amount (ADS)
Withdraw Amount ({{cryptoCode}})
</label>
<input
id="amount"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import {Component, OnInit} from '@angular/core';
import {Store} from '@ngrx/store';
import {MatDialog, MatDialogRef} from '@angular/material';
import {FormControl, FormGroup, Validators} from '@angular/forms';
import {HttpErrorResponse} from "@angular/common/http";

import {HandleSubscription} from 'common/handle-subscription';
import {SettingsService} from 'settings/settings.service';
import {AppState } from 'models/app-state.model';
import {User, UserAdserverWallet} from 'models/user.model';

import {adsToClicks, formatMoney} from 'common/utilities/helpers';
import {appSettings} from 'app-settings';
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { MatDialog, MatDialogRef } from '@angular/material';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { HttpErrorResponse } from "@angular/common/http";

import { HandleSubscription } from 'common/handle-subscription';
import { SettingsService } from 'settings/settings.service';
import { AppState } from 'models/app-state.model';
import { User, UserAdserverWallet } from 'models/user.model';

import { adsToClicks, formatMoney } from 'common/utilities/helpers';
import { appSettings } from 'app-settings';
import { CalculateWithdrawalItem } from "models/settings.model";
import * as codes from 'common/utilities/codes';
import {ErrorResponseDialogComponent} from "common/dialog/error-response-dialog/error-response-dialog.component";
import { ErrorResponseDialogComponent } from "common/dialog/error-response-dialog/error-response-dialog.component";
import { GetBillingHistory } from "store/settings/settings.actions";
import { environment } from "environments/environment";

@Component({
selector: 'app-withdraw-funds-dialog',
templateUrl: './withdraw-funds-dialog.component.html',
styleUrls: ['./withdraw-funds-dialog.component.scss']
})
export class WithdrawFundsDialogComponent extends HandleSubscription implements OnInit {
cryptoCode: string = environment.cryptoCode;
withdrawFundsForm: FormGroup;

adserverWallet: UserAdserverWallet;

memoInputActive = false;
isFormBeingSubmitted = false;
withdrawFormSubmitted = false;
Expand Down

0 comments on commit 6349371

Please sign in to comment.