diff --git a/.editorconfig b/.editorconfig index f166060..19a5b83 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,17 +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 +# 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 diff --git a/.gitignore b/.gitignore index cc7b141..70583d7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,42 +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 +# 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 diff --git a/.postcssrc.json b/.postcssrc.json index 72f908d..9ca94b5 100644 --- a/.postcssrc.json +++ b/.postcssrc.json @@ -1,5 +1,5 @@ -{ - "plugins": { - "@tailwindcss/postcss": {} - } +{ + "plugins": { + "@tailwindcss/postcss": {} + } } \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 77b3745..feccd00 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,4 +1,4 @@ -{ - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 - "recommendations": ["angular.ng-template"] -} +{ + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 + "recommendations": ["angular.ng-template"] +} diff --git a/.vscode/launch.json b/.vscode/launch.json index 925af83..278bd60 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,20 +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" - } - ] -} +{ + // 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" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a298b5b..e4f8cf0 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,42 +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" - } - } - } - } - ] -} +{ + // 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" + } + } + } + } + ] +} diff --git a/README.md b/README.md index 529a5e4..9a1e279 100644 --- a/README.md +++ b/README.md @@ -1,59 +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. +# 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. diff --git a/angular.json b/angular.json index 9cc4e64..e0221ad 100644 --- a/angular.json +++ b/angular.json @@ -1,94 +1,94 @@ -{ - "$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, - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.development.ts" - } - ] - } - }, - "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" - ] - } - } - } - } - }, - "cli": { - "analytics": false - } -} +{ + "$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, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.development.ts" + } + ] + } + }, + "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" + ] + } + } + } + } + }, + "cli": { + "analytics": false + } +} diff --git a/package.json b/package.json index 2d7688a..2465c70 100644 --- a/package.json +++ b/package.json @@ -1,49 +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" - } -} +{ + "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": "^21.1.0", + "@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" + } +} diff --git a/src/app/app.config.ts b/src/app/app.config.ts index a0ddd34..1c98f0c 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -1,14 +1,14 @@ -import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection } from '@angular/core'; -import { provideRouter } from '@angular/router'; - -import { routes } from './app.routes'; -import { provideHttpClient } from '@angular/common/http'; - -export const appConfig: ApplicationConfig = { - providers: [ - provideBrowserGlobalErrorListeners(), - provideZonelessChangeDetection(), - provideRouter(routes), - provideHttpClient() - ] -}; +import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection } from '@angular/core'; +import { provideRouter } from '@angular/router'; + +import { routes } from './app.routes'; +import { provideHttpClient } from '@angular/common/http'; + +export const appConfig: ApplicationConfig = { + providers: [ + provideBrowserGlobalErrorListeners(), + provideZonelessChangeDetection(), + provideRouter(routes), + provideHttpClient() + ] +}; diff --git a/src/app/app.css b/src/app/app.css index 121c205..016f1a6 100644 --- a/src/app/app.css +++ b/src/app/app.css @@ -1,6 +1,6 @@ -main { - width: 100%; - margin: 2rem; - display: flex; - justify-content: center; -} +main { + width: 100%; + margin: 2rem; + display: flex; + justify-content: center; +} diff --git a/src/app/app.html b/src/app/app.html index 2da69d3..c7ae0dc 100644 --- a/src/app/app.html +++ b/src/app/app.html @@ -1,5 +1,5 @@ - -
- -
+ +
+ +
\ No newline at end of file diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index 2304f83..c838228 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -1,18 +1,18 @@ -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: 'login', loadComponent: ()=> import("./pages/login/login").then(m =>m.Login)}, - {path: 'potd', loadComponent: ()=> import("./pages/potd/potd").then(m =>m.POTD)}, - {path: 'search', loadComponent: ()=> import("./pages/search/search").then(m =>m.Search)}, - {path: 'video/:id', loadComponent: ()=> import("./pages/video/video").then(m =>m.Video)}, - {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) } - -]; +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: 'login', loadComponent: ()=> import("./pages/login/login").then(m =>m.Login)}, + {path: 'potd', loadComponent: ()=> import("./pages/potd/potd").then(m =>m.POTD)}, + {path: 'search', loadComponent: ()=> import("./pages/search/search").then(m =>m.Search)}, + {path: 'video/:id', loadComponent: ()=> import("./pages/video/video").then(m =>m.Video)}, + {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) } + +]; diff --git a/src/app/app.spec.ts b/src/app/app.spec.ts index 64b4a92..f5c4b77 100644 --- a/src/app/app.spec.ts +++ b/src/app/app.spec.ts @@ -1,25 +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'); - }); -}); +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'); + }); +}); diff --git a/src/app/app.ts b/src/app/app.ts index 53332d9..5a5ad65 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,26 +1,26 @@ -import { Component, computed, Signal, signal } from '@angular/core'; -import { RouterOutlet } from '@angular/router'; -import { Auth } from './services/auth'; -import { Header } from './shared/header/header'; -import { Sidebar } from "./shared/sidebar/sidebar"; - -@Component({ - selector: 'app-root', - imports: [RouterOutlet, Header, Sidebar], - templateUrl: './app.html', - styleUrl: './app.css' -}) -export class App { - protected readonly title = signal('tpAngularFinal'); - isLoggedIn: Signal = signal(false); - - connectedUserEmail = computed(()=>{ - const user=this.userService.connectedUser(); - return user ? user.email : null; - }) - - - constructor(private readonly userService: Auth){ - console.log(this.isLoggedIn()); - } -} +import { Component, computed, Signal, signal } from '@angular/core'; +import { RouterOutlet } from '@angular/router'; +import { Auth } from './services/auth'; +import { Header } from './shared/header/header'; +import { Sidebar } from "./shared/sidebar/sidebar"; + +@Component({ + selector: 'app-root', + imports: [RouterOutlet, Header, Sidebar], + templateUrl: './app.html', + styleUrl: './app.css' +}) +export class App { + protected readonly title = signal('tpAngularFinal'); + isLoggedIn: Signal = signal(false); + + connectedUserEmail = computed(()=>{ + const user=this.userService.connectedUser(); + return user ? user.email : null; + }) + + + constructor(private readonly userService: Auth){ + console.log(this.isLoggedIn()); + } +} diff --git a/src/app/guards/admin-guard.spec.ts b/src/app/guards/admin-guard.spec.ts index 4637509..907af95 100644 --- a/src/app/guards/admin-guard.spec.ts +++ b/src/app/guards/admin-guard.spec.ts @@ -1,17 +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(); - }); -}); +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(); + }); +}); diff --git a/src/app/guards/admin-guard.ts b/src/app/guards/admin-guard.ts index 558613a..b5d3f1f 100644 --- a/src/app/guards/admin-guard.ts +++ b/src/app/guards/admin-guard.ts @@ -1,5 +1,5 @@ -import { CanActivateFn } from '@angular/router'; - -export const adminGuard: CanActivateFn = (route, state) => { - return true; -}; +import { CanActivateFn } from '@angular/router'; + +export const adminGuard: CanActivateFn = (route, state) => { + return true; +}; diff --git a/src/app/interfaces/color.ts b/src/app/interfaces/color.ts deleted file mode 100644 index 96dd8a8..0000000 --- a/src/app/interfaces/color.ts +++ /dev/null @@ -1,33 +0,0 @@ -export type ColorApi = Color[] - -export interface Color { - id: number - title: string - userName: string - numViews: number - numVotes: number - numComments: number - numHearts: number - rank: number - dateCreated: string - hex: string - rgb: Rgb - hsv: Hsv - description: string - url: string - imageUrl: string - badgeUrl: string - apiUrl: string -} - -export interface Rgb { - red: number - green: number - blue: number -} - -export interface Hsv { - hue: number - saturation: number - value: number -} diff --git a/src/app/interfaces/nasa-api.ts b/src/app/interfaces/nasa-api.ts index 5b278ba..33748cd 100644 --- a/src/app/interfaces/nasa-api.ts +++ b/src/app/interfaces/nasa-api.ts @@ -1,52 +1,52 @@ -export interface NasaApi { - collection: Collection - } - - export interface Collection { - version: string - href: string - items: Item[] - metadata: Metadata - links: Link2[] - } - - export interface Item { - href: string - data: Daum[] - links: Link[] - } - - export interface Daum { - center: string - date_created: string - description?: string - keywords?: string[] - media_type: string - nasa_id: string - title: string - description_508?: string - album?: string[] - location?: string - secondary_creator?: string - photographer?: string - } - - export interface Link { - href: string - rel: string - render?: string - width?: number - size?: number - height?: number - } - - export interface Metadata { - total_hits: number - } - - export interface Link2 { - rel: string - prompt: string - href: string - } +export interface NasaApi { + collection: Collection + } + + export interface Collection { + version: string + href: string + items: Item[] + metadata: Metadata + links: Link2[] + } + + export interface Item { + href: string + data: Daum[] + links: Link[] + } + + export interface Daum { + center: string + date_created: string + description?: string + keywords?: string[] + media_type: string + nasa_id: string + title: string + description_508?: string + album?: string[] + location?: string + secondary_creator?: string + photographer?: string + } + + export interface Link { + href: string + rel: string + render?: string + width?: number + size?: number + height?: number + } + + export interface Metadata { + total_hits: number + } + + export interface Link2 { + rel: string + prompt: string + href: string + } \ No newline at end of file diff --git a/src/app/interfaces/picture.ts b/src/app/interfaces/picture.ts index d8e4f21..f668674 100644 --- a/src/app/interfaces/picture.ts +++ b/src/app/interfaces/picture.ts @@ -1,11 +1,11 @@ -export interface Picture { - copyright: string - date: string - explanation: string - hdurl: string - media_type: string - service_version: string - title: string - url: string - } +export interface Picture { + copyright: string + date: string + explanation: string + hdurl: string + media_type: string + service_version: string + title: string + url: string + } \ No newline at end of file diff --git a/src/app/pages/admin/admin.html b/src/app/pages/admin/admin.html index 49659db..64acec8 100644 --- a/src/app/pages/admin/admin.html +++ b/src/app/pages/admin/admin.html @@ -1 +1 @@ -

admin works!

+

admin works!

diff --git a/src/app/pages/admin/admin.spec.ts b/src/app/pages/admin/admin.spec.ts index 46bc1a2..196d042 100644 --- a/src/app/pages/admin/admin.spec.ts +++ b/src/app/pages/admin/admin.spec.ts @@ -1,23 +1,23 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { Admin } from './admin'; - -describe('Admin', () => { - let component: Admin; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [Admin] - }) - .compileComponents(); - - fixture = TestBed.createComponent(Admin); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Admin } from './admin'; + +describe('Admin', () => { + let component: Admin; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [Admin] + }) + .compileComponents(); + + fixture = TestBed.createComponent(Admin); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/admin/admin.ts b/src/app/pages/admin/admin.ts index 12f2d56..49d03ea 100644 --- a/src/app/pages/admin/admin.ts +++ b/src/app/pages/admin/admin.ts @@ -1,11 +1,11 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-admin', - imports: [], - templateUrl: './admin.html', - styleUrl: './admin.css' -}) -export class Admin { - -} +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-admin', + imports: [], + templateUrl: './admin.html', + styleUrl: './admin.css' +}) +export class Admin { + +} diff --git a/src/app/pages/home/home.html b/src/app/pages/home/home.html index 5f2c53f..6e1756e 100644 --- a/src/app/pages/home/home.html +++ b/src/app/pages/home/home.html @@ -1 +1 @@ -

home works!

+

home works!

diff --git a/src/app/pages/home/home.spec.ts b/src/app/pages/home/home.spec.ts index e2d9468..fc2e813 100644 --- a/src/app/pages/home/home.spec.ts +++ b/src/app/pages/home/home.spec.ts @@ -1,23 +1,23 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { Home } from './home'; - -describe('Home', () => { - let component: Home; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [Home] - }) - .compileComponents(); - - fixture = TestBed.createComponent(Home); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Home } from './home'; + +describe('Home', () => { + let component: Home; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [Home] + }) + .compileComponents(); + + fixture = TestBed.createComponent(Home); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/home/home.ts b/src/app/pages/home/home.ts index e5ec517..bd403ec 100644 --- a/src/app/pages/home/home.ts +++ b/src/app/pages/home/home.ts @@ -1,11 +1,11 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-home', - imports: [], - templateUrl: './home.html', - styleUrl: './home.css' -}) -export class Home { - -} +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-home', + imports: [], + templateUrl: './home.html', + styleUrl: './home.css' +}) +export class Home { + +} diff --git a/src/app/pages/login/login.html b/src/app/pages/login/login.html index 05ca8e9..9c47b7f 100644 --- a/src/app/pages/login/login.html +++ b/src/app/pages/login/login.html @@ -1,13 +1,13 @@ - -
-
-
- Login -
- -
- -
- -
+ +
+
+
+ Login +
+ +
+ +
+ +
\ No newline at end of file diff --git a/src/app/pages/login/login.spec.ts b/src/app/pages/login/login.spec.ts index dd8bbb3..360592d 100644 --- a/src/app/pages/login/login.spec.ts +++ b/src/app/pages/login/login.spec.ts @@ -1,23 +1,23 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { Login } from './login'; - -describe('Login', () => { - let component: Login; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [Login] - }) - .compileComponents(); - - fixture = TestBed.createComponent(Login); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Login } from './login'; + +describe('Login', () => { + let component: Login; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [Login] + }) + .compileComponents(); + + fixture = TestBed.createComponent(Login); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/not-found/not-found.html b/src/app/pages/not-found/not-found.html index 8071020..242d313 100644 --- a/src/app/pages/not-found/not-found.html +++ b/src/app/pages/not-found/not-found.html @@ -1 +1 @@ -

not-found works!

+

not-found works!

diff --git a/src/app/pages/not-found/not-found.spec.ts b/src/app/pages/not-found/not-found.spec.ts index dbf160e..88e5d97 100644 --- a/src/app/pages/not-found/not-found.spec.ts +++ b/src/app/pages/not-found/not-found.spec.ts @@ -1,23 +1,23 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { NotFound } from './not-found'; - -describe('NotFound', () => { - let component: NotFound; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [NotFound] - }) - .compileComponents(); - - fixture = TestBed.createComponent(NotFound); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NotFound } from './not-found'; + +describe('NotFound', () => { + let component: NotFound; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [NotFound] + }) + .compileComponents(); + + fixture = TestBed.createComponent(NotFound); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/not-found/not-found.ts b/src/app/pages/not-found/not-found.ts index 236ecb9..b5cbb10 100644 --- a/src/app/pages/not-found/not-found.ts +++ b/src/app/pages/not-found/not-found.ts @@ -1,11 +1,11 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-not-found', - imports: [], - templateUrl: './not-found.html', - styleUrl: './not-found.css' -}) -export class NotFound { - -} +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-not-found', + imports: [], + templateUrl: './not-found.html', + styleUrl: './not-found.css' +}) +export class NotFound { + +} diff --git a/src/app/pages/potd/potd.html b/src/app/pages/potd/potd.html index dd5310d..831123d 100644 --- a/src/app/pages/potd/potd.html +++ b/src/app/pages/potd/potd.html @@ -1,29 +1,17 @@ - - -
-
- -
-

{{nasaPOTD()?.title}}

-

Copyright: {{nasaPOTD()?.copyright}}

-

- {{nasaPOTD()?.explanation}} -

- - -
-
-
+
+
+ +
+

{{nasaPOTD()?.title}}

+

Copyright: {{nasaPOTD()?.copyright}}

+

+ {{nasaPOTD()?.explanation}} +

+ + +
+
+
diff --git a/src/app/pages/potd/potd.spec.ts b/src/app/pages/potd/potd.spec.ts index 49caaab..85fc4bb 100644 --- a/src/app/pages/potd/potd.spec.ts +++ b/src/app/pages/potd/potd.spec.ts @@ -1,23 +1,23 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { POTD } from './potd'; - -describe('POTD', () => { - let component: POTD; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [POTD] - }) - .compileComponents(); - - fixture = TestBed.createComponent(POTD); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { POTD } from './potd'; + +describe('POTD', () => { + let component: POTD; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [POTD] + }) + .compileComponents(); + + fixture = TestBed.createComponent(POTD); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/potd/potd.ts b/src/app/pages/potd/potd.ts index 39afd14..9b79ba1 100644 --- a/src/app/pages/potd/potd.ts +++ b/src/app/pages/potd/potd.ts @@ -1,29 +1,29 @@ -import { Component, inject, signal } from '@angular/core'; -import { NAPOD } from '../../services/napod'; -import { Picture } from '../../interfaces/picture'; - -@Component({ - selector: 'app-potd', - imports: [], - templateUrl: './potd.html', - styleUrl: './potd.css' -}) -export class POTD { - - private nasaApi = inject(NAPOD) - nasaPOTD = signal< Picture | null >(null) - - constructor(){ - this.nasaApi.getPicOfToday().subscribe({ - next: (data)=>{ - console.log(data) - this.nasaPOTD.set(data) - }, - error: error =>{ - console.log(error); - } - } - ) - } - -} +import { Component, inject, signal } from '@angular/core'; +import { NAPOD } from '../../services/napod'; +import { Picture } from '../../interfaces/picture'; + +@Component({ + selector: 'app-potd', + imports: [], + templateUrl: './potd.html', + styleUrl: './potd.css' +}) +export class POTD { + + private readonly nasaApi = inject(NAPOD) + nasaPOTD = signal< Picture | null >(null) + + constructor(){ + this.nasaApi.getPicOfToday().subscribe({ + next: (data)=>{ + console.log(data) + this.nasaPOTD.set(data) + }, + error: error =>{ + console.log(error); + } + } + ) + } + +} diff --git a/src/app/pages/register/register.spec.ts b/src/app/pages/register/register.spec.ts index eac286c..c14eef6 100644 --- a/src/app/pages/register/register.spec.ts +++ b/src/app/pages/register/register.spec.ts @@ -1,23 +1,23 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { Register } from './register'; - -describe('Register', () => { - let component: Register; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [Register] - }) - .compileComponents(); - - fixture = TestBed.createComponent(Register); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Register } from './register'; + +describe('Register', () => { + let component: Register; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [Register] + }) + .compileComponents(); + + fixture = TestBed.createComponent(Register); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/search/search.css b/src/app/pages/search/search.css index 6d2572b..1f42268 100644 --- a/src/app/pages/search/search.css +++ b/src/app/pages/search/search.css @@ -1,14 +1,14 @@ -.searchcontainer { - width:80vw; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - -} - -.inputSearch { - margin-bottom: 1rem; - display: flex; - flex-direction: row; +.searchcontainer { + width:80vw; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + +} + +.inputSearch { + margin-bottom: 1rem; + display: flex; + flex-direction: row; } \ No newline at end of file diff --git a/src/app/pages/search/search.html b/src/app/pages/search/search.html index d1a3fde..0637513 100644 --- a/src/app/pages/search/search.html +++ b/src/app/pages/search/search.html @@ -1,63 +1,58 @@ -
-
- - -
- -@if(searchResults()!==null && searchResults()!.collection.items.length==0){ -
-

No results for this search

-
-} - -@if(searchResults()!==null && searchResults()!.collection.items.length!==0){ -
-
    - -
  • Results
  • - - - @for(el of searchResults()!.collection.items; track el.data[0].nasa_id){ -
  • - -
    -
    -
    {{el.data[0].title}}
    -
    Photographer: {{el.data[0].photographer}}
    -

    - {{el.data[0].description}} -

    -
    - - -
  • - } - -
-
- } -
+
+
+ + +
+ +@if(searchResults()!==null && searchResults()!.collection.items.length==0){ +
+

No results for this search

+
+} + +@if(searchResults()!==null && searchResults()!.collection.items.length!==0){ +
+
    + +
  • Results
  • + @for(el of searchResults()!.collection.items; track el.data[0].nasa_id){ +
  • + +
    +
    +
    {{el.data[0].title}}
    +
    Photographer: {{el.data[0].photographer}}
    +

    + {{el.data[0].description}} +

    +
    + +
  • + } + +
+
+ } +
diff --git a/src/app/pages/search/search.spec.ts b/src/app/pages/search/search.spec.ts index 5eae06e..1b71a5d 100644 --- a/src/app/pages/search/search.spec.ts +++ b/src/app/pages/search/search.spec.ts @@ -1,23 +1,23 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { Search } from './search'; - -describe('Search', () => { - let component: Search; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [Search] - }) - .compileComponents(); - - fixture = TestBed.createComponent(Search); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { Search } from './search'; + +describe('Search', () => { + let component: Search; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [Search] + }) + .compileComponents(); + + fixture = TestBed.createComponent(Search); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/video/video.html b/src/app/pages/video/video.html index 431a331..e560d91 100644 --- a/src/app/pages/video/video.html +++ b/src/app/pages/video/video.html @@ -1,18 +1,18 @@ -@if(isLoading()){ -
- -

Chargement de la vidéo...

-
-} -@if(!isLoading() && asset()){ -
- -
-} - -@if(!isLoading() && !asset()){ -

Impossible de charger la vidéo.

+@if(isLoading()){ +
+ +

Chargement de la vidéo...

+
+} +@if(!isLoading() && asset()){ +
+ +
+} + +@if(!isLoading() && !asset()){ +

Impossible de charger la vidéo.

} \ No newline at end of file diff --git a/src/app/pages/video/video.spec.ts b/src/app/pages/video/video.spec.ts index a67a7dc..3443acd 100644 --- a/src/app/pages/video/video.spec.ts +++ b/src/app/pages/video/video.spec.ts @@ -1,23 +1,23 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { Video } from './video'; - -describe('Video', () => { - let component: Video; - let fixture: ComponentFixture