Skip to content

Commit

Permalink
Merge pull request #1035 from adshares/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
m-pilarczyk authored Jul 25, 2023
2 parents 53d5478 + 9c5ee53 commit b083427
Show file tree
Hide file tree
Showing 70 changed files with 2,848 additions and 2,377 deletions.
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.6.0] - 2023-07-25
### Added
- Custom logos support in dark mode
- Missed views rate statistics for sites
- Filtering by added and accepted dates on banner classification page
### Changed
- Targeting custom option UX - remove unintuitive batch input
- Logo in banner preview
### Fixed
- Block buttons while campaign/site creation is in progress
- Fixing background of targeting select input
- Png icons replaced with svgs
- Classifier filtering and Targeting & exclusions text and backgrounds contrasting colors set
- Direct deal's condition
- Discarding status filter on banner classification page

## [2.5.0] - 2023-05-15
### Added
- Instructions for adding the ads.txt file entry
Expand Down Expand Up @@ -578,7 +594,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Publisher features (Sites & AdUnits)


[Unreleased]: https://github.com/adshares/adpanel/compare/v2.5.0...develop
[Unreleased]: https://github.com/adshares/adpanel/compare/v2.6.0...develop
[2.6.0]: https://github.com/adshares/adpanel/compare/v2.5.0...v2.6.0
[2.5.0]: https://github.com/adshares/adpanel/compare/v2.4.6...v2.5.0
[2.4.6]: https://github.com/adshares/adpanel/compare/v2.4.5...v2.4.6
[2.4.5]: https://github.com/adshares/adpanel/compare/v2.4.4...v2.4.5
Expand Down
1 change: 1 addition & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/logo.png",
"src/favicon.ico",
"src/favicon-16x16.png",
"src/favicon-32x32.png",
Expand Down
3 changes: 2 additions & 1 deletion deploy/reload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ then
if [[ -d ${BRAND_ASSETS_DIR} ]]
then
echo "Copying brand assets from ${BRAND_ASSETS_DIR}"
cp -fr "${BRAND_ASSETS_DIR}"/* $BUILD_DIRECTORY/
# sync all files exclude *simple*
rsync -r --exclude="*simple*" "${BRAND_ASSETS_DIR}"/* $BUILD_DIRECTORY/
else
echo "Brand assets directory ${BRAND_ASSETS_DIR} doesn't exist."
fi
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@types/node": "^12.12.6",
"@typescript-eslint/eslint-plugin": "5.27.1",
"@typescript-eslint/parser": "5.27.1",
"angular-http-server": "^1.11.1",
"eslint": "8.22.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-angular": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sonar.host.url=https://sonarcloud.io
sonar.organization=adshares-github
sonar.projectKey=adshares-adpanel
sonar.projectName=Adshares AdPanel
sonar.projectVersion=2.5
sonar.projectVersion=2.6

# =====================================================
# Meta-data for the project
Expand Down
2 changes: 1 addition & 1 deletion src/app/advertiser/dashboard/dashboard.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h2 class="ap-heading ap-heading--h2">List of all campaigns</h2>

<div *ngIf="!campaigns.length">
<div class="ap-box col align-center justify-center text-center create-new-campaign-wrapper">
<img src="/assets/images/advertiser-account-illustration.png" alt="Advertiser Account Illustration" />
<img class="svg-dark" src="/assets/images/advertiser-account-choose-icon.svg" alt="a loudspeaker" />
<div class="ap-customize__box-description">
<h2 class="ap-heading ap-heading--h2">Create your first campaign</h2>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,14 @@ <h2 class="ap-heading ap-heading--h2 box-title">Targeting</h2>
<div class="row row--gap8">
<button
*ngIf="createCampaignMode"
type="button"
(click)="saveCampaignTargetingAndCpm(true)"
class="ap-btn ap-btn--secondary"
data-test="advertiser-edit-campaign-save-as-draft">
[disabled]="changesSaved">
Save as draft
</button>
<button
(click)="onSubmit()"
class="ap-btn ap-btn--primary"
data-test="advertiser-edit-campaign-save-and-continue">
<span *ngIf="!changesSaved; else loading">{{ createCampaignMode ? 'Save & continue' : 'Update' }}</span>
<ng-template #loading>
<mat-spinner [diameter]="20" [strokeWidth]="2" color="accent"></mat-spinner>
</ng-template>
<button type="button" (click)="onSubmit()" class="ap-btn ap-btn--primary" [disabled]="changesSaved">
{{ createCampaignMode ? 'Save & continue' : 'Update' }}
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { FormControl, FormGroup } from '@angular/forms';
import { filter, first, take } from 'rxjs/operators';
import { Store } from '@ngrx/store';
import {
ADD_CAMPAIGN_TO_CAMPAIGNS_FAILURE,
AddCampaignToCampaigns,
ClearLastEditedCampaign,
SaveCampaignBasicInformation,
SaveCampaignTargeting,
UPDATE_CAMPAIGN_FAILURE,
UpdateCampaign,
} from 'store/advertiser/advertiser.actions';
import { AppState } from 'models/app-state.model';
Expand All @@ -20,6 +22,7 @@ import { processTargeting } from 'common/components/targeting/targeting.helpers'
import { HandleSubscriptionComponent } from 'common/handle-subscription.component';
import { CustomValidators } from 'common/utilities/forms';
import { ServerOptionsService } from 'common/server-options.service';
import { Actions, ofType } from '@ngrx/effects';

@Component({
selector: 'app-edit-campaign-additional-targeting',
Expand Down Expand Up @@ -49,7 +52,8 @@ export class EditCampaignAdditionalTargetingComponent extends HandleSubscription
private router: Router,
private advertiserService: AdvertiserService,
private serverOptionsService: ServerOptionsService,
private assetHelpers: AssetHelpersService
private assetHelpers: AssetHelpersService,
private actions$: Actions
) {
super();
}
Expand Down Expand Up @@ -88,9 +92,17 @@ export class EditCampaignAdditionalTargetingComponent extends HandleSubscription
this.submitted = false;

this.createCampaignMode ? this.saveCampaignTargetingAndCpm(false) : this.updateTargetingAndCpm();

const errorSubscription = this.actions$
.pipe(ofType(ADD_CAMPAIGN_TO_CAMPAIGNS_FAILURE, UPDATE_CAMPAIGN_FAILURE), first())
.subscribe(() => {
this.changesSaved = false;
});
this.subscriptions.push(errorSubscription);
}

updateTargetingAndCpm(): void {
this.changesSaved = true;
const targeting = {
requires: this.addedItems,
excludes: this.excludedItems,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,15 @@ <h1 class="ap-heading ap-heading--h2 box-title">Basic information</h1>

<div class="ap-box">
<div class="box-content row justify-between">
<button
type="button"
class="ap-btn ap-btn--secondary"
(click)="onStepBack()"
[disabled]="campaignBasicInformationSubmitted || changesSaved"
data-test="advertiser-navigate-to-dashboard">
<button type="button" class="ap-btn ap-btn--secondary" (click)="onStepBack()" [disabled]="changesSaved">
{{ createCampaignMode ? 'Back to dashboard' : 'Back' }}
</button>
<button
type="button"
(click)="onSubmit()"
*ngIf="isTaxonomy"
class="ap-btn ap-btn--primary"
data-test="advertiser-edit-campaign-save-and-continue">
[disabled]="changesSaved">
<span *ngIf="!changesSaved; else loading">
{{ createCampaignMode ? 'Save & continue' : 'Update' }}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import { Campaign, CampaignBasicInformation, CampaignsConfig } from 'models/camp
import { campaignInitialState } from 'models/initial-state/campaign';
import { campaignStatusesEnum } from 'models/enum/campaign.enum';
import { Entry } from 'models/targeting-option.model';
import { LoadCampaignsConfig, SaveCampaignBasicInformation, UpdateCampaign } from 'store/advertiser/advertiser.actions';
import {
LoadCampaignsConfig,
SaveCampaignBasicInformation,
UpdateCampaign,
UPDATE_CAMPAIGN_FAILURE,
} from 'store/advertiser/advertiser.actions';

import * as moment from 'moment';
import { appSettings } from 'app-settings';
Expand All @@ -27,6 +32,7 @@ import { HandleSubscriptionComponent } from 'common/handle-subscription.componen
import { CustomValidators } from 'common/utilities/forms';
import { ServerOptionsService } from 'common/server-options.service';
import { faCalendar } from '@fortawesome/free-regular-svg-icons';
import { Actions, ofType } from '@ngrx/effects';

@Component({
selector: 'app-edit-campaign-basic-information',
Expand Down Expand Up @@ -59,7 +65,8 @@ export class EditCampaignBasicInformationComponent extends HandleSubscriptionCom
private route: ActivatedRoute,
private store: Store<AppState>,
private advertiserService: AdvertiserService,
private serverOptionsService: ServerOptionsService
private serverOptionsService: ServerOptionsService,
private actions$: Actions
) {
super();
}
Expand Down Expand Up @@ -151,6 +158,11 @@ export class EditCampaignBasicInformationComponent extends HandleSubscriptionCom
};

this.store.dispatch(new UpdateCampaign(this.campaign));

const errorSubscription = this.actions$.pipe(ofType(UPDATE_CAMPAIGN_FAILURE)).subscribe(() => {
this.changesSaved = false;
});
this.subscriptions.push(errorSubscription);
}

createForm() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ <h1 class="ap-heading ap-heading--h2">Upload ads</h1>
[uploader]="uploader"
onclick="document.getElementById('fileSelect').click()"
data-test="advertiser-edit-campaign-create-ads-form-drag-and-drop-wrapper">
<img src="/assets/images/campaign-ad-illustration.png" alt="" />
<img class="svg-dark" src="/assets/images/campaign-ad-icon.svg" alt="a desktop with an ad" />
<div>
<p class="ap-copy ap-copy--semi">
Drag & Drop or Browse
Expand Down Expand Up @@ -306,12 +306,7 @@ <h1 class="ap-heading ap-heading--h2">Upload ads</h1>
</div>

<div class="row justify-end">
<button
class="ap-btn ap-btn--secondary ap-btn-error"
(click)="removeNewAd(i)"
data-test="advertiser-edit-campaign-create-ads-form-remove-ad">
Delete placements
</button>
<button class="ap-btn ap-btn--secondary ap-btn-error" (click)="removeNewAd(i)">Delete ad</button>
</div>
</div>
</mat-expansion-panel>
Expand Down Expand Up @@ -341,22 +336,15 @@ <h1 class="ap-heading ap-heading--h2">Upload ads</h1>

<div class="row row--gap8">
<button
type="button"
*ngIf="!isEditMode"
(click)="onSubmit(true)"
class="ap-btn ap-btn--secondary"
data-test="advertiser-edit-campaign-save-as-draft">
[disabled]="changesSaved">
Save as draft
</button>
<button
class="ap-btn ap-btn--primary"
(click)="onSubmit()"
data-test="advertiser-edit-campaign-save-and-continue">
<span *ngIf="!changesSaved; else loading">
{{ isEditMode ? 'Update' : 'Save & continue' }}
</span>
<ng-template #loading>
<mat-spinner [diameter]="20" [strokeWidth]="2" color="accent"></mat-spinner>
</ng-template>
<button type="button" class="ap-btn ap-btn--primary" (click)="onSubmit()" [disabled]="changesSaved">
{{ isEditMode ? 'Update' : 'Save & continue' }}
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { MatDialog } from '@angular/material/dialog';
import { first, take } from 'rxjs/operators';
import { FileUploader } from 'ng2-file-upload';
import {
ADD_CAMPAIGN_TO_CAMPAIGNS_FAILURE,
AddCampaignToCampaigns,
ClearLastEditedCampaign,
SaveCampaignAds,
UPDATE_CAMPAIGN_FAILURE,
UpdateCampaign,
} from 'store/advertiser/advertiser.actions';
import { AdvertiserService } from 'advertiser/advertiser.service';
Expand All @@ -28,6 +30,7 @@ import { SessionService } from '../../../session.service';
import { ShowDialogOnError } from 'store/common/common.actions';
import { faPlus } from '@fortawesome/free-solid-svg-icons';
import { faCircleXmark } from '@fortawesome/free-regular-svg-icons';
import { Actions, ofType } from '@ngrx/effects';

interface UploadingFile {
name: string;
Expand Down Expand Up @@ -87,7 +90,8 @@ export class EditCampaignCreateAdsComponent extends HandleSubscriptionComponent
private router: Router,
private store: Store<AppState>,
private session: SessionService,
private matDialog: MatDialog
private matDialog: MatDialog,
private actions$: Actions
) {
super();
}
Expand Down Expand Up @@ -461,6 +465,13 @@ export class EditCampaignCreateAdsComponent extends HandleSubscriptionComponent
this.isEditMode
? this.store.dispatch(new UpdateCampaign(this.campaign))
: this.saveCampaignAds(this.campaign, isDraft);

const errorSubscription = this.actions$
.pipe(ofType(ADD_CAMPAIGN_TO_CAMPAIGNS_FAILURE, UPDATE_CAMPAIGN_FAILURE), first())
.subscribe(() => {
this.changesSaved = false;
});
this.subscriptions.push(errorSubscription);
} else {
this.changesSaved = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,10 @@ <h2 class="ap-heading ap-heading--h2">3. Ads</h2>
<button routerLink="../create-ad" class="ap-btn ap-btn--secondary">Back</button>

<div class="row row--gap8">
<button
class="ap-btn ap-btn--secondary"
(click)="saveCampaign(true)"
data-test="advertiser-edit-campaign-save-as-draft">
<button class="ap-btn ap-btn--secondary" (click)="saveCampaign(true)" [disabled]="changesSaved">
Save as draft
</button>
<button
class="ap-btn ap-btn--primary"
(click)="saveCampaign(false)"
data-test="advertiser-edit-campaign-start-campaign">
<button class="ap-btn ap-btn--primary" (click)="saveCampaign(false)" [disabled]="changesSaved">
Start campaign
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ import { AdvertiserService } from 'advertiser/advertiser.service';
import { AssetHelpersService } from 'common/asset-helpers.service';
import { processTargeting } from 'common/components/targeting/targeting.helpers';
import { adStatusesEnum } from 'models/enum/ad.enum';
import { AddCampaignToCampaigns } from 'store/advertiser/advertiser.actions';
import { AddCampaignToCampaigns, ADD_CAMPAIGN_TO_CAMPAIGNS_FAILURE } from 'store/advertiser/advertiser.actions';
import { HandleSubscriptionComponent } from 'common/handle-subscription.component';
import { TargetingOption } from 'models/targeting-option.model';
import { cloneDeep } from 'common/utilities/helpers';
import { faEdit } from '@fortawesome/free-solid-svg-icons';
import { faCalendar } from '@fortawesome/free-regular-svg-icons';
import { Actions, ofType } from '@ngrx/effects';

@Component({
selector: 'app-edit-campaign-summary',
Expand All @@ -29,11 +30,13 @@ export class EditCampaignSummaryComponent extends HandleSubscriptionComponent im
faEdit = faEdit;
faCalendar = faCalendar;
CONVERSIONS_DESCRIPTION = CONVERSIONS_DESCRIPTION;
changesSaved: boolean = false;

constructor(
private store: Store<AppState>,
private advertiserService: AdvertiserService,
private assetHelpers: AssetHelpersService
private assetHelpers: AssetHelpersService,
private readonly actions$: Actions
) {
super();
}
Expand All @@ -58,6 +61,7 @@ export class EditCampaignSummaryComponent extends HandleSubscriptionComponent im
}

saveCampaign(isDraft): void {
this.changesSaved = true;
if (!isDraft) {
this.campaign = {
...this.campaign,
Expand All @@ -74,5 +78,9 @@ export class EditCampaignSummaryComponent extends HandleSubscriptionComponent im
};
}
this.store.dispatch(new AddCampaignToCampaigns(this.campaign));
const errorSubscription = this.actions$.pipe(ofType(ADD_CAMPAIGN_TO_CAMPAIGNS_FAILURE)).subscribe(() => {
this.changesSaved = false;
});
this.subscriptions.push(errorSubscription);
}
}
4 changes: 3 additions & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<ng-template #loading>
<div class="loader-wrapper">
<div class="col align-center loader">
<img class="ap-logo" src="assets/images/logo.png" [alt]="name" />
<img class="ap-logo" src="/logo.png" [alt]="name" />
<img class="ap-logo-dark-mode" src="/logo-dark-mode.png" [alt]="name" (error)="onLogoError($event)" />

<div class="loading-wrapper">
<mat-spinner [diameter]="60" [strokeWidth]="8"></mat-spinner>
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,8 @@ export class AppComponent extends HandleSubscriptionComponent implements OnInit
isOauth(): boolean {
return undefined !== this.route.snapshot.queryParams.redirect_uri;
}

onLogoError(event) {
event.target.src = '/logo.png';
}
}
Loading

0 comments on commit b083427

Please sign in to comment.