commit d15f69b85e96db8a199a75ad9b19eb434d20513c Author: jleroy Date: Wed Mar 19 14:29:22 2025 +0100 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f166060 --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f514ed3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# 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 +/backend/package-lock.json +/backend/node_modules +/package-lock.json diff --git a/.postcssrc.json b/.postcssrc.json new file mode 100644 index 0000000..e092dc7 --- /dev/null +++ b/.postcssrc.json @@ -0,0 +1,5 @@ +{ + "plugins": { + "@tailwindcss/postcss": {} + } +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..77b3745 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + // 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 new file mode 100644 index 0000000..925af83 --- /dev/null +++ b/.vscode/launch.json @@ -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" + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..a298b5b --- /dev/null +++ b/.vscode/tasks.json @@ -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" + } + } + } + } + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..2eb365a --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# ENIAngular + +This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.1. + +## 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 new file mode 100644 index 0000000..1fecb34 --- /dev/null +++ b/angular.json @@ -0,0 +1,96 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "ENI-Angular": { + "projectType": "application", + "schematics": {}, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:application", + "options": { + "outputPath": "dist/eni-angular", + "index": "src/index.html", + "browser": "src/main.ts", + "polyfills": [ + "zone.js" + ], + "tsConfig": "tsconfig.app.json", + "assets": [ + { + "glob": "**/*", + "input": "public" + } + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + }, + "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-devkit/build-angular:dev-server", + "configurations": { + "production": { + "buildTarget": "ENI-Angular:build:production" + }, + "development": { + "buildTarget": "ENI-Angular:build:development" + } + }, + "defaultConfiguration": "development" + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n" + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "polyfills": [ + "zone.js", + "zone.js/testing" + ], + "tsConfig": "tsconfig.spec.json", + "assets": [ + { + "glob": "**/*", + "input": "public" + } + ], + "styles": [ + "src/styles.css" + ], + "scripts": [] + } + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..c96a1b9 --- /dev/null +++ b/package.json @@ -0,0 +1,41 @@ +{ + "name": "eni-angular", + "version": "0.0.0", + "scripts": { + "ng": "ng", + "start": "ng serve", + "build": "ng build", + "watch": "ng build --watch --configuration development", + "test": "ng test" + }, + "private": true, + "dependencies": { + "@angular/animations": "^19.2.1", + "@angular/common": "^19.2.0", + "@angular/compiler": "^19.2.0", + "@angular/core": "^19.2.0", + "@angular/forms": "^19.2.0", + "@angular/platform-browser": "^19.2.0", + "@angular/platform-browser-dynamic": "^19.2.0", + "@angular/router": "^19.2.0", + "@tailwindcss/postcss": "^4.0.12", + "postcss": "^8.5.3", + "rxjs": "~7.8.0", + "tailwindcss": "^4.0.12", + "tslib": "^2.3.0", + "zone.js": "~0.15.0" + }, + "devDependencies": { + "@angular-devkit/build-angular": "^19.2.1", + "@angular/cli": "^19.2.1", + "@angular/compiler-cli": "^19.2.0", + "@types/jasmine": "~5.1.0", + "jasmine-core": "~5.6.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.7.2" + } +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..fcb9fa1 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/img/background.png b/public/img/background.png new file mode 100644 index 0000000..4759cbe Binary files /dev/null and b/public/img/background.png differ diff --git a/public/img/color-palette.png b/public/img/color-palette.png new file mode 100644 index 0000000..d4a3754 Binary files /dev/null and b/public/img/color-palette.png differ diff --git a/public/img/logo.png b/public/img/logo.png new file mode 100644 index 0000000..d0d99ef Binary files /dev/null and b/public/img/logo.png differ diff --git a/src/app/_component/sidbar/sidbar.component.css b/src/app/_component/sidbar/sidbar.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/_component/sidbar/sidbar.component.html b/src/app/_component/sidbar/sidbar.component.html new file mode 100644 index 0000000..fa9b2b7 --- /dev/null +++ b/src/app/_component/sidbar/sidbar.component.html @@ -0,0 +1,91 @@ +
+
+
+ YouVideo +
+
+ +
diff --git a/src/app/_component/sidbar/sidbar.component.ts b/src/app/_component/sidbar/sidbar.component.ts new file mode 100644 index 0000000..86286c0 --- /dev/null +++ b/src/app/_component/sidbar/sidbar.component.ts @@ -0,0 +1,63 @@ +import {Component, OnInit} from '@angular/core'; +import {AuthService} from '../../_services/auth.service'; +import {Users} from '../../_models/users'; +import {catchError, of} from 'rxjs'; +import {NgIf} from '@angular/common'; +import {Router, RouterLink} from '@angular/router'; + +@Component({ + selector: 'app-sidbar', + imports: [ + NgIf, + RouterLink + ], + templateUrl: './sidbar.component.html', + styleUrl: './sidbar.component.css' +}) +export class SidbarComponent implements OnInit { + + user: Users = { id: 0, email: '', firstname: '', lastname: '', password_hash: '', updated_at: new Date(), created_at: new Date() }; + + constructor(private authService: AuthService, private router: Router) {} + + ngOnInit(): void { + this.checkAuthAndLoadUser(); + + } + + checkAuthAndLoadUser(): void { + this.authService.isAuthenticated().subscribe(isAuthenticated => { + if (isAuthenticated) { + this.loadUsers(); + } else { + this.user = { id: 0, email: '', firstname: '', lastname: '', password_hash: '', updated_at: new Date(), created_at: new Date() }; + } + }); + } + + loadUsers(): void { + this.authService.getProfil().pipe( + catchError(error => { + console.error('Erreur lors du chargement du profil:', error); + return of(null); + }) + ).subscribe(users => { + if (users) { + console.log(users); + this.user = users; + } + }); + } + + logout(): void { + this.authService.logout().subscribe({ + next: () => { + this.router.navigate(['/']); + }, + error: (err) => { + console.error('Logout failed:', err); + } + }); + } + +} diff --git a/src/app/_models/users.ts b/src/app/_models/users.ts new file mode 100644 index 0000000..967cbbc --- /dev/null +++ b/src/app/_models/users.ts @@ -0,0 +1,9 @@ +export interface Users { + id: number; + email: string; + firstname: string; + lastname: string; + password_hash: string; + updated_at: Date; + created_at: Date; +} diff --git a/src/app/_models/video.ts b/src/app/_models/video.ts new file mode 100644 index 0000000..33e8e26 --- /dev/null +++ b/src/app/_models/video.ts @@ -0,0 +1,13 @@ +export interface Videos { + data: Video[]; +} +export interface Video { + id: number; + user_id: number; + name: string; + description: string; + link_miniature: string; + link_video: string; + created_at: Date; + updated_at: Date; +} diff --git a/src/app/app.component.css b/src/app/app.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/app.component.html b/src/app/app.component.html new file mode 100644 index 0000000..67e7bd4 --- /dev/null +++ b/src/app/app.component.html @@ -0,0 +1 @@ + diff --git a/src/app/app.component.ts b/src/app/app.component.ts new file mode 100644 index 0000000..b115f66 --- /dev/null +++ b/src/app/app.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; +import { RouterOutlet } from '@angular/router'; + +@Component({ + selector: 'app-root', + standalone: true, + imports: [RouterOutlet], + templateUrl: './app.component.html', + styleUrl: './app.component.css' +}) +export class AppComponent { + title = 'ENI-Angular'; +} diff --git a/src/app/app.config.ts b/src/app/app.config.ts new file mode 100644 index 0000000..b8593fc --- /dev/null +++ b/src/app/app.config.ts @@ -0,0 +1,27 @@ +import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core'; +import { + provideRouter, + withEnabledBlockingInitialNavigation, + withInMemoryScrolling, + withViewTransitions +} from '@angular/router'; + +import { routes } from './app.routes'; +import {provideAnimations} from '@angular/platform-browser/animations'; +import {provideHttpClient} from '@angular/common/http'; + +export const appConfig: ApplicationConfig = { + providers: [ + provideAnimations(), + provideRouter(routes, + withViewTransitions(), + withEnabledBlockingInitialNavigation(), + withInMemoryScrolling({ + scrollPositionRestoration: 'enabled', + anchorScrolling: 'enabled' + }) + ), + provideZoneChangeDetection({ eventCoalescing: true }), + provideHttpClient(), + ], +}; diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts new file mode 100644 index 0000000..ff03f77 --- /dev/null +++ b/src/app/app.routes.ts @@ -0,0 +1,7 @@ +import { Routes } from '@angular/router'; + +export const routes: Routes = [ + { path: '', loadChildren: () => import('./public/public.module') + .then(m => m.PublicModule) + }, +]; diff --git a/src/app/public/pages/home/home.component.css b/src/app/public/pages/home/home.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/public/pages/home/home.component.html b/src/app/public/pages/home/home.component.html new file mode 100644 index 0000000..0fa55a3 --- /dev/null +++ b/src/app/public/pages/home/home.component.html @@ -0,0 +1,85 @@ + +
+ Image de fond +
+
+

Développeur web

+
+
+

Johan Leroy

+
+
+
+ + +
+
+

Mes Projets

+ +
+ +
+ Projet 1 +
+

Projet 1

+

Description du projet 1. Voici quelques détails sur ce projet et les technologies utilisées.

+ Voir plus +
+
+ + +
+ Projet 2 +
+

Projet 2

+

Description du projet 2. Voici quelques détails sur ce projet et les technologies utilisées.

+ Voir plus +
+
+ + +
+ Projet 3 +
+

Projet 3

+

Description du projet 3. Voici quelques détails sur ce projet et les technologies utilisées.

+ Voir plus +
+
+ + +
+ Projet 4 +
+

Projet 4

+

Description du projet 4. Voici quelques détails sur ce projet et les technologies utilisées.

+ Voir plus +
+
+ + +
+ Projet 5 +
+

Projet 5

+

Description du projet 5. Voici quelques détails sur ce projet et les technologies utilisées.

+ Voir plus +
+
+ + +
+ Projet 6 +
+

Projet 6

+

Description du projet 6. Voici quelques détails sur ce projet et les technologies utilisées.

+ Voir plus +
+
+
+
+
diff --git a/src/app/public/pages/home/home.component.ts b/src/app/public/pages/home/home.component.ts new file mode 100644 index 0000000..146878d --- /dev/null +++ b/src/app/public/pages/home/home.component.ts @@ -0,0 +1,13 @@ +import {Component} from '@angular/core'; + +@Component({ + selector: 'app-home', + imports: [], + templateUrl: './home.component.html', + styleUrl: './home.component.css' +}) +export class HomeComponent { + + + +} diff --git a/src/app/public/pages/not-found/not-found.component.css b/src/app/public/pages/not-found/not-found.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/public/pages/not-found/not-found.component.html b/src/app/public/pages/not-found/not-found.component.html new file mode 100644 index 0000000..8071020 --- /dev/null +++ b/src/app/public/pages/not-found/not-found.component.html @@ -0,0 +1 @@ +

not-found works!

diff --git a/src/app/public/pages/not-found/not-found.component.ts b/src/app/public/pages/not-found/not-found.component.ts new file mode 100644 index 0000000..dd624c7 --- /dev/null +++ b/src/app/public/pages/not-found/not-found.component.ts @@ -0,0 +1,19 @@ +import {Component, OnInit} from '@angular/core'; +import {Title} from '@angular/platform-browser'; + +@Component({ + selector: 'app-not-found', + imports: [], + templateUrl: './not-found.component.html', + styleUrl: './not-found.component.css' +}) +export class NotFoundComponent implements OnInit { + + constructor(private title: Title) { + } + + ngOnInit(): void { + this.title.setTitle('404 - YouVideo'); + } + +} diff --git a/src/app/public/public-layout/public-layout.component.css b/src/app/public/public-layout/public-layout.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/public/public-layout/public-layout.component.html b/src/app/public/public-layout/public-layout.component.html new file mode 100644 index 0000000..67e7bd4 --- /dev/null +++ b/src/app/public/public-layout/public-layout.component.html @@ -0,0 +1 @@ + diff --git a/src/app/public/public-layout/public-layout.component.ts b/src/app/public/public-layout/public-layout.component.ts new file mode 100644 index 0000000..97b3ec7 --- /dev/null +++ b/src/app/public/public-layout/public-layout.component.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; +import {RouterOutlet} from '@angular/router'; + +@Component({ + selector: 'app-public-layout', + imports: [ + RouterOutlet + ], + templateUrl: './public-layout.component.html', + styleUrl: './public-layout.component.css' +}) +export class PublicLayoutComponent { + +} diff --git a/src/app/public/public-routing.module.ts b/src/app/public/public-routing.module.ts new file mode 100644 index 0000000..45634d1 --- /dev/null +++ b/src/app/public/public-routing.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import {NotFoundComponent} from './pages/not-found/not-found.component'; +import {PublicLayoutComponent} from './public-layout/public-layout.component'; +import {HomeComponent} from './pages/home/home.component'; + +const routes: Routes = [ + { path: '', component: PublicLayoutComponent, children: [ + { path: '', component: HomeComponent }, + ] + }, + { path: '**', component: NotFoundComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class PublicRoutingModule { } diff --git a/src/app/public/public.module.ts b/src/app/public/public.module.ts new file mode 100644 index 0000000..a9f917e --- /dev/null +++ b/src/app/public/public.module.ts @@ -0,0 +1,14 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { PublicRoutingModule } from './public-routing.module'; + + +@NgModule({ + declarations: [], + imports: [ + CommonModule, + PublicRoutingModule + ] +}) +export class PublicModule { } diff --git a/src/environments/environment.ts b/src/environments/environment.ts new file mode 100644 index 0000000..89aa13a --- /dev/null +++ b/src/environments/environment.ts @@ -0,0 +1,3 @@ +export const environment = { + apiTiny: 'r1u1cn7u2o0xj9zcesav8qjlb413z5srnqcac39wyjo9l7gf', +}; diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..8be1a5b --- /dev/null +++ b/src/index.html @@ -0,0 +1,13 @@ + + + + + Johan Leroy - Portfolio + + + + + + + + diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..35b00f3 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,6 @@ +import { bootstrapApplication } from '@angular/platform-browser'; +import { appConfig } from './app/app.config'; +import { AppComponent } from './app/app.component'; + +bootstrapApplication(AppComponent, appConfig) + .catch((err) => console.error(err)); diff --git a/src/styles.css b/src/styles.css new file mode 100644 index 0000000..f1d8c73 --- /dev/null +++ b/src/styles.css @@ -0,0 +1 @@ +@import "tailwindcss"; diff --git a/tsconfig.app.json b/tsconfig.app.json new file mode 100644 index 0000000..3775b37 --- /dev/null +++ b/tsconfig.app.json @@ -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": [] + }, + "files": [ + "src/main.ts" + ], + "include": [ + "src/**/*.d.ts" + ] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..5525117 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,27 @@ +/* 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": { + "outDir": "./dist/out-tsc", + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + "isolatedModules": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "moduleResolution": "bundler", + "importHelpers": true, + "target": "ES2022", + "module": "ES2022" + }, + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/tsconfig.spec.json b/tsconfig.spec.json new file mode 100644 index 0000000..5fb748d --- /dev/null +++ b/tsconfig.spec.json @@ -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/spec", + "types": [ + "jasmine" + ] + }, + "include": [ + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +}