Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Angular Material #42

Merged
merged 9 commits into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions apps/cli-gui/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<ng-container *ngIf="core.coreState$ | async as coreState">
<header class="main-header">
<div class="project-selector">
<select name="project-selector" id="project-selector">
<option *ngFor="let project of coreState.projectNames" value="project">
<mat-select name="project-selector" id="project-selector">
<mat-option
*ngFor="let project of coreState.projectNames"
[value]="project"
>
{{ project }}
</option>
</select>
</mat-option>
</mat-select>
</div>
</header>
<main>
Expand Down
3 changes: 2 additions & 1 deletion apps/cli-gui/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { AsyncPipe, NgFor, NgIf } from '@angular/common';
import { Component } from '@angular/core';
import { MatSelectModule } from '@angular/material/select';
import { RouterOutlet } from '@angular/router';

import { CoreService } from './core/core.service';

@Component({
standalone: true,
imports: [NgFor, NgIf, AsyncPipe, RouterOutlet],
imports: [NgFor, NgIf, AsyncPipe, RouterOutlet, MatSelectModule],
selector: 'cli-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
Expand Down
11 changes: 10 additions & 1 deletion apps/cli-gui/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
</head>
<body>
<body class="mat-typography">
<cli-root></cli-root>
</body>
</html>
22 changes: 4 additions & 18 deletions apps/cli-gui/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
import { HttpClient, provideHttpClient } from '@angular/common/http';
import { APP_INITIALIZER } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { importProvidersFrom } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {
provideRouter,
withEnabledBlockingInitialNavigation,
} from '@angular/router';
import { map } from 'rxjs';

import { AppComponent } from './app/app.component';
import { appRoutes } from './app/app.routes';
import { CoreService } from './app/core/core.service';

bootstrapApplication(AppComponent, {
providers: [
provideRouter(appRoutes, withEnabledBlockingInitialNavigation()),
provideHttpClient(),
{
provide: APP_INITIALIZER,
useFactory: (http: HttpClient, core: CoreService) => () =>
http.get<string[]>(`/api/workspace`).pipe(
map((projectNames) =>
core.update({
projectNames,
currentProjectName: projectNames?.[0],
})
)
),
deps: [HttpClient, CoreService],
multi: true,
},
importProvidersFrom(BrowserAnimationsModule),
Danieliverant marked this conversation as resolved.
Show resolved Hide resolved
],
}).catch((err) => console.error(err));
9 changes: 9 additions & 0 deletions apps/cli-gui/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
/* You can add global styles to this file, and also import other style files */

html,
body {
height: 100%;
}
body {
margin: 0;
font-family: Roboto, 'Helvetica Neue', sans-serif;
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
"dependencies": {
"@angular-devkit/core": "~15.1.0",
"@angular/animations": "~15.1.0",
"@angular/cdk": "^15.1.5",
Danieliverant marked this conversation as resolved.
Show resolved Hide resolved
"@angular/common": "~15.1.0",
"@angular/compiler": "~15.1.0",
"@angular/core": "~15.1.0",
"@angular/forms": "~15.1.0",
"@angular/material": "^15.1.5",
Danieliverant marked this conversation as resolved.
Show resolved Hide resolved
"@angular/platform-browser": "~15.1.0",
"@angular/platform-browser-dynamic": "~15.1.0",
"@angular/router": "~15.1.0",
Expand Down Expand Up @@ -50,7 +52,6 @@
"@nestjs/schematics": "^9.0.0",
"@nestjs/testing": "^9.0.0",
"@nrwl/angular": "15.7.2",
"@nrwl/eslint-plugin-nx": "15.7.2",
Danieliverant marked this conversation as resolved.
Show resolved Hide resolved
"@nrwl/devkit": "^15.7.2",
"@nrwl/jest": "15.7.2",
"@nrwl/linter": "15.7.2",
Expand All @@ -66,7 +67,6 @@
"eslint": "~8.15.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-unused-imports": "^2.0.0",
Danieliverant marked this conversation as resolved.
Show resolved Hide resolved
"eslint-plugin-prettier": "^4.2.1",
"git-cz": "^4.9.0",
"husky": "^8.0.3",
Expand Down
Loading