diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 18fc308..d536e16 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -3,11 +3,28 @@ import { Login } from '@pages/auth/login/login'; import { Signup } from '@pages/auth/signup/signup'; import { AppLayout } from '@layouts/app-layout/app-layout'; import { authGuard } from '@guards/auth-guard'; +import { FlowEditor } from '@layouts/flow-editor/flow-editor'; +import { Tasks } from '@layouts/tasks/tasks'; export const routes: Routes = [ { path: '', component: AppLayout, + children: [ + { + path: '', + redirectTo: 'editor', + pathMatch: 'full' + }, + { + path: 'editor', + component: FlowEditor + }, + { + path: 'tasks', + component: Tasks + } + ], canActivate: [authGuard] }, { diff --git a/src/app/layouts/app-layout/app-layout.css b/src/app/layouts/app-layout/app-layout.css index 4e10297..9cd6f0d 100644 --- a/src/app/layouts/app-layout/app-layout.css +++ b/src/app/layouts/app-layout/app-layout.css @@ -1,7 +1,6 @@ /* Header fisso */ .app-header { font-family: 'Roboto', sans-serif; - border-bottom: 1px solid #ddd; } /* Logo */ @@ -23,3 +22,11 @@ .nav-tabs { border-bottom: 1px solid #ccc; } + +.nav-link.active { + background-color: #ffffff; + color: #0f766e; /* verde elegante */ + border: 1px solid #d1d5db; + border-bottom-color: white; + box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.05); +} diff --git a/src/app/layouts/app-layout/app-layout.html b/src/app/layouts/app-layout/app-layout.html index 3363ed5..1894057 100644 --- a/src/app/layouts/app-layout/app-layout.html +++ b/src/app/layouts/app-layout/app-layout.html @@ -1,43 +1,72 @@
- -
-
- -

HumAIn Flow

+ +
+
+ +

HumAIn Flow

+
+ +
+ + {{ loggedUser()?.username }} +
+ + + + +
+ Logout +
+
+ +
+
+ + +
+ + + + + +
+ +
+
- -
- - {{ loggedUser()?.username }} - -
-
- - -
- - - - - -
-

Qui va il contenuto principale...

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit...

-

Puoi aggiungere tutto ciò che vuoi, scrollando rimane visibile header + tabs.

-
- -
-
+ \ No newline at end of file diff --git a/src/app/layouts/app-layout/app-layout.ts b/src/app/layouts/app-layout/app-layout.ts index bc71a48..215b672 100644 --- a/src/app/layouts/app-layout/app-layout.ts +++ b/src/app/layouts/app-layout/app-layout.ts @@ -1,10 +1,10 @@ import { Component, inject } from '@angular/core'; -import { Router } from '@angular/router'; +import { Router, RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router'; import { Authorization } from '@services/authorization/authorization'; @Component({ selector: 'app-app-layout', - imports: [], + imports: [RouterOutlet, RouterLink, RouterLinkActive], templateUrl: './app-layout.html', styleUrl: './app-layout.css', }) diff --git a/src/app/layouts/flow-editor/flow-editor.css b/src/app/layouts/flow-editor/flow-editor.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/layouts/flow-editor/flow-editor.html b/src/app/layouts/flow-editor/flow-editor.html new file mode 100644 index 0000000..accabde --- /dev/null +++ b/src/app/layouts/flow-editor/flow-editor.html @@ -0,0 +1 @@ +

flow-editor works!

diff --git a/src/app/layouts/flow-editor/flow-editor.spec.ts b/src/app/layouts/flow-editor/flow-editor.spec.ts new file mode 100644 index 0000000..dc940a0 --- /dev/null +++ b/src/app/layouts/flow-editor/flow-editor.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FlowEditor } from './flow-editor'; + +describe('FlowEditor', () => { + let component: FlowEditor; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [FlowEditor] + }) + .compileComponents(); + + fixture = TestBed.createComponent(FlowEditor); + component = fixture.componentInstance; + await fixture.whenStable(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/layouts/flow-editor/flow-editor.ts b/src/app/layouts/flow-editor/flow-editor.ts new file mode 100644 index 0000000..801d544 --- /dev/null +++ b/src/app/layouts/flow-editor/flow-editor.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-flow-editor', + imports: [], + templateUrl: './flow-editor.html', + styleUrl: './flow-editor.css', +}) +export class FlowEditor { + +} diff --git a/src/app/layouts/tasks/tasks.css b/src/app/layouts/tasks/tasks.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/layouts/tasks/tasks.html b/src/app/layouts/tasks/tasks.html new file mode 100644 index 0000000..1c982ef --- /dev/null +++ b/src/app/layouts/tasks/tasks.html @@ -0,0 +1 @@ +

tasks works!

diff --git a/src/app/layouts/tasks/tasks.spec.ts b/src/app/layouts/tasks/tasks.spec.ts new file mode 100644 index 0000000..ae4a2fe --- /dev/null +++ b/src/app/layouts/tasks/tasks.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Tasks } from './tasks'; + +describe('Tasks', () => { + let component: Tasks; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [Tasks] + }) + .compileComponents(); + + fixture = TestBed.createComponent(Tasks); + component = fixture.componentInstance; + await fixture.whenStable(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/layouts/tasks/tasks.ts b/src/app/layouts/tasks/tasks.ts new file mode 100644 index 0000000..8ce1d5c --- /dev/null +++ b/src/app/layouts/tasks/tasks.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-tasks', + imports: [], + templateUrl: './tasks.html', + styleUrl: './tasks.css', +}) +export class Tasks { + +} diff --git a/src/app/services/authorization/authorization.ts b/src/app/services/authorization/authorization.ts index d7850c6..1b35565 100644 --- a/src/app/services/authorization/authorization.ts +++ b/src/app/services/authorization/authorization.ts @@ -1,4 +1,4 @@ -import { Injectable, signal } from '@angular/core'; +import { effect, Injectable, signal } from '@angular/core'; import { User, UserRegistration } from '@models/user'; import { AuthorizationCallServiceBase } from './authorization-call.base'; import { environment } from '@environment'; @@ -11,11 +11,10 @@ export class Authorization { private readonly apiUrl = environment.apiUrl + '/auth'; + private user = signal(null); authCall: AuthorizationCallServiceBase = new environment.authorizationCallService(); - private user = signal(null); - loggedInUser = this.user.asReadonly(); login(username: string, password: string) { @@ -23,6 +22,7 @@ export class Authorization { take(1), tap(res => { this.user.set(res); + localStorage.setItem('loggedInUser', JSON.stringify(res)); }) ); } @@ -34,15 +34,14 @@ export class Authorization { } logout() { + localStorage.removeItem('loggedInUser'); this.user.set(null); } isLoggedIn(): boolean { - return this.user() !== null; - } - - getUsername(): string | null { - return this.user()?.email || null; + const storedUser = localStorage.getItem('loggedInUser'); + this.user.set(storedUser != null ? JSON.parse(storedUser) : null); + return storedUser != null; } }