Skip to content

Commit

Permalink
Merge pull request #51 from amosproj/feat/xd-47
Browse files Browse the repository at this point in the history
feat: Add Navigation/Routing(XD-47)
  • Loading branch information
IngoSternberg authored May 10, 2024
2 parents 407c878 + 2ce7883 commit 24ed79d
Show file tree
Hide file tree
Showing 66 changed files with 15,503 additions and 19,459 deletions.
113 changes: 81 additions & 32 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx", "simple-import-sort"],
"plugins": ["@nx", "simple-import-sort", "@stylistic/js"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@stylistic/js/array-bracket-spacing": ["warn", "always"],
"no-console": "error",
"@nx/enforce-module-boundaries": [
"error",
Expand All @@ -14,41 +15,56 @@
"allow": [],
"depConstraints": [
{
"sourceTag": "type:app",
"sourceTag": "type:app",
"onlyDependOnLibsWithTags": ["*"]
},
{
"sourceTag": "type:feature",
"onlyDependOnLibsWithTags": ["type:models", "type:feature"]
},
{
"sourceTag": "type:util",
"onlyDependOnLibsWithTags": ["type:models", "type:util"]
},
{
"sourceTag": "type:models",
"onlyDependOnLibsWithTags": ["type:models"]

},
{
"sourceTag": "domain:common",
"onlyDependOnLibsWithTags": ["domain:common"]
},
{
"sourceTag": "tier:backend",
"onlyDependOnLibsWithTags": ["tier:backend", "tier:common"]
},
{
"sourceTag": "tier:frontend",
"onlyDependOnLibsWithTags": ["tier:frontend", "tier:common"]
},
{
"sourceTag": "tier:common",
"onlyDependOnLibsWithTags": ["tier:common"]
},
{
"sourceTag": "type:shell",
"onlyDependOnLibsWithTags": [
"type:shell",
"type:feature",
"type:util",
"type:models"
]
},
{
"sourceTag": "type:feature",
"onlyDependOnLibsWithTags": ["type:models", "type:feature"]
},
{
"sourceTag": "type:util",
"onlyDependOnLibsWithTags": ["type:models", "type:util"]
},
{
"sourceTag": "type:models",
"onlyDependOnLibsWithTags": ["type:models"]
},
{
"sourceTag": "domain:orders",
"onlyDependOnLibsWithTags": ["domain:orders", "domain:orders"]
},
{
"sourceTag": "domain:facilities",
"onlyDependOnLibsWithTags": ["domain:facilities", "domain:common"]
},
{
"sourceTag": "domain:common",
"onlyDependOnLibsWithTags": ["domain:common"]
},
{
"sourceTag": "tier:backend",
"onlyDependOnLibsWithTags": ["tier:backend", "tier:common"]
},
{
"sourceTag": "tier:frontend",
"onlyDependOnLibsWithTags": ["tier:frontend", "tier:common"]
},
{
"sourceTag": "tier:common",
"onlyDependOnLibsWithTags": ["tier:common"]
}
]
}

]
}
},
Expand Down Expand Up @@ -76,6 +92,39 @@
"jest": true
},
"rules": {}
},
{
"files": ["*.component.ts", "*.layout.ts", "*.page.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@angular-eslint/component-class-suffix": [
"error",
{
"suffixes": ["Component", "Page", "Layout"]
}
],
"@angular-eslint/no-host-metadata-property": "off"
}
}
]
}
3 changes: 3 additions & 0 deletions apps/backend-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"passWithNoTests": true
},
"dependsOn": ["backend:build"]
},
"lint": {
"executor": "@nx/eslint:lint"
}
}
}
61 changes: 32 additions & 29 deletions apps/backend/project.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
{
"name": "backend",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/backend/src",
"projectType": "application",
"tags": ["tier:backend", "type:app"],
"targets": {
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "backend:build"
},
"configurations": {
"development": {
"buildTarget": "backend:build:development"
},
"production": {
"buildTarget": "backend:build:production"
}
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/backend/jest.config.ts"
}
}
}
"name": "backend",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/backend/src",
"projectType": "application",
"tags": ["tier:backend", "type:app"],
"targets": {
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "backend:build"
},
"configurations": {
"development": {
"buildTarget": "backend:build:development"
},
"production": {
"buildTarget": "backend:build:production"
}
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/backend/jest.config.ts"
}
},
"lint": {
"executor": "@nx/eslint:lint"
}
}
}
6 changes: 5 additions & 1 deletion apps/frontend-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
"sourceRoot": "apps/frontend-e2e/src",
"implicitDependencies": ["frontend"],
"// targets": "to see all targets run: nx show project frontend-e2e --web",
"targets": {}
"targets": {
"lint": {
"executor": "@nx/eslint:lint"
}
}
}
26 changes: 0 additions & 26 deletions apps/frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,6 @@
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
Expand Down
8 changes: 4 additions & 4 deletions apps/frontend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumWarning": "5mb",
"maximumError": "10mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
"maximumWarning": "400kb",
"maximumError": "800kb"
}
],
"outputHashing": "all",
Expand Down
17 changes: 1 addition & 16 deletions apps/frontend/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,16 +1 @@
<ix-application>
<ix-application-header name="My Application">
<div class="placeholder-logo" slot="logo"></div>
</ix-application-header>
<ix-menu>
<ix-menu-item>Item 1</ix-menu-item>
<ix-menu-item>Item 2</ix-menu-item>
</ix-menu>
<ix-content>
<ix-content-header slot="header" header-title="My Content Page"> </ix-content-header>
<div class="text-4xl">This text ist big because of a tailwind class</div>
<div class="bg-custom-pink">The background is pink because of a custom color</div>
<div class="test-custom-class">This text is centered because of a custom class</div>
<router-outlet></router-outlet>
</ix-content>
</ix-application>
<router-outlet></router-outlet>
18 changes: 11 additions & 7 deletions apps/frontend/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AppComponent } from './app.component';

describe('AppComponent', () => {
let component: AppComponent;
let fixture: ComponentFixture<AppComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent, RouterTestingModule],
imports: [AppComponent],
}).compileComponents();

fixture = TestBed.createComponent(AppComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it(`should have as title 'frontend'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('frontend');
it('should create the app', () => {
expect(component).toBeTruthy();
});
});
3 changes: 1 addition & 2 deletions apps/frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
import { IxModule } from '@siemens/ix-angular';

@Component({
standalone: true,
imports: [RouterModule, IxModule],
imports: [RouterModule],
selector: 'app-root',
templateUrl: './app.component.html',
styleUrl: './app.component.scss',
Expand Down
9 changes: 6 additions & 3 deletions apps/frontend/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { ApplicationConfig, importProvidersFrom } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideRouter, withComponentInputBinding } from '@angular/router';
import { IxModule } from '@siemens/ix-angular';

import { appRoutes } from './app.routes';
import { APP_ROUTES } from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [provideRouter(appRoutes), importProvidersFrom(IxModule.forRoot())],
providers: [
provideRouter(APP_ROUTES, withComponentInputBinding()),
importProvidersFrom(IxModule.forRoot()),
],
};
42 changes: 41 additions & 1 deletion apps/frontend/src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
import { Route } from '@angular/router';

export const appRoutes: Route[] = [];
import { AppRootLayout } from './layouts/root.layout';

export const APP_ROUTES: Route[] = [
{
path: '',
component: AppRootLayout,
data: {
breadcrumbs: {
label: 'Home',
url: '/',
},
},
children: [
{
path: 'facilities',
data: {
breadcrumbs: {
label: 'Facilities',
url: 'facilities',
},
},
loadChildren: () =>
import('facilities-frontend-shell').then((m) => m.FACILITIES_SHELL_ROUTES),
},
{
path: 'orders',
loadChildren: () =>
import('orders-frontend-shell').then((m) => m.ORDERS_SHELL_ROUTES),
},
],
},
{
path: 'not-found',
loadComponent: () =>
import('./pages/not-found/not-found.component').then((m) => m.NotFoundComponent),
},
{
path: '**',
redirectTo: 'not-found',
},
];
Loading

0 comments on commit 24ed79d

Please sign in to comment.