Skip to content

Commit

Permalink
Dynamic Map area components
Browse files Browse the repository at this point in the history
  • Loading branch information
giovannicolacitti committed Sep 11, 2024
1 parent 74052cd commit 6082ca0
Show file tree
Hide file tree
Showing 29 changed files with 598 additions and 37 deletions.
10 changes: 8 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@
"src/assets",
"src/manifest.webmanifest"
],
"styles": ["src/styles.scss"],
"styles": [
"src/styles.scss",
"./node_modules/leaflet/dist/leaflet.css"
],
"scripts": [],
"vendorChunk": true,
"extractLicenses": false,
Expand Down Expand Up @@ -118,7 +121,10 @@
"src/assets",
"src/manifest.webmanifest"
],
"styles": ["src/styles.scss"],
"styles": [
"src/styles.scss",
"./node_modules/leaflet/dist/leaflet.css"
],
"scripts": []
}
},
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"start": "ng serve --proxy-config proxy-local.config.json",
"build": "ng build",
"build-libs": "ng build core && ng build components && ng build widgets",
"components:watch": "ng build components --watch",
"widgets:watch": "ng build widgets --watch",
"libs:watch": "npm run components:watch && npm run widgets:watch",
"test": "ng test",
"compodoc": "npx compodoc -p src/tsconfig.app.json",
"postinstall": "patch-package"
Expand All @@ -26,6 +29,7 @@
"@angular/platform-browser-dynamic": "12.2.16",
"@angular/router": "12.2.16",
"@angular/service-worker": "12.2.16",
"@asymmetrik/ngx-leaflet": "^8.1.0",
"@types/ws": "8.5.4",
"angular-gridster2": "~12.1.1",
"angular-plotly.js": "~4.0.4",
Expand All @@ -37,6 +41,7 @@
"d3": "^5.14.2",
"form-data": "^4.0.0",
"isomorphic-ws": "^5.0.0",
"leaflet": "^1.9.4",
"moment": "^2.29.1",
"moment-precise-range-plugin": "^1.3.0",
"ng-inline-svg": "^13.0.0",
Expand All @@ -59,6 +64,7 @@
"@compodoc/compodoc": "~1.1.11",
"@types/d3": "^5.7.2",
"@types/jasmine": "~3.8.0",
"@types/leaflet": "^1.9.12",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
Expand Down
10 changes: 10 additions & 0 deletions projects/components/src/lib/components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ import { RuleErrorModalComponent } from './rule-definition/rule-error/rule-error
import { HytChatbotChartMessageComponent } from './hyt-chatbot-chart-message/hyt-chatbot-chart-message.component';
import { PlotlyModule } from 'angular-plotly.js';
import { HytChartModalComponent } from './hyt-modal/hyt-chart-modal/hyt-chart-modal.component';
import { MapComponent } from './hyt-map/map.component';
import { LeafletMapComponent } from './hyt-map/components/leaflet-map/leaflet-map.component';
import {LeafletModule} from "@asymmetrik/ngx-leaflet";
import { DynamicMapUserConfiguratorComponent } from './hyt-map/components/dynamic-map-user-configurator/dynamic-map-user-configurator.component';

export const options: Partial<IConfig> | (() => Partial<IConfig>) = {};

Expand Down Expand Up @@ -122,6 +126,9 @@ export const options: Partial<IConfig> | (() => Partial<IConfig>) = {};
RuleErrorModalComponent,
HytChatbotChartMessageComponent,
HytChartModalComponent,
MapComponent,
LeafletMapComponent,
DynamicMapUserConfiguratorComponent,
],
imports: [
CommonModule,
Expand All @@ -131,6 +138,7 @@ export const options: Partial<IConfig> | (() => Partial<IConfig>) = {};
NgxMaskModule.forRoot(options),
RouterModule,
PlotlyModule,
LeafletModule,
],
exports: [
CronEditorComponent,
Expand Down Expand Up @@ -183,6 +191,8 @@ export const options: Partial<IConfig> | (() => Partial<IConfig>) = {};
RuleDefinitionComponent,
HytChatbotChartMessageComponent,
HytChartModalComponent,
MapComponent,
LeafletMapComponent,
],
providers: [
NotificationService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ $chatBotAliceIconBGImage: #{var(--chatBotAliceIconBGImage)};
position: fixed;
bottom: 15px;
right: 15px;
width: 350px;
width: 350px;
height: 550px;
z-index: 99;
z-index: 1001;
box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -607,7 +607,7 @@ $chatBotAliceIconBGImage: #{var(--chatBotAliceIconBGImage)};
height: 35px;
align-items: center;
justify-content: center;

button {
background-color: #ffffff;
width: 35px;
Expand All @@ -617,16 +617,16 @@ $chatBotAliceIconBGImage: #{var(--chatBotAliceIconBGImage)};
border: 3px solid #1e58a5;
box-shadow: 0px 0px 3px 0px darkblue;
opacity: 1;

&:disabled {
opacity: .4;
cursor: not-allowed;
}

&:hover {
box-shadow: 0px 0px 0px 0px darkblue;
}

img {
width: 17px;
margin: 0 auto;
Expand Down Expand Up @@ -675,7 +675,7 @@ $chatBotAliceIconBGImage: #{var(--chatBotAliceIconBGImage)};
}
}

.hyt-chatbot-collapsed-disconnected {
.hyt-chatbot-collapsed-disconnected {
position: absolute;
top: -5px;
width: 20px;
Expand Down Expand Up @@ -789,4 +789,4 @@ $chatBotAliceIconBGImage: #{var(--chatBotAliceIconBGImage)};
box-shadow: 0 5px 10px 0px rgba(0, 0, 0, 0.6);
transform: translatey(0px);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<div id="container-dmuc">

<div id="current-status-configuration">
<div class="status-icon">
<mat-icon aria-hidden="false" aria-label="warning icon">warning</mat-icon>
<!-- Alternative Icon for Ok status -->
<!--<mat-icon aria-hidden="false" aria-label="thumb up icon">thumb_up_off_alt</mat-icon>-->
</div>
<div class="status-text">
Set the coordinates of the center of the map
</div>
<div class="toggle-arrow">
<mat-icon aria-hidden="false" aria-label="arrow icon">arrow_forward_ios</mat-icon>
</div>
</div>

<div id="coordinates-configuration">
<div class="title-configuration">
Set Map Location
</div>
<div class="container-toogle-btn">
<mat-button-toggle-group
name="coordinatesType"
aria-label="Coordinates Type"
[value]="selectedCoordType"
(change)="changeCoordType($event)"
>
<mat-button-toggle value="GEOCODING">Address</mat-button-toggle>
<mat-button-toggle value="LATLONG">Coordinates</mat-button-toggle>
</mat-button-toggle-group>
</div>
</div>
<div id="container-coord-forms" [ngSwitch]="selectedCoordType">
<div *ngSwitchCase="'GEOCODING'">
<p>GEOCODING</p>
<div class="container-geocoding-form">
<form>
<div class=" form-row container-address">
<label for="geocoding-address">Indirizzo</label>
<input id="geocoding-address" placeholder="Inserisci un indirizzo valido" type="text" />
<mat-form-field class="example-full-width" appearance="fill">
<mat-label>Indirizzo</mat-label>
<input matInput placeholder="Inserisci un indirizzo valido" value="Sushi">
</mat-form-field>
</div>
<div class=" form-row zoom-lvl">
<label for="geocoding-zoom">Zoom Level</label>
<input id="geocoding-zoom" type="number" />
</div>
<button>Salva indirizzo</button>
</form>
</div>
</div>
<div *ngSwitchCase="'LATLONG'">
<p>LATLONG</p>
<div class="container-latlong-form">
<form>
<div class=" form-row container-lat-long">
<label for="latlong-latitude">Latitudine</label>
<input id="latlong-latitude" placeholder="Inserisci latitudine" type="text" />
</div>
<div class=" form-row container-lat-long">
<label for="latlong-longitude">Longitudine</label>
<input id="latlong-longitude" placeholder="Inserisci Longitudine" type="text" />
</div>
<div class="zoom-lvl">
<label for="latlong-zoom">Zoom Level</label>
<input id="latlong-zoom" type="number">
</div>
<button>Salva Coordinate</button>
</form>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#container-dmuc {
font-family: "Exo";
background-color: white;
width: fit-content;
max-width: 400px;
//height: 40px;
height: auto;
padding: 5px 15px;
border: 1px solid #8f8f8f;

-moz-border-radius: 15px;
-webkit-border-radius: 15px;
border-radius: 15px;

-moz-box-shadow: 0px 0px 11px -2px #000;
-webkit-box-shadow: 0px 0px 11px -2px #000;
box-shadow: 0px 0px 11px -2px #000;

display: flex;
flex-direction: column;
align-items: flex-start;

#current-status-configuration {
display: flex;
align-items: center;

.status-icon {
margin-right: 5px;

mat-icon {
color: red;
}
}

.status-text {
min-width: 250px;
width: 100%;
}

.toggle-arrow {
margin-left: 15px;
mat-icon {
font-size: 1.5em;
display: flex;
align-items: center;
}
}
}

#coordinates-configuration {
margin-top: 10px;
border-top: 1px solid #d4d4d4;
width: 100%;
padding-top: 10px;

.title-configuration {
margin-bottom: 20px;
font-size: 1.4em;
color: #2B7EE2;
}
}

#container-coord-forms {
margin-top: 20px;

.container-geocoding-form,
.container-latlong-form {
display: flex;
flex-direction: column;
.form-row {
display: flex;
flex-direction: column;
margin-bottom: 15px;
label {
margin-bottom: 2px;
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { DynamicMapUserConfiguratorComponent } from './dynamic-map-user-configurator.component';

describe('DynamicMapUserConfiguratorComponent', () => {
let component: DynamicMapUserConfiguratorComponent;
let fixture: ComponentFixture<DynamicMapUserConfiguratorComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ DynamicMapUserConfiguratorComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(DynamicMapUserConfiguratorComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {Component, OnInit} from '@angular/core';
import {CoordinatesType} from "../../models/coordinates-type";
import {MatButtonToggleChange} from "@angular/material/button-toggle";
import {Logger, LoggerService} from "core";

@Component({
selector: 'hyt-dynamic-map-user-configurator',
templateUrl: './dynamic-map-user-configurator.component.html',
styleUrls: ['./dynamic-map-user-configurator.component.scss']
})
export class DynamicMapUserConfiguratorComponent implements OnInit {
/**
* Value used to indicate the type of coordinates the user wants to enter and set via toggle buttons
*/
selectedCoordType: CoordinatesType = CoordinatesType.GEOCODING;
/*
* logger service
*/
private logger: Logger;

constructor(private loggerService: LoggerService) {
// Init Logger
this.logger = new Logger(this.loggerService);
this.logger.registerClass('DynamicMapUserConfiguratorComponent');
}

ngOnInit(): void {
}

/**
* Handles the change of value when the toggle button is clicked
* @param change
*/
changeCoordType(change: MatButtonToggleChange) {
this.logger.debug('changeCoordType - Coordinates type has changed', change);
this.selectedCoordType = change.value;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div id="container-leaflet-map"
leaflet
[leafletOptions]="mapOptions"
(leafletMapReady)="onMapReady($event)"
>
<div *ngIf="editMode" class="container-user-config-map">
<hyt-dynamic-map-user-configurator></hyt-dynamic-map-user-configurator>
</div>
</div>
Loading

0 comments on commit 6082ca0

Please sign in to comment.