Reformat code

This commit is contained in:
schmelczerandras 2019-08-24 15:25:43 +02:00
commit 420cd788c4
84 changed files with 10630 additions and 2646 deletions

View file

@ -1,10 +1,16 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PagesComponent } from './components/pages/pages.component';
const routes: Routes = [];
const routes: Routes = [
{
path: '',
component: PagesComponent
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
export class AppRoutingModule {}

View file

@ -1,21 +1,2 @@
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<h1>
Welcome to {{ title }}!
</h1>
<img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<h2>Here are some links to help you start: </h2>
<ul>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
</li>
</ul>
<app-modal></app-modal>
<router-outlet></router-outlet>

View file

@ -1,35 +0,0 @@
import { TestBed, async } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'frontend'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('frontend');
});
it('should render title in a h1 tag', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to frontend!');
});
});

View file

@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { ModalService } from './services/modal.service';
@Component({
selector: 'app-root',

View file

@ -3,16 +3,48 @@ import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { PageComponent } from './components/pages/page/page.component';
import { TowerComponent } from './components/pages/page/tower/tower.component';
import { DoubleSliderComponent } from './components/shared/double-slider/double-slider.component';
import { PagesComponent } from './components/pages/pages.component';
import { SelectAddComponent } from './components/shared/select-add/select-add.component';
import { ModalComponent } from './components/modal/modal.component';
import { FormsModule } from '@angular/forms';
import { BlockComponent } from './components/pages/page/tower/block/block.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { EditBlockComponent } from './components/modal/modals/edit-block/edit-block.component';
import { SettingsComponent } from './components/modal/modals/settings/settings.component';
import { RemoveTowerComponent } from './components/modal/modals/remove-tower/remove-tower.component';
import { RemovePageComponent } from './components/modal/modals/remove-page/remove-page.component';
import { GetStartedComponent } from './components/modal/modals/get-started/get-started.component';
import { CreateBlockComponent } from './components/modal/modals/create-block/create-block.component';
import { RemoveBlockComponent } from './components/modal/modals/remove-block/remove-block.component';
import { ToggleComponent } from './components/shared/toggle/toggle.component';
import { TasksComponent } from './components/pages/page/tower/tasks/tasks.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule
AppComponent,
PageComponent,
TowerComponent,
DoubleSliderComponent,
PagesComponent,
SelectAddComponent,
ModalComponent,
BlockComponent,
EditBlockComponent,
SettingsComponent,
RemoveTowerComponent,
RemovePageComponent,
GetStartedComponent,
CreateBlockComponent,
RemoveBlockComponent,
ToggleComponent,
TasksComponent
],
imports: [BrowserModule, AppRoutingModule, FormsModule, BrowserAnimationsModule, DragDropModule],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
export class AppModule {}

View file

@ -0,0 +1,9 @@
<main class="{{ modalService.active ? 'active' : '' }}" [ngSwitch]="modalService.active?.type">
<app-create-block *ngSwitchCase="ModalType.createBlock"></app-create-block>
<app-edit-block *ngSwitchCase="ModalType.editBlock"></app-edit-block>
<app-remove-block *ngSwitchCase="ModalType.removeBlock"></app-remove-block>
<app-remove-tower *ngSwitchCase="ModalType.removeTower"></app-remove-tower>
<app-settings *ngSwitchCase="ModalType.settings"></app-settings>
<app-get-started *ngSwitchCase="ModalType.getStarted"></app-get-started>
<app-remove-page *ngSwitchCase="ModalType.removePage"></app-remove-page>
</main>

View file

@ -0,0 +1,29 @@
@import '../../../styles';
main {
position: absolute;
top: 0;
left: 0;
z-index: 10000;
width: 100%;
height: 100%;
@include center-child();
padding: var(--large-padding);
box-sizing: border-box;
background: $background-gradient;
transition: opacity 300ms;
&:not(.active) {
opacity: 0;
pointer-events: none;
}
button {
margin-top: var(--medium-padding);
}
}

View file

@ -0,0 +1,20 @@
import { Component } from '@angular/core';
import { ModalService, ModalType } from '../../services/modal.service';
@Component({
selector: 'app-modal',
templateUrl: './modal.component.html',
styleUrls: ['./modal.component.scss']
})
export class ModalComponent {
// Needed for accessing the enum from html.
ModalType = ModalType;
constructor(public modalService: ModalService) {
window.addEventListener('keydown', (event: KeyboardEvent) => {
if (event.key === 'Escape') {
this.modalService.cancel();
}
});
}
}

View file

@ -0,0 +1,33 @@
<div class="header">
<div class="exit" (click)="modalService.cancel()"></div>
<h1>Create an item</h1>
</div>
<div class="select-add-container">
<!-- wrapper for easier styling -->
<app-select-add
class="select"
[options]="modalService.active.input"
[default]="modalService.active.input[0]"
[alwaysDropShadow]="true"
[onlyShadowBorder]="true"
[placeholder]="'Tag this item…'"
(value)="selected = $event"
></app-select-add>
</div>
<!-- wrapper for easier styling -->
<textarea placeholder="Write a description here…" [(ngModel)]="description"></textarea>
<div>
<!-- wrapper for easier styling -->
<app-toggle
[beforeText]="'This task hasn\'t been finished yet'"
[afterText]="'Goal already accomplished'"
[default]="false"
(value)="isDone = $event"
></app-toggle>
</div>
<!-- wrapper for easier styling -->
<button (click)="submit()">Create</button>

View file

@ -0,0 +1,29 @@
@import '../../../../../styles';
:host {
@include card();
box-shadow: $shadow;
width: 66vw;
max-width: 400px;
@media (max-width: $mobile-width) {
width: 300px;
}
box-sizing: border-box;
padding: var(--large-padding);
position: relative;
@include inner-spacing(var(--large-padding));
.header {
@include center-child();
.exit {
position: absolute;
left: var(--large-padding);
@include exit();
}
}
}

View file

@ -0,0 +1,23 @@
import { Component } from '@angular/core';
import { ModalService } from '../../../../services/modal.service';
@Component({
selector: 'app-create-block',
templateUrl: './create-block.component.html',
styleUrls: ['./create-block.component.scss']
})
export class CreateBlockComponent {
selected: string;
description: string = null;
isDone: boolean;
constructor(public modalService: ModalService) {}
submit() {
this.modalService.submit({
selected: this.selected,
description: this.description,
isDone: this.isDone
});
}
}

View file

@ -0,0 +1,33 @@
<div class="header">
<div class="exit" (click)="modalService.cancel()"></div>
<h1>View item</h1>
</div>
<div class="select-add-container">
<!-- wrapper for easier styling -->
<app-select-add
class="select"
[options]="modalService.active.input.options"
[default]="modalService.active.input.options[0]"
[alwaysDropShadow]="true"
[onlyShadowBorder]="true"
[placeholder]="'Tag this item…'"
(value)="selected = $event"
></app-select-add>
</div>
<!-- wrapper for easier styling -->
<textarea placeholder="Write a description here…" [(ngModel)]="modalService.active.input.description"></textarea>
<div>
<!-- wrapper for easier styling -->
<app-toggle
[beforeText]="'This task hasn\'t been finished yet'"
[afterText]="'Goal already accomplished'"
[default]="modalService.active.input.isDone"
(value)="modalService.active.input.isDone = $event"
></app-toggle>
</div>
<!-- wrapper for easier styling -->
<button (click)="submit()">Modify</button>

View file

@ -0,0 +1,29 @@
@import '../../../../../styles';
:host {
@include card();
box-shadow: $shadow;
width: 66vw;
max-width: 400px;
@media (max-width: $mobile-width) {
width: 300px;
}
box-sizing: border-box;
padding: var(--large-padding);
position: relative;
@include inner-spacing(var(--large-padding));
.header {
@include center-child();
.exit {
position: absolute;
left: var(--large-padding);
@include exit();
}
}
}

View file

@ -0,0 +1,21 @@
import { Component } from '@angular/core';
import { ModalService } from '../../../../services/modal.service';
@Component({
selector: 'app-edit-block',
templateUrl: './edit-block.component.html',
styleUrls: ['./edit-block.component.scss']
})
export class EditBlockComponent {
selected: string;
constructor(public modalService: ModalService) {}
submit() {
this.modalService.submit({
selected: this.selected,
description: this.modalService.active.input.description,
isDone: this.modalService.active.input.isDone
});
}
}

View file

@ -0,0 +1,3 @@
<p>
get-started works!
</p>

View file

@ -0,0 +1,12 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-get-started',
templateUrl: './get-started.component.html',
styleUrls: ['./get-started.component.scss']
})
export class GetStartedComponent implements OnInit {
constructor() {}
ngOnInit() {}
}

View file

@ -0,0 +1,3 @@
<p>
remove-block works!
</p>

View file

@ -0,0 +1,12 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-remove-block',
templateUrl: './remove-block.component.html',
styleUrls: ['./remove-block.component.scss']
})
export class RemoveBlockComponent implements OnInit {
constructor() {}
ngOnInit() {}
}

Some files were not shown because too many files have changed in this diff Show more