+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/components/header/header.css b/src/app/components/producers-list/producers-list.scss
similarity index 100%
rename from src/app/components/header/header.css
rename to src/app/components/producers-list/producers-list.scss
diff --git a/src/app/components/producers-list/producers-list.spec.ts b/src/app/components/producers-list/producers-list.spec.ts
new file mode 100644
index 0000000..0eaa084
--- /dev/null
+++ b/src/app/components/producers-list/producers-list.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ProducersList } from './producers-list';
+
+describe('ProducersList', () => {
+ let component: ProducersList;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [ProducersList]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(ProducersList);
+ component = fixture.componentInstance;
+ await fixture.whenStable();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/components/producers-list/producers-list.ts b/src/app/components/producers-list/producers-list.ts
new file mode 100644
index 0000000..9133c15
--- /dev/null
+++ b/src/app/components/producers-list/producers-list.ts
@@ -0,0 +1,14 @@
+import { Component } from '@angular/core';
+import { DesignAngularKitModule } from 'design-angular-kit';
+
+@Component({
+ selector: 'app-producers-list',
+ imports: [DesignAngularKitModule],
+ templateUrl: './producers-list.html',
+ styleUrl: './producers-list.scss',
+})
+export class ProducersListComponent {
+
+
+
+}
diff --git a/src/app/guards/auth-guard.ts b/src/app/guards/auth-guard.ts
index 6ca2d74..c4af559 100644
--- a/src/app/guards/auth-guard.ts
+++ b/src/app/guards/auth-guard.ts
@@ -9,7 +9,7 @@ export const authGuard: CanActivateFn = (route, state) => {
if (authService.isLoggedIn()) {
return true; // Allow access
} else {
- router.navigate(['/']);
+ router.navigate(['/login']);
return false; // Deny access
}
};
diff --git a/src/app/layouts/main-layout/main-layout.html b/src/app/layouts/main-layout/main-layout.html
new file mode 100644
index 0000000..817c1fb
--- /dev/null
+++ b/src/app/layouts/main-layout/main-layout.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/layouts/main-layout/main-layout.scss b/src/app/layouts/main-layout/main-layout.scss
new file mode 100644
index 0000000..b578c6b
--- /dev/null
+++ b/src/app/layouts/main-layout/main-layout.scss
@@ -0,0 +1,42 @@
+
+/* wrapper nav (opzionale se già su header) */
+.pa-nav {
+ background-color: #0066cc; // azzurro PA
+ display: flex;
+ padding: 0 50px;
+}
+
+/* lista */
+.pa-nav__list {
+ display: flex;
+ gap: 0.25rem;
+ margin: 0;
+ padding: 0 0.5rem;
+ list-style: none;
+}
+
+/* link base */
+.pa-nav__link {
+ display: inline-flex;
+ align-items: center;
+ padding: 0.55rem 0.9rem;
+ text-decoration: none;
+ font-weight: 500;
+ color: #ffffff;
+ opacity: 0.92;
+ transition: background-color 0.15s ease, box-shadow 0.15s ease;
+
+ &:hover {
+ cursor: pointer;
+ }
+ &:focus {
+ opacity: 1;
+ background-color: rgba(255, 255, 255, 0.15);
+ text-decoration: none;
+ }
+}
+
+.pa-nav__item.is-active > .pa-nav__link {
+ color: beige;
+ background-color: rgba(255, 255, 255, 0.25);
+}
\ No newline at end of file
diff --git a/src/app/layouts/main-layout/main-layout.spec.ts b/src/app/layouts/main-layout/main-layout.spec.ts
new file mode 100644
index 0000000..f4a5f1f
--- /dev/null
+++ b/src/app/layouts/main-layout/main-layout.spec.ts
@@ -0,0 +1,23 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { MainLayout } from './main-layout';
+
+describe('MainLayout', () => {
+ let component: MainLayout;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ imports: [MainLayout]
+ })
+ .compileComponents();
+
+ fixture = TestBed.createComponent(MainLayout);
+ component = fixture.componentInstance;
+ await fixture.whenStable();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/layouts/main-layout/main-layout.ts b/src/app/layouts/main-layout/main-layout.ts
new file mode 100644
index 0000000..5cd2335
--- /dev/null
+++ b/src/app/layouts/main-layout/main-layout.ts
@@ -0,0 +1,20 @@
+import { Component, inject } from '@angular/core';
+import { RouterOutlet, RouterLink, RouterLinkActive } from '@angular/router';
+import { DesignAngularKitModule } from 'design-angular-kit';
+import { Header } from '../../components/header/header';
+import { AuthenticationService } from '../../services/authentication';
+
+@Component({
+ selector: 'app-main-layout',
+ imports: [RouterOutlet, Header, DesignAngularKitModule, RouterLink, RouterLinkActive],
+ templateUrl: './main-layout.html',
+ styleUrl: './main-layout.scss',
+})
+export class MainLayout {
+
+ protected authService = inject(AuthenticationService);
+
+ loggedInUser() {
+ return this.authService.loggedInUser();
+ }
+}
diff --git a/src/app/model/login-data.ts b/src/app/model/login-data.ts
new file mode 100644
index 0000000..5f40030
--- /dev/null
+++ b/src/app/model/login-data.ts
@@ -0,0 +1,4 @@
+export interface LoginData {
+ email: string;
+ password: string;
+}
\ No newline at end of file
diff --git a/src/app/model/user.ts b/src/app/model/user.ts
index 3d81e25..ee6c7e6 100644
--- a/src/app/model/user.ts
+++ b/src/app/model/user.ts
@@ -1,4 +1,7 @@
-export type User = {
- username: string;
- email: string;
+
+export type Role = 'admin' | 'user';
+
+export class User {
+ constructor(public username: string, public email: string, public role: Role = "user") {}
+
};
\ No newline at end of file
diff --git a/src/app/pages/home/home.html b/src/app/pages/home/home.html
index 1ae983f..5956e78 100644
--- a/src/app/pages/home/home.html
+++ b/src/app/pages/home/home.html
@@ -15,7 +15,9 @@
attraverso regole configurabili e controlli avanzati.
+ @if(!isLoggedIn()) {
- L’accesso alle funzionalità complete è riservato agli utenti autenticati.
+ L’accesso alle funzionalità complete è riservato agli utenti autenticati. Accedi per iniziare a utilizzare il sistema.