Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
hauke96 committed Apr 5, 2020
2 parents a88d95a + fc95f00 commit fc56444
Show file tree
Hide file tree
Showing 45 changed files with 501 additions and 86 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ Stage 3 creates the server to handle and distribute everything.
Stage 4 finally adds support for multiple users.
This will enable you to invite other to tasks.

* [ ] Define creator of project (aka "admin")
* [ ] Mark own projects
* [ ] Invite user (only possible by admin)
* [ ] Enter username and to invite user
* [ ] Users should also see projects they've invited to
* [x] Define creator of project (aka "owner")
* [x] Mark own projects
* [x] Invite user (only possible by owner)
* [x] Enter username and to invite user
* [x] Users should also see projects they've invited to

## Stage 5

Expand Down Expand Up @@ -103,7 +103,7 @@ Things that would be nice but are not necessary for a prototype.
* [ ] From overpass-query / -result
* [ ] Internal development
* [ ] Use go modules? (may or may not be useful)
* [ ] Create Docker container for client and server
* [x] Create Docker container for client and server

# Development

Expand Down
2 changes: 1 addition & 1 deletion client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-task-manager",
"version": "0.3.1",
"version": "0.4.0",
"scripts": {
"ng": "ng",
"dev": "ng serve --watch",
Expand Down
10 changes: 8 additions & 2 deletions client/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ import { ProjectComponent } from './project/project.component';
import { TaskListComponent } from './task/task-list.component';
import { TaskDetailsComponent } from './task/task-details.component';
import { TaskMapComponent } from './task/task-map.component';
import { FooterComponent } from './footer.component';
import { FooterComponent } from './ui/footer.component';
import { ProjectCreationComponent } from './project/project-creation.component';
import { TabsComponent } from './ui/tabs.component';
import { UserListComponent } from './user/user-list.component';
import { UserInvitationComponent } from './user/user-invitation.component';

@NgModule({
declarations: [
Expand All @@ -30,7 +33,10 @@ import { ProjectCreationComponent } from './project/project-creation.component';
TaskDetailsComponent,
TaskMapComponent,
FooterComponent,
ProjectCreationComponent
ProjectCreationComponent,
TabsComponent,
UserListComponent,
UserInvitationComponent
],
imports: [
BrowserModule,
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/auth/auth.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgZone, Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AuthService } from './auth.service';
import { UserService } from './user.service';
import { UserService } from '../user/user.service';

@Component({
selector: 'app-auth',
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/auth/auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { environment } from '../../environments/environment';
import { UserService } from './user.service';
import { UserService } from '../user/user.service';
import { Router } from '@angular/router';

@Injectable({
Expand Down
1 change: 1 addition & 0 deletions client/src/app/manager/manager.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
<app-project-list></app-project-list>
</div>
</div>

<app-footer></app-footer>
6 changes: 6 additions & 0 deletions client/src/app/manager/manager.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@
.toolbar > p {
color: $very-light-gray;
}

.root-container {
max-width: 500px;
margin-left: auto;
margin-right: auto;
}
2 changes: 1 addition & 1 deletion client/src/app/manager/manager.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { UserService } from '../auth/user.service';
import { UserService } from '../user/user.service';
import { AuthService } from '../auth/auth.service';
import { Router } from '@angular/router';

Expand Down
21 changes: 12 additions & 9 deletions client/src/app/project/project-creation.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
<div class="root-container">
<div class="project-properties-container">
<div>
Name:
<input [(ngModel)]="newProjectName">
</div>
<div>
Max. points per task:
<input type="number" [(ngModel)]="newMaxProcessPoints">
<h2>Properties:</h2>
<div>
Name:
<input [(ngModel)]="newProjectName">
</div>
<div>
Max. points per task:
<input type="number" [(ngModel)]="newMaxProcessPoints">
</div>
</div>
</div>
<div class="map-container">
<div id="map"></div>
<div>
<h2>Divide into squares:</h2>
<div>
Expand All @@ -25,4 +25,7 @@ <h2>Divide into squares:</h2>
<button (click)="onDivideButtonClicked()">Divide</button>
</div>
</div>
<div class="map-container">
<div id="map"></div>
</div>
</div>
12 changes: 8 additions & 4 deletions client/src/app/project/project-creation.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@

:host {
height: 100%;
display: flex;
flex-direction: column;
justify-content: stretch;
}

.root-container {
height: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
flex-grow: 1;
margin-top: 0px;
min-height: 0px; // important for scrolling (for whatever reason, s. above)
}

.project-properties-container {
display: flex;
flex-direction: column;
}
.project-properties-container > div {
.project-properties-container div {
margin-bottom: $space-base
}

.map-container {
height: 75%;
width: 50%;
width: 65%;
display: flex;
flex-direction: column;
}
Expand Down
7 changes: 6 additions & 1 deletion client/src/app/project/project-list.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<h1>Projekte</h1>
<div>
<div *ngFor="let p of projects" class="list-item" (click)="onProjectListItemClicked(p.id)">
{{p.name}} <span class="id-label">({{p.id}})</span>
<div>
{{p.name}} <span class="light-label">({{p.id}})</span>
</div>
<div>
<span class="light-label" *ngIf="p.owner === currentUser">Owned by you</span>
</div>
</div>
</div>
<button class="create-project-button" [routerLink]="['/new-project']">Create project</button>
7 changes: 6 additions & 1 deletion client/src/app/project/project-list.component.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
@import "../../styles.scss";

.list-item {
display: flex;
justify-content: space-between;
}

.create-project-button {
margin-top: $space-large;
}

.id-label {
.light-label {
color: $gray-mid;
}
8 changes: 7 additions & 1 deletion client/src/app/project/project-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ProjectService } from './project.service';
import { UserService } from './../user/user.service';
import { Project } from './project.material';
import { Router } from '@angular/router';

Expand All @@ -13,13 +14,18 @@ export class ProjectListComponent implements OnInit {

constructor(
private projectService: ProjectService,
private router: Router
private router: Router,
private userService: UserService
) { }

ngOnInit(): void {
this.projectService.getProjects().subscribe(p => this.projects = p);
}

public get currentUser(): string {
return this.userService.getUser();
}

public onProjectListItemClicked(id: string) {
this.router.navigate(['/project', id]);
}
Expand Down
34 changes: 23 additions & 11 deletions client/src/app/project/project.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,30 @@
<p class="project-label">Project: {{thisProject?.name}}</p>
</div>
<div class="root-container">
<div class="root-container-item task-list-container">
<h1>Tasks</h1>
<app-task-list *ngIf="tasks" [projectId]="thisProject?.id" [tasks]="tasks"></app-task-list>
</div>
<div class="root-container-item task-details-map-container">
<div class="map-container">
<h1>Map</h1>
<app-task-map *ngIf="tasks" [tasks]="tasks" class="map"></app-task-map>
</div>
<div class="details-container">
<h1>Details</h1>
<div class="task-list-details-container">
<app-tabs [tabs]="['Tasks', 'Users']" #tabs>
<div *ngIf="tabs.tabIndex === 0">
<div class="tab-container">
<h1>Tasks</h1>
<app-task-list *ngIf="tasks" [projectId]="thisProject?.id" [tasks]="tasks"></app-task-list>
</div>
</div>
<div *ngIf="tabs.tabIndex === 1">
<div class="tab-container">
<h1>Users</h1>
<app-user-invitation class="tab-container-item" [project]="thisProject"></app-user-invitation>
<app-user-list [users]="thisProject?.users"></app-user-list>
</div>
</div>
</app-tabs>

<div class="task-details-container">
<h1>Task Details</h1>
<app-task-details></app-task-details>
</div>
</div>
<div class="map-container">
<h1>Map</h1>
<app-task-map *ngIf="tasks" [tasks]="tasks" class="map"></app-task-map>
</div>
</div>
36 changes: 22 additions & 14 deletions client/src/app/project/project.component.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
@import '../../styles.scss';

// Making the task list content scrollable was made with the help of this article:
// https://moduscreate.com/blog/how-to-fix-overflow-issues-in-css-flex-layouts/

:host {
height: 100%;
width: 100%;
Expand All @@ -8,33 +11,34 @@
justify-content: stretch;
}

.task-details-container {
margin-bottom: $space-large;
}

.root-container {
display: flex;
height: 100%;
flex-grow: 1;
margin-top: 0px;
min-height: 0px; // important for scrolling (for whatever reason, s. above)
}

.root-container-item {
width: 50%;
}

.task-list-container {
.task-list-details-container {
width: 35%;
display: flex;
flex-direction: column;
justify-content: space-between;
margin-top: $space-large;
margin-right: $space-large;
}

.task-details-map-container {
.tab-container {
display: flex;
flex-direction: column;
min-height: 0px; // important for scrolling (for whatever reason, s. above)
}

.map-container {
height: 65%;
}
.details-container {
height: 35%;
}

.map-container {
width: 65%;
display: flex;
flex-direction: column;
}
Expand All @@ -47,3 +51,7 @@
color: $very-light-gray;
margin-left: $space-base;
}

.tab-container-item {
margin-bottom: $space-large;
}
4 changes: 3 additions & 1 deletion client/src/app/project/project.material.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export class Project {
constructor(public id: string,
public name: string,
public taskIds: string[]
public taskIds: string[],
public users?: string[],
public owner?: string
) { }
}
11 changes: 8 additions & 3 deletions client/src/app/project/project.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { Injectable, EventEmitter } from '@angular/core';
import { Observable, throwError } from 'rxjs';
import { map, flatMap } from 'rxjs/operators';
import { map, flatMap, tap } from 'rxjs/operators';
import { Project } from './project.material';
import { Task } from './../task/task.material';
import { TaskService } from './../task/task.service';
Expand All @@ -11,7 +11,7 @@ import { environment } from './../../environments/environment';
providedIn: 'root'
})
export class ProjectService {
public projects: Project[] = [];
public projectChanged: EventEmitter<Project> = new EventEmitter();

constructor(
private taskService: TaskService,
Expand Down Expand Up @@ -44,4 +44,9 @@ export class ProjectService {
return this.http.post<Project>(environment.url_projects, JSON.stringify(p));
}));
}

public inviteUser(user: string, id: string): Observable<Project> {
return this.http.post<Project>(environment.url_projects_users + '?user=' + user + '&project=' + id, '')
.pipe(tap(p => this.projectChanged.emit(p)));
}
}
Loading

0 comments on commit fc56444

Please sign in to comment.