improved css (at least tried to) and fixed bugs in management page

This commit is contained in:
grata
2023-05-01 14:36:36 +02:00
parent a68d48e065
commit 2a3aec6c95
6 changed files with 21 additions and 39 deletions

View File

@@ -73,21 +73,6 @@ export class ListComponent implements OnInit, OnChanges {
setTimeout(() => { setTimeout(() => {
if (!this.positionCord) { if (!this.positionCord) {
this.positionNotFound = true; this.positionNotFound = true;
} else {
if (this.waypoints) {
if (!this.waypoints[0].distance) {
this.positionNotFound = true;
} else {
this.positionNotFound = false;
}
}
if (this.locations) {
if (!this.locations[0].distance) {
this.positionNotFound = true;
} else {
this.positionNotFound = false;
}
}
} }
}, 5000); }, 5000);
} }

View File

@@ -142,7 +142,7 @@
<div class="form-container"> <div class="form-container">
<h2>Add Location</h2> <h2>Add Location</h2>
<form <form
(submit)="addWaypoint(newWaypoint.name, newWaypoint.lat, newWaypoint.lon, newWaypoint.description, newWaypoint.image, newWaypoint.locationName)"> (submit)="addWaypoint(newWaypoint.name, newWaypoint.lat, newWaypoint.lon, newWaypoint.description, newWaypoint.img, newWaypoint.locationName)">
<div> <div>
<label for="waypointName">Waypoint:</label> <label for="waypointName">Waypoint:</label>
<input type="text" id="waypointName" name="waypointName" [(ngModel)]="newWaypoint.name"> <input type="text" id="waypointName" name="waypointName" [(ngModel)]="newWaypoint.name">

View File

@@ -6,6 +6,7 @@ import {ActivatedRoute} from "@angular/router";
import {LocationService} from "../../service/http/location.service"; import {LocationService} from "../../service/http/location.service";
import {UserService} from "../../service/http/user.service"; import {UserService} from "../../service/http/user.service";
import {WaypointService} from "../../service/http/waypoint.service"; import {WaypointService} from "../../service/http/waypoint.service";
import {toNumbers} from "@angular/compiler-cli/src/version_helpers";
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
@@ -18,9 +19,9 @@ export class ManagementComponent implements OnInit {
showLocationForm: boolean = false; showLocationForm: boolean = false;
showWaypointForm: boolean = false; showWaypointForm: boolean = false;
newUser: UserEntity; newUser: UserEntity = {name: "", password: "", username: ""};
newLocation: LocationEntity; newLocation: LocationEntity = {lat: 0, location: "", lon: 0, region: ""};
newWaypoint: WaypointsEntity; newWaypoint: WaypointsEntity = {description: "", img: "", lat: 0, locationName: "", lon: 0, name: ""};
locations: LocationEntity[] | undefined; locations: LocationEntity[] | undefined;
waypoints: WaypointsEntity[] | undefined; waypoints: WaypointsEntity[] | undefined;
@@ -56,15 +57,15 @@ export class ManagementComponent implements OnInit {
} }
addLocation(name: string, region: string, lat: number, lon: number) { addLocation(name: string, region: string, lat: number, lon: number) {
this.newLocation = {name: name, region: region, lat: lat, lon: lon}; this.newLocation = {location: name, region: region, lat: lat, lon: lon};
this.locationService.createLocation(this.newLocation).subscribe(location => { this.locationService.createLocation(this.newLocation).subscribe(location => {
this.locations?.push(location); this.locations?.push(location);
}); });
this.showLocationForm = false; this.showLocationForm = false;
} }
addWaypoint(name: string, lat: string, lon: string, description: string, image: string, locationName: string) { addWaypoint(name: string, lat: number, lon: number, description: string, image: string, locationName: string) {
this.newWaypoint = {name: name, lat: lat, lon: lon, description: description, img: image, locationName: locationName}; this.newWaypoint = {description: description, img: image, lat: lat, locationName: locationName, lon: lon, name: name}
this.waypointService.createWaypoint(this.newWaypoint).subscribe(waypoint => { this.waypointService.createWaypoint(this.newWaypoint).subscribe(waypoint => {
this.waypoints?.push(waypoint); this.waypoints?.push(waypoint);
}); });
@@ -94,4 +95,6 @@ export class ManagementComponent implements OnInit {
closeWaypointForm() { closeWaypointForm() {
this.showWaypointForm = false; this.showWaypointForm = false;
} }
protected readonly String = String;
} }

View File

@@ -1,12 +1,7 @@
.search { .search {
display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
position: absolute;
top: 35%;
left: 50%;
transform: translate(-50%, -50%);
} }
input { input {
@@ -16,10 +11,8 @@ input {
} }
#list { #list {
position: absolute; align-self: center;
top: 46%; height: auto;
left: 44%;
transform: translate(-50%, -50%);
justify-content: center; justify-content: center;
align-items: center; align-items: center;
align-content: center; align-content: center;
@@ -40,13 +33,13 @@ input {
} }
.bg-image { .bg-image {
padding-top: 25%;
background-image: url('src/assets/img/mountains.png'); background-image: url('src/assets/img/mountains.png');
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
height: 100vh; height: 94vh;
display: flex;
flex-direction: column;
} }
#translate{
margin: 100px 10px 10px 10px;
}

View File

@@ -1,6 +1,6 @@
<div [ngClass]="{'background-color': backgroundColor}"> <div [ngClass]="{'background-color': backgroundColor}">
<div class="alert alert-warning shadow-lg" *ngIf="allert"> <div class="alert alert-warning shadow-lg" *ngIf="allert" id="alert">
<div> <div>
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current flex-shrink-0 h-6 w-6" fill="none" <svg xmlns="http://www.w3.org/2000/svg" class="stroke-current flex-shrink-0 h-6 w-6" fill="none"
viewBox="0 0 24 24"> viewBox="0 0 24 24">
@@ -11,7 +11,7 @@
</div> </div>
</div> </div>
<div class="dropdown dropdown-hover"> <div class="dropdown dropdown-hover" id="translate">
<label tabindex="0" class="btn m-1 bg-black border-neutral text-base-100">{{translations.translate}}</label> <label tabindex="0" class="btn m-1 bg-black border-neutral text-base-100">{{translations.translate}}</label>
<ul tabindex="0" class="dropdown-content menu p-2 shadow rounded-box w-52"> <ul tabindex="0" class="dropdown-content menu p-2 shadow rounded-box w-52">
<li (click)="switchLanguage('DE')"><a>DE</a></li> <li (click)="switchLanguage('DE')"><a>DE</a></li>
@@ -22,6 +22,7 @@
</div > </div >
<div class="bg-image"> <div class="bg-image">
<div class="search"> <div class="search">
<div class="inputElements"> <div class="inputElements">

View File

@@ -1,5 +1,5 @@
export interface WaypointsEntity { export interface WaypointsEntity {
id: number; id?: number;
name: string; name: string;
lat: number; lat: number;
lon: number; lon: number;