first commit

This commit is contained in:
Maxime Jeannin 2025-09-25 21:47:19 +02:00
commit 9d57a682cd
64 changed files with 11677 additions and 0 deletions

17
.editorconfig Normal file
View File

@ -0,0 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.ts]
quote_type = single
ij_typescript_use_double_quotes = false
[*.md]
max_line_length = off
trim_trailing_whitespace = false

42
.gitignore vendored Normal file
View File

@ -0,0 +1,42 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
# Compiled output
/dist
/tmp
/out-tsc
/bazel-out
# Node
/node_modules
npm-debug.log
yarn-error.log
# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
# System files
.DS_Store
Thumbs.db

5
.postcssrc.json Normal file
View File

@ -0,0 +1,5 @@
{
"plugins": {
"@tailwindcss/postcss": {}
}
}

4
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}

20
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
}
]
}

42
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,42 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}

59
README.md Normal file
View File

@ -0,0 +1,59 @@
# TpAngularFinal
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.1.3.
## Development server
To start a local development server, run:
```bash
ng serve
```
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
## Code scaffolding
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
```bash
ng generate component component-name
```
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
```bash
ng generate --help
```
## Building
To build the project run:
```bash
ng build
```
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
## Running unit tests
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
```bash
ng test
```
## Running end-to-end tests
For end-to-end (e2e) testing, run:
```bash
ng e2e
```
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
## Additional Resources
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.

85
angular.json Normal file
View File

@ -0,0 +1,85 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"tpAngularFinal": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular/build:application",
"options": {
"browser": "src/main.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "4kB",
"maximumError": "8kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular/build:dev-server",
"configurations": {
"production": {
"buildTarget": "tpAngularFinal:build:production"
},
"development": {
"buildTarget": "tpAngularFinal:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular/build:extract-i18n"
},
"test": {
"builder": "@angular/build:karma",
"options": {
"tsConfig": "tsconfig.spec.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
]
}
}
}
}
}
}

10589
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

49
package.json Normal file
View File

@ -0,0 +1,49 @@
{
"name": "tp-angular-final",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"prettier": {
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
}
]
},
"private": true,
"dependencies": {
"@angular/common": "^20.1.0",
"@angular/compiler": "^20.1.0",
"@angular/core": "^20.1.0",
"@angular/forms": "^20.1.0",
"@angular/platform-browser": "^20.1.0",
"@angular/router": "^20.1.0",
"@tailwindcss/postcss": "^4.1.13",
"postcss": "^8.5.6",
"rxjs": "~7.8.0",
"tailwindcss": "^4.1.13",
"tslib": "^2.3.0"
},
"devDependencies": {
"@angular/build": "^20.1.3",
"@angular/cli": "^20.1.3",
"@angular/compiler-cli": "^20.1.0",
"@types/jasmine": "~5.1.0",
"daisyui": "^5.1.22",
"jasmine-core": "~5.8.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.8.2"
}
}

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

12
src/app/app.config.ts Normal file
View File

@ -0,0 +1,12 @@
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [
provideBrowserGlobalErrorListeners(),
provideZonelessChangeDetection(),
provideRouter(routes)
]
};

0
src/app/app.css Normal file
View File

2
src/app/app.html Normal file
View File

@ -0,0 +1,2 @@
<app-header [userEmail]="connectedUserEmail()" />
<router-outlet />

14
src/app/app.routes.ts Normal file
View File

@ -0,0 +1,14 @@
import { Routes } from '@angular/router';
import { adminGuard } from './guards/admin-guard';
export const routes: Routes = [
{path: '', redirectTo: "/home", pathMatch:"full"},
{path: 'home', loadComponent: ()=> import("./pages/home/home").then(m =>m.Home)},
{path: 'login', loadComponent: ()=> import("./pages/login/login").then(m =>m.Login)},
{path: 'register', loadComponent: ()=> import("./pages/register/register").then(m =>m.Register)},
{path: 'admin',canActivate: [adminGuard], loadChildren: () => import('./pages/admin/admin').then(m => m.Admin), data: { role: 'ADMIN' } },
//version si besoin de multiplier les routes admin
// {path: 'admin',canActivate: [adminGuard], loadChildren: () => import('./pages/admin/admin.routes').then(m => m.ADMIN_ROUTES), data: { role: 'ADMIN' } },
{path: '**',loadComponent: ()=> import("./pages/not-found/not-found").then(m =>m.NotFound) }
];

25
src/app/app.spec.ts Normal file
View File

@ -0,0 +1,25 @@
import { provideZonelessChangeDetection } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { App } from './app';
describe('App', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [App],
providers: [provideZonelessChangeDetection()]
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(App);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it('should render title', () => {
const fixture = TestBed.createComponent(App);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, tpAngularFinal');
});
});

25
src/app/app.ts Normal file
View File

@ -0,0 +1,25 @@
import { Component, computed, Signal, signal } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { Auth } from './services/auth';
import { Header } from './shared/header/header';
@Component({
selector: 'app-root',
imports: [RouterOutlet, Header],
templateUrl: './app.html',
styleUrl: './app.css'
})
export class App {
protected readonly title = signal('tpAngularFinal');
isLoggedIn: Signal<Boolean> = signal(false);
connectedUserEmail = computed(()=>{
const user=this.userService.connectedUser();
return user ? user.email : null;
})
constructor(private readonly userService: Auth){
console.log(this.isLoggedIn());
}
}

View File

@ -0,0 +1,17 @@
import { TestBed } from '@angular/core/testing';
import { CanActivateFn } from '@angular/router';
import { adminGuard } from './admin-guard';
describe('adminGuard', () => {
const executeGuard: CanActivateFn = (...guardParameters) =>
TestBed.runInInjectionContext(() => adminGuard(...guardParameters));
beforeEach(() => {
TestBed.configureTestingModule({});
});
it('should be created', () => {
expect(executeGuard).toBeTruthy();
});
});

View File

@ -0,0 +1,5 @@
import { CanActivateFn } from '@angular/router';
export const adminGuard: CanActivateFn = (route, state) => {
return true;
};

View File

@ -0,0 +1,12 @@
export interface User {
email: string,
password: string,
roles: string[]
}
//TODO: Passer a une gestion par roles et non par un booléen isAdmin
export interface LoggedUser {
email: string,
token: string,
roles: string[]
}

View File

View File

@ -0,0 +1 @@
<p>admin works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Admin } from './admin';
describe('Admin', () => {
let component: Admin;
let fixture: ComponentFixture<Admin>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Admin]
})
.compileComponents();
fixture = TestBed.createComponent(Admin);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-admin',
imports: [],
templateUrl: './admin.html',
styleUrl: './admin.css'
})
export class Admin {
}

View File

View File

@ -0,0 +1 @@
<p>home works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Home } from './home';
describe('Home', () => {
let component: Home;
let fixture: ComponentFixture<Home>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Home]
})
.compileComponents();
fixture = TestBed.createComponent(Home);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-home',
imports: [],
templateUrl: './home.html',
styleUrl: './home.css'
})
export class Home {
}

View File

View File

@ -0,0 +1,13 @@
<!-- TODO: utiliser des formgroup -->
<div class = "form-container">
<form (ngSubmit)="login()">
<fieldset >
<legend >Login</legend>
<div >
<input class="input" type="text" [value]="email()" (input)="updateEmail($event)" placeholder="Mail" aria-label="email">
</div>
<input class="input" type="text" [value]="password()" (input)="updatePassword($event)" placeholder="Password" aria-label="password">
</fieldset>
<button class="btn" type="submit">Login</button>
</form>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Login } from './login';
describe('Login', () => {
let component: Login;
let fixture: ComponentFixture<Login>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Login]
})
.compileComponents();
fixture = TestBed.createComponent(Login);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,46 @@
import { Component, inject, signal, Signal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Router } from '@angular/router';
import { Auth } from '../../services/auth';
import { User } from '../../interfaces/user';
@Component({
selector: 'app-login',
imports: [FormsModule],
templateUrl: './login.html',
styleUrl: './login.css'
})
export class Login {
email = signal('');
password = signal('');
errorMessage = signal('');
// userToConnect: Signal<User>=signal<User>({email:"",password:""});
// private readonly userService: Userlogin = inject(Userlogin);
constructor(private readonly userService: Auth, private readonly router: Router){
}
login() {
const userToConnect : User = {email: this.email(), password: this.password(),roles: []}
const loginSuccess = this.userService.login(userToConnect)
if(loginSuccess){
this.router.navigate(['/profile']);
}
else {
this.errorMessage.set('Email ou mot de passe incorrect');
}
}
updateEmail(event: Event) {
const target = event.target as HTMLInputElement;
this.email.set(target.value);
}
updatePassword(event: Event) {
const target = event.target as HTMLInputElement;
this.password.set(target.value);
}
}

View File

View File

@ -0,0 +1 @@
<p>not-found works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NotFound } from './not-found';
describe('NotFound', () => {
let component: NotFound;
let fixture: ComponentFixture<NotFound>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [NotFound]
})
.compileComponents();
fixture = TestBed.createComponent(NotFound);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-not-found',
imports: [],
templateUrl: './not-found.html',
styleUrl: './not-found.css'
})
export class NotFound {
}

View File

View File

@ -0,0 +1,20 @@
<!-- TODO: utiliser des formgroup -->
<div class = "form-container">
<form (ngSubmit)="OnSubmit()">
<fieldset >
<legend >Register</legend>
<div>
<input class="input" type="text" [value]="email()" (input)="updateEmail($event)" placeholder="Mail" aria-label="email">
</div>
<div>
<input class="input" type="text" [value]="password()" (input)="updatePassword($event)" placeholder="Password" aria-label="password">
</div>
<div>
<input class="input" type="text" [value]="passwordConfirm()" (input)="updateConfirmPassword($event)" placeholder="confirm Password" aria-label="password">
</div>
</fieldset>
<button class="btn" type="submit">register</button>
</form>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Register } from './register';
describe('Register', () => {
let component: Register;
let fixture: ComponentFixture<Register>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Register]
})
.compileComponents();
fixture = TestBed.createComponent(Register);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,52 @@
import { Component, inject, Signal, signal } from '@angular/core';
import { User } from '../../interfaces/user';
import { FormsModule } from '@angular/forms';
import { Router, RouterLink } from '@angular/router';
import { Auth } from '../../services/auth';
@Component({
selector: 'app-register',
imports: [FormsModule],
templateUrl: './register.html',
styleUrl: './register.css',
})
export class Register {
email = signal('');
password = signal('');
passwordConfirm = signal('');
errorMessage = signal('');
constructor(private readonly userService: Auth,
private readonly router: Router) {
}
OnSubmit() {
if (this.password() == this.passwordConfirm()) {
console.log(this.email());
const userToRegister: User = {email: this.email(), password: this.password(), roles: ['ADMIN']}
const register = this.userService.register(userToRegister)
if(register){
this.router.navigate(["/login"])
}
else {
this.errorMessage.set('Email ou mot de passe incorrect');
}
}
}
updateEmail(event: Event) {
const target = event.target as HTMLInputElement;
this.email.set(target.value);
}
updatePassword(event: Event) {
const target = event.target as HTMLInputElement;
this.password.set(target.value);
}
updateConfirmPassword(event: Event) {
const target = event.target as HTMLInputElement;
this.passwordConfirm.set(target.value);
}
}

View File

View File

@ -0,0 +1 @@
<p>search works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Search } from './search';
describe('Search', () => {
let component: Search;
let fixture: ComponentFixture<Search>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Search]
})
.compileComponents();
fixture = TestBed.createComponent(Search);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-search',
imports: [],
templateUrl: './search.html',
styleUrl: './search.css'
})
export class Search {
}

View File

View File

@ -0,0 +1 @@
<p>video works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Video } from './video';
describe('Video', () => {
let component: Video;
let fixture: ComponentFixture<Video>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Video]
})
.compileComponents();
fixture = TestBed.createComponent(Video);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-video',
imports: [],
templateUrl: './video.html',
styleUrl: './video.css'
})
export class Video {
}

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { Auth } from './auth';
describe('Auth', () => {
let service: Auth;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(Auth);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

104
src/app/services/auth.ts Normal file
View File

@ -0,0 +1,104 @@
import { Injectable, signal } from '@angular/core';
import { LoggedUser, User } from '../interfaces/user';
@Injectable({
providedIn: 'root'
})
export class Auth {
private connectedUserSignal = signal<LoggedUser|null>(null);
private users = signal<User[]>([]);
constructor(){
this.loadStoredData();
}
private loadStoredData(){
const storedUser = sessionStorage.getItem('connectedUser');
if(storedUser) {
this.connectedUserSignal.set(JSON.parse(storedUser))
}
const storedUsers = localStorage.getItem("users");
if(storedUsers){
this.users.set(JSON.parse(storedUsers));
}
}
public get connectedUser() {
return this.connectedUserSignal.asReadonly();
}
public get isLoggedIn(){
return this.connectedUserSignal() !== null;
}
getUserByEmail(userEmail: string): User {
//Attention le resultat peux être undefined
return this.users().find(user=>user.email==userEmail)!;
}
register(user: User): boolean{
console.log("time to save users");
if(this.users().find(u => u.email===user.email)){
console.log("seem to be such a user already"+user.email);
return false;
}
this.users.update(users=>[...users,user])
this.saveUsers();
return true;
}
saveUsers() {
localStorage.setItem('users', JSON.stringify(this.users()))
}
//################################ LOGIN/LOGOUT ###############################
login(userToConnect: User): boolean {
const userToCheck = this.getUserByEmail(userToConnect.email);
console.log("User has been found : " + userToCheck.email);
if(!userToCheck){
console.log("No such user");
return false;
}
else if(userToCheck.password==userToConnect.password){
console.log("password is ok");
//ATTENTION: ici il faut stocker le isAdmin de userToCheck parce que
// l'information sur le role est récupérée lors du getUser
const userStoreData: LoggedUser = { email: userToConnect.email,
token: 'fake-jwt'+Date.now(), roles: userToCheck.roles
}
sessionStorage.setItem('connectedUser',JSON.stringify(userStoreData))
this.connectedUserSignal.set(userStoreData);
return true;
}
else{
console.log("password doesn't seem right");
return false
}
}
logout(){
sessionStorage.removeItem('connectedUser');
this.connectedUserSignal.set(null);
}
//########################################## ROLES ######################################
hasRole(requiredRole: string){
if(this.connectedUser()?.roles.find(el => el == requiredRole)!==undefined){
return true
}
else{
return
}
}
}

View File

View File

@ -0,0 +1,10 @@
<div class="navbar bg-base-100 shadow-sm" >
<div><a class="btn btn-ghost text-xl" routerLink="/home">Home</a></div>
@if(isLoggedIn()){
<div><a class="btn btn-ghost text-xl" (click)="logout()">Logout</a></div>
}
@if(!isLoggedIn()){
<div ><a class="btn btn-ghost text-xl" routerLink="/login">Login</a></div>
<div ><a class="btn btn-ghost text-xl" routerLink="/register">Register</a></div>
}
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Header } from './header';
describe('Header', () => {
let component: Header;
let fixture: ComponentFixture<Header>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Header]
})
.compileComponents();
fixture = TestBed.createComponent(Header);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,29 @@
import { Component, computed, input, signal, Signal } from '@angular/core';
import { Router, RouterLink } from '@angular/router';
import { Auth } from '../../services/auth';
@Component({
selector: 'app-header',
imports: [RouterLink],
templateUrl: './header.html',
styleUrl: './header.css'
})
export class Header {
userEmail=input<string | null>(null);
isLoggedIn = computed(()=>this.userEmail() !== null)
currentUserEmail = computed(()=> this.userEmail());
constructor(private readonly loginservice: Auth, private readonly router: Router){
}
logout(){
this.loginservice.logout();
this.router.navigate(["/login"])
}
}

View File

View File

@ -0,0 +1 @@
<p>sidebar works!</p>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Sidebar } from './sidebar';
describe('Sidebar', () => {
let component: Sidebar;
let fixture: ComponentFixture<Sidebar>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Sidebar]
})
.compileComponents();
fixture = TestBed.createComponent(Sidebar);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,11 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-sidebar',
imports: [],
templateUrl: './sidebar.html',
styleUrl: './sidebar.css'
})
export class Sidebar {
}

13
src/index.html Normal file
View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>TpAngularFinal</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>

6
src/main.ts Normal file
View File

@ -0,0 +1,6 @@
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { App } from './app/app';
bootstrapApplication(App, appConfig)
.catch((err) => console.error(err));

2
src/styles.css Normal file
View File

@ -0,0 +1,2 @@
@import "tailwindcss";
@plugin "daisyui";

15
tsconfig.app.json Normal file
View File

@ -0,0 +1,15 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"include": [
"src/**/*.ts"
],
"exclude": [
"src/**/*.spec.ts"
]
}

34
tsconfig.json Normal file
View File

@ -0,0 +1,34 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"compileOnSave": false,
"compilerOptions": {
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"isolatedModules": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "ES2022",
"module": "preserve"
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"typeCheckHostBindings": true,
"strictTemplates": true
},
"files": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

14
tsconfig.spec.json Normal file
View File

@ -0,0 +1,14 @@
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"src/**/*.ts"
]
}