-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1f93b9
commit 6299cb8
Showing
24 changed files
with
394 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { ModalComponentConfig } from 'src/app/modal/models'; | ||
|
||
@Component({ | ||
selector: 'app-about', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
templateUrl: './about.component.html', | ||
styleUrls: ['./about.component.css'], | ||
}) | ||
export class AboutComponent {} | ||
export class AboutComponent implements ModalComponentConfig<boolean> { | ||
modalTitle = 'О проекте'; | ||
modalResult = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/src/app/main/components/google-map/google-map.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './marker-dialog'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './marker-dialog.component'; |
31 changes: 31 additions & 0 deletions
31
src/src/app/main/components/marker-dialog/marker-dialog.component.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
:host { | ||
display: contents; | ||
} | ||
|
||
.description-form { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.load-file { | ||
display: inline-flex; | ||
width: 268px; | ||
height: 123px; | ||
align-items: center; | ||
justify-content: center; | ||
|
||
background: #c4c4c44c; | ||
border-radius: 15px; | ||
} | ||
|
||
.load-file-container { | ||
text-align: center; | ||
} | ||
|
||
.marker-dialog { | ||
display: grid; | ||
align-items: center; | ||
justify-content: center; | ||
grid-column-gap: 226px; | ||
grid-template-columns: 1fr 1fr; | ||
} |
86 changes: 86 additions & 0 deletions
86
src/src/app/main/components/marker-dialog/marker-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<div class="marker-dialog"> | ||
<form | ||
#form="ngForm" | ||
class="description-form" | ||
[id]="modalFormId" | ||
(ngSubmit)="submit()" | ||
> | ||
<mat-label>Адрес:</mat-label> | ||
|
||
<mat-form-field> | ||
<input | ||
cdkFocusInitial | ||
matInput | ||
name="address" | ||
[(ngModel)]="address" | ||
required | ||
type="text" | ||
/> | ||
</mat-form-field> | ||
|
||
<mat-label>Название объекта:</mat-label> | ||
|
||
<mat-form-field> | ||
<input matInput name="name" [(ngModel)]="name" required type="text" /> | ||
</mat-form-field> | ||
|
||
<mat-label>Год снимка:</mat-label> | ||
|
||
<mat-form-field> | ||
<input | ||
(click)="openDatePicker(datePicker)" | ||
[matDatepicker]="datePicker" | ||
matInput | ||
name="year" | ||
[(ngModel)]="year" | ||
required | ||
type="text" | ||
/> | ||
|
||
<mat-datepicker-toggle | ||
[for]="datePicker" | ||
matSuffix | ||
></mat-datepicker-toggle> | ||
|
||
<mat-datepicker | ||
#datePicker | ||
startView="multi-year" | ||
(yearSelected)="yearSelected($event, datePicker)" | ||
></mat-datepicker> | ||
</mat-form-field> | ||
|
||
<mat-label>Ссылка не ресурс:</mat-label> | ||
|
||
<mat-form-field> | ||
<input matInput name="url" [(ngModel)]="url" type="url" /> | ||
</mat-form-field> | ||
|
||
<mat-label>Описание к фотографии:</mat-label> | ||
|
||
<mat-form-field> | ||
<textarea | ||
matInput | ||
name="description" | ||
[(ngModel)]="description" | ||
type="text" | ||
></textarea> | ||
</mat-form-field> | ||
</form> | ||
|
||
<div class="load-file-container"> | ||
<p> | ||
* Выберите файлы, нажав на кнопку добавления или перетащите их в | ||
выделенную область | ||
</p> | ||
|
||
<div class="load-file">Перетащите изображение сюда</div> | ||
|
||
<button mat-icon-button> | ||
<mat-icon>add_circle</mat-icon> | ||
</button> | ||
|
||
<p> | ||
<a>Информация о правилах публикации и размерах файла</a> | ||
</p> | ||
</div> | ||
</div> |
83 changes: 83 additions & 0 deletions
83
src/src/app/main/components/marker-dialog/marker-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
EventEmitter, | ||
ViewChild, | ||
} from '@angular/core'; | ||
import { NgForm } from '@angular/forms'; | ||
import { MAT_DATE_FORMATS } from '@angular/material/core'; | ||
import { MatDatepicker } from '@angular/material/datepicker'; | ||
import { tap } from 'rxjs/operators'; | ||
import { YEAR_MODE } from 'src/app/main/constants'; | ||
import { Marker } from 'src/app/main/models'; | ||
import { MarkerStorageService } from 'src/app/main/services'; | ||
import { ModalComponentConfig } from 'src/app/modal/models'; | ||
|
||
@Component({ | ||
selector: 'app-marker-dialog', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
templateUrl: './marker-dialog.component.html', | ||
styleUrls: ['./marker-dialog.component.css'], | ||
providers: [ | ||
{ | ||
provide: MAT_DATE_FORMATS, | ||
useValue: YEAR_MODE, | ||
}, | ||
], | ||
}) | ||
export class MarkerDialogComponent implements ModalComponentConfig<Marker> { | ||
@ViewChild('form', { static: true }) | ||
private readonly _form!: NgForm; | ||
|
||
address = ''; | ||
description = ''; | ||
|
||
get formInvalid() { | ||
return this._form.invalid; | ||
} | ||
|
||
marker!: Marker; | ||
|
||
modalFormId = 'marker-dialog-form'; | ||
modalResult!: Marker; | ||
modalShowSubmitButton = true; | ||
modalSubmit = new EventEmitter<void>(); | ||
modalTitle = 'Добавить метку на карте'; | ||
|
||
name = ''; | ||
url = ''; | ||
year = new Date(); | ||
|
||
constructor(private readonly _markerStorage: MarkerStorageService) {} | ||
|
||
submit() { | ||
if (this.formInvalid) return; | ||
|
||
this._markerStorage | ||
.createMarker(this.marker) | ||
.pipe( | ||
tap((marker) => { | ||
console.log( | ||
`Latitude: ${marker.coordinates.latitude}, Longitude: ${marker.coordinates.longitude}` | ||
); | ||
|
||
this.modalResult = marker; | ||
}) | ||
) | ||
.subscribe(); | ||
|
||
this.modalSubmit.emit(); | ||
} | ||
|
||
openDatePicker(datepicker: MatDatepicker<Date>) { | ||
if (!datepicker.opened) { | ||
datepicker.open(); | ||
} | ||
} | ||
|
||
yearSelected(chosenDate: Date, datepicker: MatDatepicker<Date>) { | ||
datepicker.close(); | ||
|
||
this.year = chosenDate; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './year-mode'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const YEAR_MODE = { | ||
display: { | ||
dateInput: { | ||
year: 'numeric', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './main.lazy-loaded.module'; | ||
export * from './maps.module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './google-map-view-config'; | ||
export * from './marker'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './google-map-view-config.service'; | ||
export * from './marker-storage.service'; |
Oops, something went wrong.