Skip to content

Commit

Permalink
Add access modifiers to properties and methods in components where th…
Browse files Browse the repository at this point in the history
…ey have not been added before, deleted redundant empty line, fixes some attribute typos, refactored imports
  • Loading branch information
Ultrafiolet4 committed Sep 18, 2023
1 parent 48b8e4a commit 60f7440
Show file tree
Hide file tree
Showing 38 changed files with 372 additions and 369 deletions.
24 changes: 12 additions & 12 deletions src/app/shared/components/category-card/category-card.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Router } from '@angular/router';
import { Store } from '@ngxs/store';
import { CategoryIcons } from '../../../shared/enum/category-icons';
import { Direction } from '../../../shared/models/category.model';
import { SetDirections } from '../../../shared/store/filter.actions';
import { CategoryIcons } from 'shared/enum/category-icons';
import { Direction } from 'shared/models/category.model';
import { SetDirections } from 'shared/store/filter.actions';
import { WorkshopDeclination } from '../../enum/enumUA/declinations/declination';
import { DefaultFilterState } from '../../models/defaultFilterState.model';

Expand All @@ -13,24 +13,24 @@ import { DefaultFilterState } from '../../models/defaultFilterState.model';
styleUrls: ['./category-card.component.scss']
})
export class CategoryCardComponent {
@Input() workshopsCount: number;
@Input() isEditMode: boolean;
@Input() direction: Direction;
@Input() icons: {};
@Output() deleteDirection = new EventEmitter<Direction>();
@Input() public workshopsCount: number;
@Input() public isEditMode: boolean;
@Input() public direction: Direction;
@Input() public icons: {};
@Output() public deleteDirection = new EventEmitter<Direction>();

readonly WorkshopDeclination = WorkshopDeclination;
public readonly WorkshopDeclination = WorkshopDeclination;

public categoryIcons = CategoryIcons;

constructor(private store: Store, private router: Router) {}

onDelete(event: Event): void {
public onDelete(event: Event): void {
this.deleteDirection.emit(this.direction);
event.stopPropagation();
}

selectDirection(direction: Direction): void {
public selectDirection(direction: Direction): void {
this.store.dispatch(new SetDirections([direction.id]));
const filterQueryParams: Partial<DefaultFilterState> = { directionIds: [direction.id] };
this.router.navigate(['result/list'], { queryParams: { filter: filterQueryParams }, replaceUrl: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import {
styleUrls: ['./confirmation-modal-window.component.scss']
})
export class ConfirmationModalWindowComponent implements OnInit {
readonly modalConfirmationType = ModalConfirmationType;
readonly modalWindow = true;
public readonly modalConfirmationType = ModalConfirmationType;
public readonly modalWindow = true;

modalTitle: string;
modalConfirmationText: string;
modalConfirmationProperty: string;
ratingSelectControl: FormControl;
public modalTitle: string;
public modalConfirmationText: string;
public modalConfirmationProperty: string;
public ratingSelectControl: FormControl;

constructor(
@Inject(MAT_DIALOG_DATA)
Expand All @@ -31,7 +31,7 @@ export class ConfirmationModalWindowComponent implements OnInit {
}
) {}

ngOnInit(): void {
public ngOnInit(): void {
this.modalTitle = ModalConfirmationTitle[this.data.type];
this.modalConfirmationText = ModalConfirmationText[this.data.type];
if (this.data.property) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ import {
styleUrls: ['./reason-modal-window.component.scss']
})
export class ReasonModalWindowComponent implements OnInit {
readonly validationConstants = ValidationConstants;
readonly modalConfirmationType = ModalConfirmationType;
readonly phonePrefix = Constants.PHONE_PREFIX;
public readonly validationConstants = ValidationConstants;
public readonly modalConfirmationType = ModalConfirmationType;
public readonly phonePrefix = Constants.PHONE_PREFIX;

formGroup: FormGroup;
modalTitle: string;
modalConfirmationText: string;
modalConfirmationDescription: string;
isPhoneNumberRequired: boolean;
public formGroup: FormGroup;
public modalTitle: string;
public modalConfirmationText: string;
public modalConfirmationDescription: string;
public isPhoneNumberRequired: boolean;

constructor(
@Inject(MAT_DIALOG_DATA) public data: { type: string; property: string },
Expand All @@ -50,7 +50,7 @@ export class ReasonModalWindowComponent implements OnInit {
}
}

ngOnInit(): void {
public ngOnInit(): void {
this.modalTitle = ModalConfirmationTitle[this.data.type];
this.modalConfirmationText = ModalConfirmationText[this.data.type];
this.modalConfirmationDescription = ModalConfirmationDescription[this.data.type];
Expand All @@ -64,7 +64,7 @@ export class ReasonModalWindowComponent implements OnInit {
return this.isPhoneNumberRequired && (this.formGroup.get('phoneNumber') as FormControl);
}

onSubmit(): void {
public onSubmit(): void {
if (this.isPhoneNumberRequired) {
this.dialogRef.close({
reason: this.reasonFormControl.value,
Expand All @@ -75,7 +75,7 @@ export class ReasonModalWindowComponent implements OnInit {
}
}

onCancel(): void {
public onCancel(): void {
this.dialogRef.close();
}
}
4 changes: 2 additions & 2 deletions src/app/shared/components/error-page/error-page.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { Router } from '@angular/router';

@Component({
Expand All @@ -9,7 +9,7 @@ import { Router } from '@angular/router';
export class ErrorPageComponent {
constructor(private router: Router) {}

OnBack(): void {
public OnBack(): void {
this.router.navigate(['']);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ import { Store } from '@ngxs/store';
import { FormControl } from '@angular/forms';
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
import { ValidationConstants } from '../../../constants/validation';
import { SetIsAppropriateAge, SetMaxAge, SetMinAge } from '../../../store/filter.actions';
import { ValidationConstants } from 'shared/constants/validation';
import { SetIsAppropriateAge, SetMaxAge, SetMinAge } from 'shared/store/filter.actions';

@Component({
selector: 'app-age-filter',
templateUrl: './age-filter.component.html',
styleUrls: ['./age-filter.component.scss']
})
export class AgeFilterComponent implements OnInit, OnDestroy {
readonly validationConstants = ValidationConstants;
public readonly validationConstants = ValidationConstants;
@Input()
set ageFilter(filter) {
public set ageFilter(filter) {
const { minAge, maxAge, isAppropriateAge } = filter;
this.minAgeFormControl.setValue(minAge, { emitEvent: false });
this.maxAgeFormControl.setValue(maxAge, { emitEvent: false });
this.isAppropriateAgeControl.setValue(isAppropriateAge, { emitEvent: false });
}

minAgeFormControl = new FormControl(null);
maxAgeFormControl = new FormControl(null);
isAppropriateAgeControl = new FormControl(false);
destroy$: Subject<boolean> = new Subject<boolean>();
public minAgeFormControl = new FormControl(null);
public maxAgeFormControl = new FormControl(null);
public isAppropriateAgeControl = new FormControl(false);
public destroy$: Subject<boolean> = new Subject<boolean>();

constructor(private store: Store) {}

ngOnInit(): void {
public ngOnInit(): void {
this.minAgeFormControl.valueChanges
.pipe(debounceTime(400), distinctUntilChanged(), takeUntil(this.destroy$))
.subscribe((age: number) => this.store.dispatch(new SetMinAge(age)));
Expand All @@ -42,16 +42,16 @@ export class AgeFilterComponent implements OnInit, OnDestroy {
.subscribe((val: boolean) => this.store.dispatch(new SetIsAppropriateAge(val)));
}

ngOnDestroy(): void {
public ngOnDestroy(): void {
this.destroy$.next(true);
this.destroy$.unsubscribe();
}

clearMin(): void {
public clearMin(): void {
this.minAgeFormControl.reset();
}

clearMax(): void {
public clearMax(): void {
this.maxAgeFormControl.reset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { MatCheckbox } from '@angular/material/checkbox';
import { Select, Store } from '@ngxs/store';
import { Observable, Subject } from 'rxjs';
import { debounceTime, distinctUntilChanged, filter, takeUntil } from 'rxjs/operators';
import { Direction } from '../../../models/category.model';
import { AppState } from '../../../store/app.state';
import { SetDirections } from '../../../store/filter.actions';
import { GetDirections } from '../../../store/meta-data.actions';
import { MetaDataState } from '../../../store/meta-data.state';
import { Direction } from 'shared/models/category.model';
import { AppState } from 'shared/store/app.state';
import { SetDirections } from 'shared/store/filter.actions';
import { GetDirections } from 'shared/store/meta-data.actions';
import { MetaDataState } from 'shared/store/meta-data.state';

@Component({
selector: 'app-category-check-box',
Expand All @@ -17,13 +17,13 @@ import { MetaDataState } from '../../../store/meta-data.state';
})
export class CategoryCheckBoxComponent implements OnInit, AfterViewInit, OnDestroy {
@Select(MetaDataState.directions)
directions$: Observable<Direction[]>;
public directions$: Observable<Direction[]>;
@Select(AppState.isMobileScreen)
isMobileScreen$: Observable<boolean>;
public isMobileScreen$: Observable<boolean>;

@ViewChild('listWrapper') filterContainer: ElementRef;

@Input() slectedDirectionIds: number[];
@Input() selectedDirectionIds: number[];

destroy$: Subject<boolean> = new Subject<boolean>();
allDirections: Direction[] = [];
Expand All @@ -33,7 +33,7 @@ export class CategoryCheckBoxComponent implements OnInit, AfterViewInit, OnDestr
constructor(private store: Store) {}

ngAfterViewInit(): void {
if (this.slectedDirectionIds?.length) {
if (this.selectedDirectionIds?.length) {
this.scrollToSelectedDirection();
}
}
Expand All @@ -50,18 +50,18 @@ export class CategoryCheckBoxComponent implements OnInit, AfterViewInit, OnDestr
}

/**
* This method add checked direction to the list of selected directions and distpatch filter action
* This method add checked direction to the list of selected directions and dispatch filter action
* @param direction
* @param event
*/
onDirectionCheck(direction: Direction, event: MatCheckbox): void {
event.checked
? this.slectedDirectionIds.push(direction.id)
: this.slectedDirectionIds.splice(
this.slectedDirectionIds.findIndex((selectedDirection: number) => selectedDirection === direction.id),
1
);
this.store.dispatch(new SetDirections(this.slectedDirectionIds));
? this.selectedDirectionIds.push(direction.id)
: this.selectedDirectionIds.splice(
this.selectedDirectionIds.findIndex((selectedDirection: number) => selectedDirection === direction.id),
1
);
this.store.dispatch(new SetDirections(this.selectedDirectionIds));
}

/**
Expand All @@ -79,7 +79,7 @@ export class CategoryCheckBoxComponent implements OnInit, AfterViewInit, OnDestr
* @returns boolean
*/
onSelectCheck(direction: Direction): boolean {
return this.slectedDirectionIds.some((directionId: number) => directionId === direction.id);
return this.selectedDirectionIds.some((directionId: number) => directionId === direction.id);
}

private scrollToSelectedDirection(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { debounceTime, distinctUntilChanged, filter, takeUntil } from 'rxjs/oper

import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { FormControl } from '@angular/forms';
import { MatAutocomplete, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
import { Actions, ofActionCompleted, Select, Store } from '@ngxs/store';

import { Coords } from '../../../../shared/models/coords.model';
import { GeolocationService } from '../../../../shared/services/geolocation/geolocation.service';
import { FilterChange, SetCoordsByMap } from '../../../../shared/store/filter.actions';
import { Constants } from '../../../constants/constants';
import { Codeficator } from '../../../models/codeficator.model';
import { FilterState } from '../../../store/filter.state';
import { ClearCodeficatorSearch, GetCodeficatorSearch } from '../../../store/meta-data.actions';
import { MetaDataState } from '../../../store/meta-data.state';
import { Coords } from 'shared/models/coords.model';
import { GeolocationService } from 'shared/services/geolocation/geolocation.service';
import { FilterChange, SetCoordsByMap } from 'shared/store/filter.actions';
import { Constants } from 'shared/constants/constants';
import { Codeficator } from 'shared/models/codeficator.model';
import { FilterState } from 'shared/store/filter.state';
import { GetCodeficatorSearch } from 'shared/store/meta-data.actions';
import { MetaDataState } from 'shared/store/meta-data.state';

@Component({
selector: 'app-city-filter',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ng-container>
</div>
<app-user-radius-set *ngIf="isMapView$ | async"></app-user-radius-set>
<app-category-check-box [slectedDirectionIds]="filterList.directionIds"></app-category-check-box>
<app-category-check-box [selectedDirectionIds]="filterList.directionIds"></app-category-check-box>
<app-age-filter [ageFilter]="filterList.ageFilter"></app-age-filter>
<app-working-hours [workingHours]="filterList.workingHours"></app-working-hours>
<app-price-filter [priceFilter]="filterList.priceFilter"></app-price-filter>
Expand Down
34 changes: 17 additions & 17 deletions src/app/shared/components/filters-list/filters-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ import { WorkshopOpenStatus } from '../../enum/workshop';
})
export class FiltersListComponent implements OnInit, OnDestroy {
@Select(FilterState.filterList)
filterList$: Observable<FilterList>;
filterList: FilterList;
public filterList$: Observable<FilterList>;
public filterList: FilterList;

@Select(NavigationState.filtersSidenavOpenTrue)
filtersSidenavOpenTrue$: Observable<boolean>;
visibleFiltersSidenav: boolean;
public filtersSidenavOpenTrue$: Observable<boolean>;
public visibleFiltersSidenav: boolean;

@Select(FilterState.isMapView)
isMapView$: Observable<boolean>;
public isMapView$: Observable<boolean>;

@Input() isMobileView: boolean;
@Input() public isMobileView: boolean;

OpenRecruitmentControl = new FormControl(false);
ClosedRecruitmentControl = new FormControl(false);
WithDisabilityOptionControl = new FormControl(false);
destroy$: Subject<boolean> = new Subject<boolean>();
statuses: WorkshopOpenStatus[];
readonly workhopStatus = WorkshopOpenStatus;
public OpenRecruitmentControl = new FormControl(false);
public ClosedRecruitmentControl = new FormControl(false);
public WithDisabilityOptionControl = new FormControl(false);
public destroy$: Subject<boolean> = new Subject<boolean>();
public statuses: WorkshopOpenStatus[];
public readonly workhopStatus = WorkshopOpenStatus;

constructor(private store: Store) {}

ngOnInit(): void {
public ngOnInit(): void {
combineLatest([this.filtersSidenavOpenTrue$, this.filterList$])
.pipe(takeUntil(this.destroy$))
.subscribe(([visibleFiltersSidenav, filterList]) => {
Expand Down Expand Up @@ -72,19 +72,19 @@ export class FiltersListComponent implements OnInit, OnDestroy {
* When the user selects filters (OpenRecruitment or ClosedRecruitment),
* we add the status to the array or remove the status from the array.
*/
statusHandler(val: boolean, status: string): void {
public statusHandler(val: boolean, status: string): void {
val ? this.statuses.push(this.workhopStatus[status]) : this.statuses.splice(this.statuses.indexOf(this.workhopStatus[status]), 1);
}

changeView(): void {
public changeView(): void {
this.store.dispatch(new FiltersSidenavToggle(!this.visibleFiltersSidenav));
}

onFilterReset(): void {
public onFilterReset(): void {
this.store.dispatch(new FilterClear());
}

ngOnDestroy(): void {
public ngOnDestroy(): void {
this.destroy$.next(true);
this.destroy$.unsubscribe();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import { Component, Input } from '@angular/core';
styleUrls: ['./full-search-bar.component.scss']
})
export class FullSearchBarComponent {
@Input() styleClass: string;
@Input() public styleClass: string;
}
Loading

0 comments on commit 60f7440

Please sign in to comment.