Skip to content

Commit

Permalink
feat(apps): create the code of conduct frontend application
Browse files Browse the repository at this point in the history
Create the initial code of conduct frontend
  • Loading branch information
josephperrott committed Apr 21, 2023
1 parent 3f26e9e commit 2960641
Show file tree
Hide file tree
Showing 45 changed files with 1,211 additions and 205 deletions.
104 changes: 0 additions & 104 deletions angular.json

This file was deleted.

14 changes: 13 additions & 1 deletion apps/.firebaserc
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
{}
{
"projects": {},
"targets": {
"internal-200822": {
"hosting": {
"code-of-conduct": [
"code-of-conduct"
]
}
}
},
"etags": {}
}
2 changes: 2 additions & 0 deletions apps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin", "nodejs_binary")
copy_to_bin(
name = "static_runfiles",
srcs = [
".firebaserc",
"firebase.json",
"firestore.indexes.json",
"firestore.rules",
Expand All @@ -19,6 +20,7 @@ nodejs_binary(
# Firebase function files
"//apps/functions:functions_compiled",
"//apps/functions:functions_files",
"//apps/code-of-conduct:application_files",
],
entry_point = "@npm//:node_modules/firebase-tools/lib/bin/firebase.js",
templated_args = [
Expand Down
80 changes: 80 additions & 0 deletions apps/code-of-conduct/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
load("//tools:defaults.bzl", "esbuild", "esbuild_config", "ng_module")
load("@io_bazel_rules_sass//:defs.bzl", "npm_sass_library", "sass_binary")
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin")

package(default_visibility = ["//apps/code-of-conduct:__subpackages__"])

ng_module(
name = "main",
srcs = [
"environment.ts",
"main.ts",
],
deps = [
"//apps/code-of-conduct/app",
"//apps/code-of-conduct/app:app_routes",
"@npm//@angular/common",
"@npm//@angular/compiler",
"@npm//@angular/fire",
"@npm//@angular/material",
"@npm//@angular/platform-browser",
"@npm//@angular/router",
"@npm//zone.js",
],
)

npm_sass_library(
name = "angular_material_sass_deps",
deps = ["@npm//@angular/material"],
)

sass_binary(
name = "styles",
src = "styles.scss",
include_paths = [
"external/npm/node_modules",
],
deps = [
":angular_material_sass_deps",
],
)

esbuild_config(
name = "esbuild_config",
config_file = "esbuild.config.mjs",
deps = [
"//shared-scripts/angular-optimization:js_lib",
"@npm//@angular/compiler-cli",
],
)

esbuild(
name = "bundles",
config = ":esbuild_config",
entry_points = [":main.ts"],
platform = "browser",
target = "es2016",
deps = [
":main",
],
)

copy_to_bin(
name = "application_files_in_bin",
srcs = [
"favicon.ico",
"index.html",
"robots.txt",
],
)

filegroup(
name = "application_files",
srcs = [
":application_files_in_bin",
":bundles",
":styles",
"@npm//:node_modules/zone.js/dist/zone.js",
],
visibility = ["//apps:__pkg__"],
)
57 changes: 57 additions & 0 deletions apps/code-of-conduct/app/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
load("//tools:defaults.bzl", "ng_module")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")

package(default_visibility = ["//apps/code-of-conduct:__subpackages__"])

exports_files(glob(["*"]))

ng_module(
name = "app",
srcs = [
"app.component.ts",
],
assets = [
":app.component.css",
"app.component.html",
],
deps = [
"//apps/shared/account",
"//apps/code-of-conduct/app/block-user",
"//apps/code-of-conduct/app/user-table",
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@angular/router",
],
)

sass_binary(
name = "app-style",
src = "app.component.scss",
)

ng_module(
name = "block_service",
srcs = [
"block.service.ts",
],
deps = [
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@angular/fire",
"@npm//@angular/material",
"@npm//rxjs",
],
)

ng_module(
name = "app_routes",
srcs = [
"app.routes.ts",
],
deps = [
"//apps/shared/account",
"//apps/code-of-conduct/app/login",
"//apps/code-of-conduct/app/main",
"@npm//@angular/router",
],
)
6 changes: 6 additions & 0 deletions apps/code-of-conduct/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<mat-toolbar class="app-header-bar" color="primary">
<a routerLink='/' class="title">Code of Conduct</a>
<span class="spacer"></span>
<account-menu-button></account-menu-button>
</mat-toolbar>
<router-outlet></router-outlet>
19 changes: 19 additions & 0 deletions apps/code-of-conduct/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
block-user {
margin: 15px auto;
}

.app-header-bar {
position: sticky;
top: 0;
z-index: 1;

a {
text-decoration: none;
color: inherit;
font-size: 1.5em;
}

.spacer {
flex: 1;
}
}
21 changes: 21 additions & 0 deletions apps/code-of-conduct/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {Component} from '@angular/core';
import {MatToolbarModule} from '@angular/material/toolbar';
import {RouterModule} from '@angular/router';
import {AccountComponent} from '../../shared/account/account.component.js';
import {BlockUserComponent} from './block-user/block-user.component.js';
import {UserTableComponent} from './user-table/user-table.component.js';

@Component({
standalone: true,
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
imports: [
MatToolbarModule,
RouterModule,
BlockUserComponent,
AccountComponent,
UserTableComponent,
],
})
export class AppComponent {}
14 changes: 14 additions & 0 deletions apps/code-of-conduct/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {Routes} from '@angular/router';
import {isLoggedInGuard} from '../../shared/account/account.guard.js';

export const routes: Routes = [
{
path: 'login',
loadComponent: () => import('./login/login.component.js').then((m) => m.LoginComponent),
},
{
path: '',
canActivate: [isLoggedInGuard],
loadComponent: () => import('./main/main.component.js').then((m) => m.MainComponent),
},
];
26 changes: 26 additions & 0 deletions apps/code-of-conduct/app/block-user/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
load("//tools:defaults.bzl", "ng_module")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")

package(default_visibility = ["//apps/code-of-conduct:__subpackages__"])

ng_module(
name = "block-user",
srcs = glob(["*.ts"]),
assets = [
":block-user.component.css",
":block-user.component.html",
],
deps = [
"//apps/code-of-conduct/app:block_service",
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@angular/fire",
"@npm//@angular/forms",
"@npm//@angular/material",
],
)

sass_binary(
name = "block-user-style",
src = "block-user.component.scss",
)
Loading

0 comments on commit 2960641

Please sign in to comment.