Skip to content

Commit 4213d2d

Browse files
Merge pull request #43 from COS301-SE-2023/feat/auth
Auth Feature for Demo One
2 parents 6bb7e10 + 3c7fb6a commit 4213d2d

35 files changed

+626
-14
lines changed

apps/app/src/assets/Logo.png

8.45 KB
Loading

libs/app/core/src/core.module.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ import { NxWelcomeComponent } from "./nx-welcome.component";
55
import { CoreRouting } from "./core.routing";
66
import { IonicModule, IonicRouteStrategy } from "@ionic/angular";
77
import { RouteReuseStrategy } from "@angular/router";
8-
import {TabbedComponent} from "./tabbed-component/tabbed-component";
9-
import {NzStepsModule} from "ng-zorro-antd/steps";
10-
import {NzFormModule} from "ng-zorro-antd/form";
11-
import {NzIconModule} from "ng-zorro-antd/icon";
8+
import { LoginModule } from '@fridge-to-plate/app/login/feature';
9+
import { TabbedComponent } from "./tabbed-component/tabbed-component";
10+
import { NzStepsModule } from "ng-zorro-antd/steps";
11+
import { NzFormModule } from "ng-zorro-antd/form";
12+
import { NzIconModule } from "ng-zorro-antd/icon";
1213
import { ReactiveFormsModule } from "@angular/forms";
1314

1415
@NgModule({
1516
declarations: [CoreShell, NxWelcomeComponent, TabbedComponent],
1617
imports: [
1718
BrowserModule,
19+
LoginModule,
1820
CoreRouting,
1921
ReactiveFormsModule,
2022
IonicModule.forRoot(),

libs/app/core/src/core.routing.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,21 @@ const routes: Routes = [
1212
path: 'recommendations',
1313
loadChildren: () => import('@fridge-to-plate/app/recipe-recommendation').then((m) => m.AppRecipeRecommendationModule),
1414
},
15+
{
16+
path: 'login',
17+
loadChildren: () => import('@fridge-to-plate/app/login/feature').then((m) => m.LoginModule),
18+
},
19+
{
20+
path: 'signup',
21+
loadChildren: () => import('@fridge-to-plate/app/signup/feature').then((m) => m.SignupModule),
22+
},
1523
{
1624
path: 'profile',
1725
loadChildren: () => import('@fridge-to-plate/app/profile/feature').then((m) => m.ProfileModule),
1826
},
1927
{
2028
path: 'create',
21-
loadChildren: () =>
22-
import('@fridge-to-plate/app/create/feature').then((m) => m.CreateModule),
29+
loadChildren: () => import('@fridge-to-plate/app/create/feature').then((m) => m.CreateModule),
2330
},
2431
];
2532

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"extends": ["../../../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"rules": {
8+
"@angular-eslint/directive-selector": [
9+
"error",
10+
{
11+
"type": "attribute",
12+
"prefix": "fridgeToPlate",
13+
"style": "camelCase"
14+
}
15+
],
16+
"@angular-eslint/component-selector": [
17+
"error",
18+
{
19+
"type": "element",
20+
"prefix": "fridge-to-plate",
21+
"style": "kebab-case"
22+
}
23+
]
24+
},
25+
"extends": [
26+
"plugin:@nx/angular",
27+
"plugin:@angular-eslint/template/process-inline-templates"
28+
]
29+
},
30+
{
31+
"files": ["*.html"],
32+
"extends": ["plugin:@nx/angular-template"],
33+
"rules": {}
34+
}
35+
]
36+
}

libs/app/login/feature/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# app-login-feature
2+
3+
This library was generated with [Nx](https://nx.dev).
4+
5+
## Running unit tests
6+
7+
Run `nx test app-login-feature` to execute the unit tests.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* eslint-disable */
2+
export default {
3+
displayName: 'app-login-feature',
4+
preset: '../../../../jest.preset.js',
5+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
6+
coverageDirectory: '../../../../coverage/libs/app/login/feature',
7+
transform: {
8+
'^.+\\.(ts|mjs|js|html)$': [
9+
'jest-preset-angular',
10+
{
11+
tsconfig: '<rootDir>/tsconfig.spec.json',
12+
stringifyContentPathRegex: '\\.(html|svg)$',
13+
},
14+
],
15+
},
16+
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
17+
snapshotSerializers: [
18+
'jest-preset-angular/build/serializers/no-ng-attributes',
19+
'jest-preset-angular/build/serializers/ng-snapshot',
20+
'jest-preset-angular/build/serializers/html-comment',
21+
],
22+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "app-login-feature",
3+
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "libs/app/login/feature/src",
5+
"prefix": "fridge-to-plate",
6+
"tags": [],
7+
"projectType": "library",
8+
"targets": {
9+
"test": {
10+
"executor": "@nx/jest:jest",
11+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
12+
"options": {
13+
"jestConfig": "libs/app/login/feature/jest.config.ts",
14+
"passWithNoTests": true
15+
},
16+
"configurations": {
17+
"ci": {
18+
"ci": true,
19+
"codeCoverage": true
20+
}
21+
}
22+
},
23+
"lint": {
24+
"executor": "@nx/linter:eslint",
25+
"outputs": ["{options.outputFile}"],
26+
"options": {
27+
"lintFilePatterns": [
28+
"libs/app/login/feature/**/*.ts",
29+
"libs/app/login/feature/**/*.html"
30+
]
31+
}
32+
}
33+
}
34+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './login.module';
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { NgModule } from '@angular/core';
2+
import { IonicModule } from '@ionic/angular';
3+
import { CommonModule } from '@angular/common';
4+
import { LoginPage } from './login.page';
5+
import { LoginRouting } from './login.routing';
6+
7+
@NgModule({
8+
imports: [
9+
CommonModule,
10+
LoginRouting,
11+
IonicModule,
12+
],
13+
declarations: [LoginPage],
14+
})
15+
export class LoginModule {}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<ion-content>
2+
3+
<!-- <div class="container">
4+
<h1 class="header">Hey, <br> Welcome Back.</h1>
5+
<div class="text">
6+
<p>Do not have an account? <a href="Create-Page">Create</a></p>
7+
</div>
8+
<div class="input-container">
9+
<input type="text" placeholder="Username">
10+
<input type="password" placeholder="Password">
11+
</div>
12+
<div class="text">
13+
<p>Forgot Password? <a href="Forgot-Page">Reset</a></p>
14+
</div>
15+
<button class="login-button">Login</button>
16+
<div class="text">
17+
<p><a href="Create-Recipe-Page">Continue as guest</a></p>
18+
</div>
19+
</div> -->
20+
21+
<div class="flex flex-col justify-center min-h-screen px-10 text-left ">
22+
23+
<img class="content-end" src="/apps/app/src/assets/Logo.png" alt="Errors">
24+
25+
<h1 class="text-3xl md:text-5xl text-left mb-4 font-extrabold bg-dark">Hey, <br> Welcome Back.</h1>
26+
27+
<div class="text-left mb-6 py-1 grid grid-flow-col auto-cols-auto space-x-20 inline-block">
28+
<p class="text-sm md:text-base text-gray-500 py-1">Do not have an account? </p> <a href="#" (click)="create()" class="text-black text-sm md:text-base py-1">Create</a>
29+
</div>
30+
<div class="w-full max-w-lg py-1 space-y-6 place-content-center">
31+
<input type="text" placeholder="Username" class="mb-4 p-3 w-full border bg-gray-200 border-gray-300 rounded-md text-base text-neutral-950 py-1 ">
32+
<input type="password" placeholder="Password" class="mb-4 p-3 w-full border bg-gray-200 border-gray-300 rounded-md text-base text-neutral-950 py-1">
33+
</div>
34+
<div class="text-left mb-4 py-1 grid grid-flow-col auto-cols-auto space-x-20 inline-grid">
35+
36+
<p class="text-sm md:text-base text-gray-500 py-1 pt-4 inline">Forgot Password? </p>
37+
<a href="#" (click)="reset()" class="text-black text-sm md:text-base py-1 pt-4">Reset</a>
38+
39+
</div>
40+
<button (click)="login()" class="bg-primary text-white py-3 px-6 rounded-md text-base w-full mb-4 max-w-lg">Login</button>
41+
<div class="text-center py-4">
42+
<p><a href="#" (click)="guest()" class="text-gray-500 ">Continue as guest</a></p>
43+
</div>
44+
45+
</div>
46+
47+
</ion-content>

0 commit comments

Comments
 (0)