From f847548797ac4d643081f0de7f159fa7ec87a122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarik=20Dedi=C4=87?= Date: Thu, 3 Oct 2024 12:52:42 +0200 Subject: [PATCH 1/9] Addig lazy load on home - front and admin part --- .github/workflows/deploy.yml | 2 +- .../src/app/admin/admin-routing.module.ts | 11 +++++++++ frontend/src/app/admin/admin.module.ts | 15 ++++++++++++ .../src/app/admin/pages/admin.component.html | 1 + .../pages/admin.component.scss} | 0 .../app/admin/pages/admin.component.spec.ts | 23 +++++++++++++++++++ .../src/app/admin/pages/admin.component.ts | 10 ++++++++ frontend/src/app/app-routing.module.ts | 9 +++----- frontend/src/app/app.module.ts | 4 ++-- frontend/src/app/home/home-routing.module.ts | 17 ++++++++++++++ frontend/src/app/home/home.module.ts | 14 +++++++++++ .../pages/contact/contact.component.html | 0 .../home/pages/contact/contact.component.scss | 0 .../pages/contact/contact.component.spec.ts | 0 .../pages/contact/contact.component.ts | 0 .../{ => home}/pages/home/home.component.html | 0 .../{ => home}/pages/home/home.component.scss | 0 .../pages/home/home.component.spec.ts | 0 .../{ => home}/pages/home/home.component.ts | 1 - .../pages/location/location.component.html | 0 .../pages/location/location.component.scss | 0 .../pages/location/location.component.spec.ts | 0 .../pages/location/location.component.ts | 0 frontend/tsconfig.app.json | 3 ++- frontend/tsconfig.spec.json | 2 +- 25 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 frontend/src/app/admin/admin-routing.module.ts create mode 100644 frontend/src/app/admin/admin.module.ts create mode 100644 frontend/src/app/admin/pages/admin.component.html rename frontend/src/app/{pages/contact/contact.component.scss => admin/pages/admin.component.scss} (100%) create mode 100644 frontend/src/app/admin/pages/admin.component.spec.ts create mode 100644 frontend/src/app/admin/pages/admin.component.ts create mode 100644 frontend/src/app/home/home-routing.module.ts create mode 100644 frontend/src/app/home/home.module.ts rename frontend/src/app/{ => home}/pages/contact/contact.component.html (100%) create mode 100644 frontend/src/app/home/pages/contact/contact.component.scss rename frontend/src/app/{ => home}/pages/contact/contact.component.spec.ts (100%) rename frontend/src/app/{ => home}/pages/contact/contact.component.ts (100%) rename frontend/src/app/{ => home}/pages/home/home.component.html (100%) rename frontend/src/app/{ => home}/pages/home/home.component.scss (100%) rename frontend/src/app/{ => home}/pages/home/home.component.spec.ts (100%) rename frontend/src/app/{ => home}/pages/home/home.component.ts (91%) rename frontend/src/app/{ => home}/pages/location/location.component.html (100%) rename frontend/src/app/{ => home}/pages/location/location.component.scss (100%) rename frontend/src/app/{ => home}/pages/location/location.component.spec.ts (100%) rename frontend/src/app/{ => home}/pages/location/location.component.ts (100%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4d5756e..c96ab07 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -112,7 +112,7 @@ jobs: # Copy Backend Files to VM using scp - name: Copy Backend to VM run: | - scp -v -o StrictHostKeyChecking=no -r ./backend/* ${{ secrets.VM_USER }}@${{ secrets.VM_IP }}:~/smetovi/backend + scp -o StrictHostKeyChecking=no -r ./backend/* ${{ secrets.VM_USER }}@${{ secrets.VM_IP }}:~/smetovi/backend # Restart Node.js Backend on VM - name: Restart Backend on VM diff --git a/frontend/src/app/admin/admin-routing.module.ts b/frontend/src/app/admin/admin-routing.module.ts new file mode 100644 index 0000000..f2f1f9e --- /dev/null +++ b/frontend/src/app/admin/admin-routing.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { AdminComponent } from './pages/admin.component'; + +const routes: Routes = [{ path: '', component: AdminComponent }]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class AdminRoutingModule { } diff --git a/frontend/src/app/admin/admin.module.ts b/frontend/src/app/admin/admin.module.ts new file mode 100644 index 0000000..dee6884 --- /dev/null +++ b/frontend/src/app/admin/admin.module.ts @@ -0,0 +1,15 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { AdminRoutingModule } from './admin-routing.module'; + + +@NgModule({ + declarations: [ + ], + imports: [ + CommonModule, + AdminRoutingModule + ] +}) +export class AdminModule { } diff --git a/frontend/src/app/admin/pages/admin.component.html b/frontend/src/app/admin/pages/admin.component.html new file mode 100644 index 0000000..49659db --- /dev/null +++ b/frontend/src/app/admin/pages/admin.component.html @@ -0,0 +1 @@ +

admin works!

diff --git a/frontend/src/app/pages/contact/contact.component.scss b/frontend/src/app/admin/pages/admin.component.scss similarity index 100% rename from frontend/src/app/pages/contact/contact.component.scss rename to frontend/src/app/admin/pages/admin.component.scss diff --git a/frontend/src/app/admin/pages/admin.component.spec.ts b/frontend/src/app/admin/pages/admin.component.spec.ts new file mode 100644 index 0000000..7a449d1 --- /dev/null +++ b/frontend/src/app/admin/pages/admin.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AdminComponent } from './admin.component'; + +describe('AdminComponent', () => { + let component: AdminComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [AdminComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(AdminComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/admin/pages/admin.component.ts b/frontend/src/app/admin/pages/admin.component.ts new file mode 100644 index 0000000..827fc58 --- /dev/null +++ b/frontend/src/app/admin/pages/admin.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-admin', + templateUrl: './admin.component.html', + styleUrls: ['./admin.component.scss'] +}) +export class AdminComponent { + +} diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 1737872..f82f01d 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -1,13 +1,10 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import { HomeComponent } from './pages/home/home.component'; -import { LocationComponent } from './pages/location/location.component'; -import { ContactComponent } from './pages/contact/contact.component'; +import { HomeComponent } from './home/pages/home/home.component'; export const routes: Routes = [ - { path: '', component: HomeComponent }, - { path: 'lokacije', component: LocationComponent }, - { path: 'kontakt', component: ContactComponent }, + { path: '', loadChildren: () => import('./home/home.module').then(m => m.HomeModule) }, + { path: 'dashboard', loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule) }, { path: '**', redirectTo: '' } // Optional: handle unknown routes ]; diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index a535ee7..9004993 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -4,8 +4,8 @@ import { FormsModule } from '@angular/forms'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; -import { LocationComponent } from './pages/location/location.component'; -import { ContactComponent } from './pages/contact/contact.component'; +import { LocationComponent } from './home/pages/location/location.component'; +import { ContactComponent } from './home/pages/contact/contact.component'; @NgModule({ declarations: [AppComponent, LocationComponent, ContactComponent], diff --git a/frontend/src/app/home/home-routing.module.ts b/frontend/src/app/home/home-routing.module.ts new file mode 100644 index 0000000..08fa4d8 --- /dev/null +++ b/frontend/src/app/home/home-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { HomeComponent } from './pages/home/home.component'; +import { LocationComponent } from './pages/location/location.component'; +import { ContactComponent } from './pages/contact/contact.component'; + +const routes: Routes = [ + { path: '', component: HomeComponent }, + { path: 'lokacije', component: LocationComponent }, + { path: 'kontakt', component: ContactComponent } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class HomeRoutingModule {} diff --git a/frontend/src/app/home/home.module.ts b/frontend/src/app/home/home.module.ts new file mode 100644 index 0000000..baecd94 --- /dev/null +++ b/frontend/src/app/home/home.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { HomeRoutingModule } from './home-routing.module'; + +@NgModule({ + declarations: [ + ], + imports: [ + CommonModule, + HomeRoutingModule + ] +}) +export class HomeModule { } diff --git a/frontend/src/app/pages/contact/contact.component.html b/frontend/src/app/home/pages/contact/contact.component.html similarity index 100% rename from frontend/src/app/pages/contact/contact.component.html rename to frontend/src/app/home/pages/contact/contact.component.html diff --git a/frontend/src/app/home/pages/contact/contact.component.scss b/frontend/src/app/home/pages/contact/contact.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/app/pages/contact/contact.component.spec.ts b/frontend/src/app/home/pages/contact/contact.component.spec.ts similarity index 100% rename from frontend/src/app/pages/contact/contact.component.spec.ts rename to frontend/src/app/home/pages/contact/contact.component.spec.ts diff --git a/frontend/src/app/pages/contact/contact.component.ts b/frontend/src/app/home/pages/contact/contact.component.ts similarity index 100% rename from frontend/src/app/pages/contact/contact.component.ts rename to frontend/src/app/home/pages/contact/contact.component.ts diff --git a/frontend/src/app/pages/home/home.component.html b/frontend/src/app/home/pages/home/home.component.html similarity index 100% rename from frontend/src/app/pages/home/home.component.html rename to frontend/src/app/home/pages/home/home.component.html diff --git a/frontend/src/app/pages/home/home.component.scss b/frontend/src/app/home/pages/home/home.component.scss similarity index 100% rename from frontend/src/app/pages/home/home.component.scss rename to frontend/src/app/home/pages/home/home.component.scss diff --git a/frontend/src/app/pages/home/home.component.spec.ts b/frontend/src/app/home/pages/home/home.component.spec.ts similarity index 100% rename from frontend/src/app/pages/home/home.component.spec.ts rename to frontend/src/app/home/pages/home/home.component.spec.ts diff --git a/frontend/src/app/pages/home/home.component.ts b/frontend/src/app/home/pages/home/home.component.ts similarity index 91% rename from frontend/src/app/pages/home/home.component.ts rename to frontend/src/app/home/pages/home/home.component.ts index 105e5d3..a8b1285 100644 --- a/frontend/src/app/pages/home/home.component.ts +++ b/frontend/src/app/home/pages/home/home.component.ts @@ -2,7 +2,6 @@ import { HttpClientModule } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; import { RouterLink } from '@angular/router'; import { ItemListComponent } from 'src/app/components/item-list/item-list.component'; -import { WeatherComponent } from 'src/app/components/weather/weather.component'; import { Location } from 'src/app/shared/models/location.model'; import { LocationService } from 'src/app/shared/services/location.service'; diff --git a/frontend/src/app/pages/location/location.component.html b/frontend/src/app/home/pages/location/location.component.html similarity index 100% rename from frontend/src/app/pages/location/location.component.html rename to frontend/src/app/home/pages/location/location.component.html diff --git a/frontend/src/app/pages/location/location.component.scss b/frontend/src/app/home/pages/location/location.component.scss similarity index 100% rename from frontend/src/app/pages/location/location.component.scss rename to frontend/src/app/home/pages/location/location.component.scss diff --git a/frontend/src/app/pages/location/location.component.spec.ts b/frontend/src/app/home/pages/location/location.component.spec.ts similarity index 100% rename from frontend/src/app/pages/location/location.component.spec.ts rename to frontend/src/app/home/pages/location/location.component.spec.ts diff --git a/frontend/src/app/pages/location/location.component.ts b/frontend/src/app/home/pages/location/location.component.ts similarity index 100% rename from frontend/src/app/pages/location/location.component.ts rename to frontend/src/app/home/pages/location/location.component.ts diff --git a/frontend/tsconfig.app.json b/frontend/tsconfig.app.json index 374cc9d..ecbf741 100644 --- a/frontend/tsconfig.app.json +++ b/frontend/tsconfig.app.json @@ -3,7 +3,8 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/app", - "types": [] + "types": [ + ] }, "files": [ "src/main.ts" diff --git a/frontend/tsconfig.spec.json b/frontend/tsconfig.spec.json index be7e9da..d953340 100644 --- a/frontend/tsconfig.spec.json +++ b/frontend/tsconfig.spec.json @@ -4,7 +4,7 @@ "compilerOptions": { "outDir": "./out-tsc/spec", "types": [ - "jasmine" + "jasmine", ] }, "include": [ From 29abb41ea7d1d42934dbef5dcbf94deef762b7e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarik=20Dedi=C4=87?= Date: Fri, 4 Oct 2024 08:21:25 +0200 Subject: [PATCH 2/9] Adding lazy load admin part, dashboard layout and proper routes --- .../src/app/admin/admin-routing.module.ts | 15 +++- .../dashboard-layout.component.html | 69 +++++++++++++++++ .../dashboard-layout.component.scss} | 0 .../dashboard-layout.component.spec.ts | 23 ++++++ .../dashboard-layout.component.ts | 22 ++++++ .../src/app/admin/pages/admin.component.html | 1 - .../src/app/admin/pages/admin.component.ts | 10 --- .../pages/dashboard/dashboard.component.html | 1 + .../pages/dashboard/dashboard.component.scss | 0 .../dashboard.component.spec.ts} | 10 +-- .../pages/dashboard/dashboard.component.ts | 13 ++++ .../pages/locations/locations.component.html | 1 + .../pages/locations/locations.component.scss | 0 .../locations/locations.component.spec.ts | 23 ++++++ .../pages/locations/locations.component.ts | 15 ++++ .../pages/settings/settings.component.html | 1 + .../pages/settings/settings.component.scss | 0 .../pages/settings/settings.component.spec.ts | 23 ++++++ .../pages/settings/settings.component.ts | 12 +++ frontend/src/app/app-routing.module.ts | 3 +- .../components/footer/footer.component.html | 2 +- .../app/components/footer/footer.component.ts | 14 +++- .../components/navbar/navbar.component.html | 4 +- .../app/components/navbar/navbar.component.ts | 14 +++- .../components/sidebar/sidebar.component.html | 74 +++++++++++++++++++ .../components/sidebar/sidebar.component.scss | 0 .../sidebar/sidebar.component.spec.ts | 23 ++++++ .../components/sidebar/sidebar.component.ts | 16 ++++ .../src/app/home/pages/home/home.component.ts | 2 +- .../src/app/pages/login/login.component.html | 59 +++++++++++++++ .../src/app/pages/login/login.component.scss | 0 .../app/pages/login/login.component.spec.ts | 23 ++++++ .../src/app/pages/login/login.component.ts | 12 +++ 33 files changed, 457 insertions(+), 28 deletions(-) create mode 100644 frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.html rename frontend/src/app/admin/{pages/admin.component.scss => layout/dashboard-layout/dashboard-layout.component.scss} (100%) create mode 100644 frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.spec.ts create mode 100644 frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.ts delete mode 100644 frontend/src/app/admin/pages/admin.component.html delete mode 100644 frontend/src/app/admin/pages/admin.component.ts create mode 100644 frontend/src/app/admin/pages/dashboard/dashboard.component.html create mode 100644 frontend/src/app/admin/pages/dashboard/dashboard.component.scss rename frontend/src/app/admin/pages/{admin.component.spec.ts => dashboard/dashboard.component.spec.ts} (59%) create mode 100644 frontend/src/app/admin/pages/dashboard/dashboard.component.ts create mode 100644 frontend/src/app/admin/pages/locations/locations.component.html create mode 100644 frontend/src/app/admin/pages/locations/locations.component.scss create mode 100644 frontend/src/app/admin/pages/locations/locations.component.spec.ts create mode 100644 frontend/src/app/admin/pages/locations/locations.component.ts create mode 100644 frontend/src/app/admin/pages/settings/settings.component.html create mode 100644 frontend/src/app/admin/pages/settings/settings.component.scss create mode 100644 frontend/src/app/admin/pages/settings/settings.component.spec.ts create mode 100644 frontend/src/app/admin/pages/settings/settings.component.ts create mode 100644 frontend/src/app/components/sidebar/sidebar.component.html create mode 100644 frontend/src/app/components/sidebar/sidebar.component.scss create mode 100644 frontend/src/app/components/sidebar/sidebar.component.spec.ts create mode 100644 frontend/src/app/components/sidebar/sidebar.component.ts create mode 100644 frontend/src/app/pages/login/login.component.html create mode 100644 frontend/src/app/pages/login/login.component.scss create mode 100644 frontend/src/app/pages/login/login.component.spec.ts create mode 100644 frontend/src/app/pages/login/login.component.ts diff --git a/frontend/src/app/admin/admin-routing.module.ts b/frontend/src/app/admin/admin-routing.module.ts index f2f1f9e..d489c1f 100644 --- a/frontend/src/app/admin/admin-routing.module.ts +++ b/frontend/src/app/admin/admin-routing.module.ts @@ -1,8 +1,19 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import { AdminComponent } from './pages/admin.component'; +import { DashboardLayoutComponent } from './layout/dashboard-layout/dashboard-layout.component'; +import { LocationsComponent } from './pages/locations/locations.component'; +import { DashboardComponent } from './pages/dashboard/dashboard.component'; +import { SettingsComponent } from './pages/settings/settings.component'; -const routes: Routes = [{ path: '', component: AdminComponent }]; +const routes: Routes = [ + { path: '', component: DashboardLayoutComponent, children: [ + { path: '', redirectTo: 'home', pathMatch: 'full' }, // Redirect to dashboard + { path: 'home', component: DashboardComponent }, + { path: 'lokacije', component: LocationsComponent }, + { path: 'postavke', component: SettingsComponent }, +]}, +{ path: '**', redirectTo: '/dashboard/home' } // Redirect unknown routes to home +]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.html b/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.html new file mode 100644 index 0000000..3a4f031 --- /dev/null +++ b/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.html @@ -0,0 +1,69 @@ +
+ + + + +
+
+
+ + +
+ + + +
+ + +
+ +
+
+ +
\ No newline at end of file diff --git a/frontend/src/app/admin/pages/admin.component.scss b/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.scss similarity index 100% rename from frontend/src/app/admin/pages/admin.component.scss rename to frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.scss diff --git a/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.spec.ts b/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.spec.ts new file mode 100644 index 0000000..5560bd1 --- /dev/null +++ b/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DashboardLayoutComponent } from './dashboard-layout.component'; + +describe('DashboardLayoutComponent', () => { + let component: DashboardLayoutComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [DashboardLayoutComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(DashboardLayoutComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.ts b/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.ts new file mode 100644 index 0000000..c6b0d3a --- /dev/null +++ b/frontend/src/app/admin/layout/dashboard-layout/dashboard-layout.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit } from '@angular/core'; +import { RouterLink, RouterOutlet } from '@angular/router'; +import { Router, NavigationEnd } from '@angular/router'; + +@Component({ + selector: 'app-dashboard-layout', + standalone: true, + imports: [RouterOutlet, RouterLink], + templateUrl: './dashboard-layout.component.html', + styleUrls: ['./dashboard-layout.component.scss'], +}) +export class DashboardLayoutComponent implements OnInit { + constructor(private router: Router) {} + + ngOnInit() { + this.router.events.subscribe((event) => { + if (event instanceof NavigationEnd) { + console.log('Navigated to:', event.url); + } + }); + } +} diff --git a/frontend/src/app/admin/pages/admin.component.html b/frontend/src/app/admin/pages/admin.component.html deleted file mode 100644 index 49659db..0000000 --- a/frontend/src/app/admin/pages/admin.component.html +++ /dev/null @@ -1 +0,0 @@ -

admin works!

diff --git a/frontend/src/app/admin/pages/admin.component.ts b/frontend/src/app/admin/pages/admin.component.ts deleted file mode 100644 index 827fc58..0000000 --- a/frontend/src/app/admin/pages/admin.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-admin', - templateUrl: './admin.component.html', - styleUrls: ['./admin.component.scss'] -}) -export class AdminComponent { - -} diff --git a/frontend/src/app/admin/pages/dashboard/dashboard.component.html b/frontend/src/app/admin/pages/dashboard/dashboard.component.html new file mode 100644 index 0000000..f690d26 --- /dev/null +++ b/frontend/src/app/admin/pages/dashboard/dashboard.component.html @@ -0,0 +1 @@ +Dashboard \ No newline at end of file diff --git a/frontend/src/app/admin/pages/dashboard/dashboard.component.scss b/frontend/src/app/admin/pages/dashboard/dashboard.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/app/admin/pages/admin.component.spec.ts b/frontend/src/app/admin/pages/dashboard/dashboard.component.spec.ts similarity index 59% rename from frontend/src/app/admin/pages/admin.component.spec.ts rename to frontend/src/app/admin/pages/dashboard/dashboard.component.spec.ts index 7a449d1..ae4f8b6 100644 --- a/frontend/src/app/admin/pages/admin.component.spec.ts +++ b/frontend/src/app/admin/pages/dashboard/dashboard.component.spec.ts @@ -1,18 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AdminComponent } from './admin.component'; +import { DashboardComponent } from './dashboard.component'; describe('AdminComponent', () => { - let component: AdminComponent; - let fixture: ComponentFixture; + let component: DashboardComponent; + let fixture: ComponentFixture; beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [AdminComponent] + declarations: [DashboardComponent] }) .compileComponents(); - fixture = TestBed.createComponent(AdminComponent); + fixture = TestBed.createComponent(DashboardComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/frontend/src/app/admin/pages/dashboard/dashboard.component.ts b/frontend/src/app/admin/pages/dashboard/dashboard.component.ts new file mode 100644 index 0000000..45292f4 --- /dev/null +++ b/frontend/src/app/admin/pages/dashboard/dashboard.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; +import { SidebarComponent } from 'src/app/components/sidebar/sidebar.component'; + +@Component({ + selector: 'app-dashboard', + standalone: true, + imports: [SidebarComponent], + templateUrl: './dashboard.component.html', + styleUrls: ['./dashboard.component.scss'] +}) +export class DashboardComponent { + +} diff --git a/frontend/src/app/admin/pages/locations/locations.component.html b/frontend/src/app/admin/pages/locations/locations.component.html new file mode 100644 index 0000000..50b6083 --- /dev/null +++ b/frontend/src/app/admin/pages/locations/locations.component.html @@ -0,0 +1 @@ +

Lokacije

\ No newline at end of file diff --git a/frontend/src/app/admin/pages/locations/locations.component.scss b/frontend/src/app/admin/pages/locations/locations.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/app/admin/pages/locations/locations.component.spec.ts b/frontend/src/app/admin/pages/locations/locations.component.spec.ts new file mode 100644 index 0000000..3714ff2 --- /dev/null +++ b/frontend/src/app/admin/pages/locations/locations.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LocationsComponent } from './locations.component'; + +describe('LocationsComponent', () => { + let component: LocationsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [LocationsComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(LocationsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/admin/pages/locations/locations.component.ts b/frontend/src/app/admin/pages/locations/locations.component.ts new file mode 100644 index 0000000..68a77ca --- /dev/null +++ b/frontend/src/app/admin/pages/locations/locations.component.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; +import { RouterLink } from '@angular/router'; + +@Component({ + selector: 'app-locations', + standalone: true, + imports: [RouterLink], + templateUrl: './locations.component.html', + styleUrls: ['./locations.component.scss'] +}) +export class LocationsComponent { + onClick() { + console.log('Link clicked!'); + } +} diff --git a/frontend/src/app/admin/pages/settings/settings.component.html b/frontend/src/app/admin/pages/settings/settings.component.html new file mode 100644 index 0000000..6571391 --- /dev/null +++ b/frontend/src/app/admin/pages/settings/settings.component.html @@ -0,0 +1 @@ +

Postavke

diff --git a/frontend/src/app/admin/pages/settings/settings.component.scss b/frontend/src/app/admin/pages/settings/settings.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/app/admin/pages/settings/settings.component.spec.ts b/frontend/src/app/admin/pages/settings/settings.component.spec.ts new file mode 100644 index 0000000..82c748a --- /dev/null +++ b/frontend/src/app/admin/pages/settings/settings.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SettingsComponent } from './settings.component'; + +describe('SettingsComponent', () => { + let component: SettingsComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [SettingsComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SettingsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/admin/pages/settings/settings.component.ts b/frontend/src/app/admin/pages/settings/settings.component.ts new file mode 100644 index 0000000..7f3364e --- /dev/null +++ b/frontend/src/app/admin/pages/settings/settings.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-settings', + standalone: true, + imports: [], + templateUrl: './settings.component.html', + styleUrls: ['./settings.component.scss'] +}) +export class SettingsComponent { + +} diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index f82f01d..fb1fcca 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -1,8 +1,9 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import { HomeComponent } from './home/pages/home/home.component'; +import { LoginComponent } from './pages/login/login.component'; export const routes: Routes = [ + { path: 'prijava', component: LoginComponent }, { path: '', loadChildren: () => import('./home/home.module').then(m => m.HomeModule) }, { path: 'dashboard', loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule) }, { path: '**', redirectTo: '' } // Optional: handle unknown routes diff --git a/frontend/src/app/components/footer/footer.component.html b/frontend/src/app/components/footer/footer.component.html index 2f29401..2e95123 100644 --- a/frontend/src/app/components/footer/footer.component.html +++ b/frontend/src/app/components/footer/footer.component.html @@ -1,4 +1,4 @@ -