Skip to content

Commit

Permalink
Merge pull request #1042 from adshares/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
m-pilarczyk authored Dec 6, 2023
2 parents 10e28d6 + 1998124 commit b284977
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 38 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]

## [2.6.2] - 2023-12-06
### Changed
- Selecting site's placement step depends on taxonomy

## [2.6.1] - 2023-08-07
### Added
- Direct deals for publisher
Expand Down Expand Up @@ -598,7 +602,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.6.1...develop
[Unreleased]: https://github.com/adshares/adpanel/compare/v2.6.2...develop
[2.6.2]: https://github.com/adshares/adpanel/compare/v2.6.1...v2.6.2
[2.6.1]: https://github.com/adshares/adpanel/compare/v2.6.0...v2.6.1
[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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adpanel",
"version": "2.5.0",
"version": "2.6.2",
"scripts": {
"ng": "ng",
"start": "ng serve adshares",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ <h3 class="ap-heading ap-heading--h3">Exclusions:</h3>
</ng-container>
</div>

<!--Campaign list section-->
<!--Ads section-->

<div class="col ap-box">
<div class="row justify-between box-title">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<app-edit-site-navigation [currentStep]="4" [medium]="site.medium"></app-edit-site-navigation>
<app-edit-site-navigation
[currentStep]="4"
[medium]="site.medium"
[showPlacements]="showPlacements"></app-edit-site-navigation>
<section class="homepage-view site-edit-additional-targeting container">
<div class="ap-box">
<h1 class="ap-heading ap-heading--h2 box-title">Classification</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {
import { AppState } from 'models/app-state.model';
import { TargetingOption, TargetingOptionValue } from 'models/targeting-option.model';
import { cloneDeep } from 'common/utilities/helpers';
import { PublisherService } from 'publisher/publisher.service';
import { AssetHelpersService } from 'common/asset-helpers.service';
import { Site } from 'models/site.model';
import { parseTargetingForBackend } from 'common/components/targeting/targeting.helpers';
import { HandleSubscriptionComponent } from 'common/handle-subscription.component';
import { siteStatusEnum } from 'models/enum/site.enum';
import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons';
import { Actions, ofType } from '@ngrx/effects';
import { adUnitTypesEnum } from 'models/enum/ad.enum'

@Component({
selector: 'app-edit-site-additional-targeting',
Expand All @@ -43,12 +43,12 @@ export class EditSiteAdditionalTargetingComponent extends HandleSubscriptionComp
isCheckedOnlyAcceptedBanners: boolean;
isCheckedOnlyDirectDeals: boolean;
faQuestionCircle = faQuestionCircle;
showPlacements: boolean;

constructor(
private route: ActivatedRoute,
private store: Store<AppState>,
private router: Router,
private publisherService: PublisherService,
private assetHelpers: AssetHelpersService,
private actions$: Actions
) {
Expand All @@ -57,6 +57,9 @@ export class EditSiteAdditionalTargetingComponent extends HandleSubscriptionComp

ngOnInit(): void {
this.createSiteMode = !!this.router.url.match('/create-site/');
this.showPlacements = this.route.parent.snapshot.data.adUnitSizes.some(
adUnit => adUnit.type === adUnitTypesEnum.DISPLAY
);
this.targetingOptionsToAdd = cloneDeep(this.route.parent.snapshot.data.filteringOptions);
this.targetingOptionsToExclude = cloneDeep(this.route.parent.snapshot.data.filteringOptions);
this.getSiteFromStore();
Expand Down Expand Up @@ -85,7 +88,10 @@ export class EditSiteAdditionalTargetingComponent extends HandleSubscriptionComp
}

private getPreviousPath(): string {
return this.site.medium !== 'metaverse' ? 'create-ad-units' : 'basic-information';
if ('metaverse' === this.site.medium) {
return 'basic-information';
}
return this.showPlacements ? 'create-ad-units' : 'pops-settings';
}

get siteToSave(): Site {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<app-edit-site-navigation [currentStep]="1" [medium]="medium"></app-edit-site-navigation>
<app-edit-site-navigation
[currentStep]="1"
[medium]="medium"
[showPlacements]="showPlacements"></app-edit-site-navigation>
<section class="homepage-view site-edit-basic-information container">
<form [formGroup]="siteBasicInfoForm" class="ap-form" data-test="publisher-edit-site-basic-information-form">
<div class="ap-box site-edit-basic-information__info-box">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { User } from 'models/user.model';
import { PublisherService } from 'publisher/publisher.service';
import { ErrorResponseDialogComponent } from 'common/dialog/error-response-dialog/error-response-dialog.component';
import { HandleSubscriptionComponent } from 'common/handle-subscription.component';
import { SessionService } from '../../../session.service';
import { adUnitTypesEnum } from 'models/enum/ad.enum'

@Component({
selector: 'app-edit-site-basic-information',
Expand Down Expand Up @@ -58,13 +58,13 @@ export class EditSiteBasicInformationComponent extends HandleSubscriptionCompone
medium: string;
vendor: string;
isConnectedWallet: boolean = false;
showPlacements: boolean;

constructor(
private action$: Actions,
private router: Router,
private route: ActivatedRoute,
private publisherService: PublisherService,
private session: SessionService,
private store: Store<AppState>,
private dialog: MatDialog
) {
Expand All @@ -79,6 +79,9 @@ export class EditSiteBasicInformationComponent extends HandleSubscriptionCompone
});
this.subscriptions.push(updateSiteFailureSubscription);
this.createSiteMode = !!this.router.url.match('/create-site/');
this.showPlacements = this.route.parent.snapshot.data.adUnitSizes.some(
adUnit => adUnit.type === adUnitTypesEnum.DISPLAY
);
if (this.createSiteMode && this.media.length > 0) {
this.onMediumChange(this.media[0].key);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<app-edit-site-navigation [currentStep]="3" [medium]="site.medium"></app-edit-site-navigation>
<app-edit-site-navigation
[currentStep]="3"
[medium]="site.medium"
[showPlacements]="showPlacements"></app-edit-site-navigation>
<section class="homepage-view site-edit-create-posters-units container">
<div class="ap-box">
<div class="box-title">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ActivatedRoute, Router } from '@angular/router';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { Store } from '@ngrx/store';

import { PublisherService } from 'publisher/publisher.service';
import { AssetHelpersService } from 'common/asset-helpers.service';
import { cloneDeep } from 'common/utilities/helpers';
import { AdUnit, AdUnitMetaData, Site } from 'models/site.model';
Expand Down Expand Up @@ -44,9 +43,9 @@ export class EditSiteCreateAdUnitsComponent extends HandleSubscriptionComponent
faCheck = faCheck;
faTimes = faTimes;
faTrash = faTrash;
showPlacements: boolean;

constructor(
private publisherService: PublisherService,
private assetHelpers: AssetHelpersService,
private router: Router,
private route: ActivatedRoute,
Expand All @@ -58,7 +57,10 @@ export class EditSiteCreateAdUnitsComponent extends HandleSubscriptionComponent

ngOnInit(): void {
this.createSiteMode = !!this.router.url.match('/create-site/');
this.adUnitSizes = cloneDeep(this.route.snapshot.data.adUnitSizes).filter(
this.showPlacements = this.route.parent.snapshot.data.adUnitSizes.some(
adUnit => adUnit.type === adUnitTypesEnum.DISPLAY
);
this.adUnitSizes = cloneDeep(this.route.parent.snapshot.data.adUnitSizes).filter(
item => item.type === adUnitTypesEnum.DISPLAY
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ export class EditSiteNavigationComponent implements OnChanges {

@Input() currentStep: number;
@Input() medium: string;
@Input() showPlacements: boolean = false;

ngOnChanges(_changes: SimpleChanges): void {
if (this.medium !== 'metaverse') {
this.steps = [
{ id: 1, name: 'Basic information' },
{ id: 2, name: 'Pops' },
{ id: 3, name: 'Placements' },
...(this.showPlacements ? [{ id: 3, name: 'Placements' }] : []),
{ id: 4, name: 'Exclusions' },
{ id: 5, name: 'Summary' },
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<app-edit-site-navigation [currentStep]="2" [medium]="site.medium"></app-edit-site-navigation>
<app-edit-site-navigation
[currentStep]="2"
[medium]="site.medium"
[showPlacements]="showPlacements"></app-edit-site-navigation>
<section class="homepage-view site-edit-pops-settings site-edit-create-posters-units container">
<form [formGroup]="popsSettingsForm" class="ap-form" data-test="publisher-edit-site-pops-settings-form">
<div class="ap-box site-edit-pops-settings__info-box">
Expand Down Expand Up @@ -42,6 +45,9 @@ <h1 class="ap-heading ap-heading--h2">Pops settings</h1>
</div>
<div *ngIf="0 === adUnitSizes.length" class="ap-copy">Pops are not available for current medium</div>
</div>
<span *ngIf="this.popsSettingsForm.errors?.noAdUnitSelected" class="error-msg">
At least one must be selected
</span>
</div>

<div class="ap-box ap-box--large row justify-between">
Expand All @@ -52,10 +58,14 @@ <h1 class="ap-heading ap-heading--h2">Pops settings</h1>
(click)="saveAdUnits(true)"
type="button"
class="ap-btn ap-btn--secondary"
[disabled]="changesSaved">
[disabled]="!this.popsSettingsForm.valid || changesSaved">
Save as draft
</button>
<button type="submit" class="ap-btn ap-btn--primary" [disabled]="changesSaved" (click)="onSubmit()">
<button
type="submit"
class="ap-btn ap-btn--primary"
[disabled]="!this.popsSettingsForm.valid || changesSaved"
(click)="onSubmit()">
{{ createSiteMode ? 'Save & continue' : 'Update' }}
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ActivatedRoute, Router } from '@angular/router';
import { FormControl, FormGroup } from '@angular/forms';
import { Store } from '@ngrx/store';

import { PublisherService } from 'publisher/publisher.service';
import { cloneDeep } from 'common/utilities/helpers';
import { AdUnit, AdUnitMetaData, Site } from 'models/site.model';
import { AppState } from 'models/app-state.model';
Expand All @@ -17,7 +16,6 @@ import {
UpdateSiteUnits,
} from 'store/publisher/publisher.actions';
import { faCheck, faTimes } from '@fortawesome/free-solid-svg-icons';
import { AssetHelpersService } from 'common/asset-helpers.service';
import { adUnitStatusesEnum, adUnitTypesEnum } from 'models/enum/ad.enum';
import { siteStatusEnum } from 'models/enum/site.enum';
import { Actions, ofType } from '@ngrx/effects';
Expand All @@ -35,10 +33,9 @@ export class EditSitePopsSettingsComponent extends HandleSubscriptionComponent i
createSiteMode: boolean;
changesSaved: boolean = false;
site: Site;
showPlacements: boolean;

constructor(
private publisherService: PublisherService,
private assetHelpers: AssetHelpersService,
private router: Router,
private route: ActivatedRoute,
private store: Store<AppState>,
Expand All @@ -49,8 +46,11 @@ export class EditSitePopsSettingsComponent extends HandleSubscriptionComponent i

ngOnInit(): void {
this.createSiteMode = !!this.router.url.match('/create-site/');
this.adUnitSizes = cloneDeep(this.route.snapshot.data.adUnitSizes).filter(
item => item.type === adUnitTypesEnum.POP
this.showPlacements = this.route.parent.snapshot.data.adUnitSizes.some(
adUnit => adUnit.type === adUnitTypesEnum.DISPLAY
);
this.adUnitSizes = cloneDeep(this.route.parent.snapshot.data.adUnitSizes).filter(
item => item.type === adUnitTypesEnum.POP && item.size.startsWith('pop-')
);

this.createForm();
Expand All @@ -76,7 +76,15 @@ export class EditSitePopsSettingsComponent extends HandleSubscriptionComponent i
});
});

this.popsSettingsForm = new FormGroup(controls);
this.popsSettingsForm = new FormGroup(controls, [
(formGroup: FormGroup) => {
if (this.showPlacements) {
return null;
}
const anySelected = Object.values(formGroup.value).some((value: any) => value.selected);
return anySelected ? null : { noAdUnitSelected: true };
},
]);
}

selectAdUnit(size: string): void {
Expand Down Expand Up @@ -112,7 +120,11 @@ export class EditSitePopsSettingsComponent extends HandleSubscriptionComponent i
});
this.subscriptions.push(errorSubscription);
} else {
this.router.navigate(['/publisher', 'create-site', 'create-ad-units']);
this.router.navigate([
'/publisher',
'create-site',
this.showPlacements ? 'create-ad-units' : 'additional-filtering',
]);
}
}

Expand All @@ -129,6 +141,9 @@ export class EditSitePopsSettingsComponent extends HandleSubscriptionComponent i
this.subscriptions.push(errorSubscription);
}

get isFormValid(): boolean {
return !this.showPlacements && this.popsSettingsForm.valid;
}
get adUnitsToSave(): AdUnit[] {
const units = [
...this.site.adUnits.filter(adUnit => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<app-edit-site-navigation [currentStep]="5" [medium]="site.medium"></app-edit-site-navigation>
<app-edit-site-navigation
[currentStep]="5"
[medium]="site.medium"
[showPlacements]="showPlacements"></app-edit-site-navigation>
<section class="homepage-view site-edit-summary container">
<div class="ap-box">
<div class="box-title">
Expand Down Expand Up @@ -114,7 +117,7 @@ <h3 class="ap-heading ap-heading--h3">3. Pops</h3>
</div>
</div>

<div class="ap-box site-edit-summary__poster-info">
<div *ngIf="showPlacements" class="ap-box site-edit-summary__poster-info">
<div class="row align-center justify-between box-title">
<h3 class="ap-heading ap-heading--h3">4. Placements</h3>
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { ActivatedRoute, Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';

import { AppState } from 'models/app-state.model';
import { AdUnit, Site } from 'models/site.model';
import { siteStatusEnum } from 'models/enum/site.enum';
import { PUBLISHER_INSTRUCTION_LINK } from 'models/enum/link.enum';
import { PublisherService } from 'publisher/publisher.service';
import { AssetHelpersService } from 'common/asset-helpers.service';
import { ADD_SITE_TO_SITES_FAILURE, AddSiteToSites } from 'store/publisher/publisher.actions';
import { HandleSubscriptionComponent } from 'common/handle-subscription.component';
Expand All @@ -27,19 +26,21 @@ export class EditSiteSummaryComponent extends HandleSubscriptionComponent implem
changeSaved: boolean = false;
displayAds: boolean;
PUBLISHER_INSTRUCTION_LINK = PUBLISHER_INSTRUCTION_LINK;
showPlacements: boolean;

constructor(
private store: Store<AppState>,
private publisherService: PublisherService,
private assetHelpers: AssetHelpersService,
private router: Router,
private route: ActivatedRoute,
private actions: Actions
) {
super();
}

ngOnInit() {
this.showPlacements = this.route.parent.snapshot.data.adUnitSizes.some(
adUnit => adUnit.type === adUnitTypesEnum.DISPLAY
);
const lastSiteSubscription = this.store
.select('state', 'publisher', 'lastEditedSite')
.pipe(first())
Expand Down
Loading

0 comments on commit b284977

Please sign in to comment.