From 7dfd83b60ad2c51a59c4809cfdb3491d8464b96a Mon Sep 17 00:00:00 2001 From: Bastien OLLIER Date: Mon, 3 Jun 2024 15:01:55 +0200 Subject: [PATCH 1/5] Implement personal code rooms (#11) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: bastien ollier Reviewed-on: https://codefirst.iut.uca.fr/git/sandkasten/sandkasten-web/pulls/11 Reviewed-by: Clément FRÉVILLE Co-authored-by: Bastien OLLIER Co-committed-by: Bastien OLLIER --- .gitignore | 1 + package-lock.json | 10 ++ package.json | 1 + .../{app-routing.module.ts => app.routes.ts} | 12 +- .../components/editor/editor.component.html | 8 +- .../components/editor/editor.component.scss | 10 ++ src/app/components/editor/editor.component.ts | 45 ++++++- ...n.service.ts => backendService.service.ts} | 11 +- src/app/services/connection.service.ts | 120 ++++++++++++++++++ src/main.ts | 5 +- 10 files changed, 203 insertions(+), 20 deletions(-) rename src/app/{app-routing.module.ts => app.routes.ts} (81%) rename src/app/services/{codeExecution.service.ts => backendService.service.ts} (80%) create mode 100644 src/app/services/connection.service.ts diff --git a/.gitignore b/.gitignore index a368413..1f86315 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ yarn-error.log *.launch .settings/ *.sublime-workspace +.nx # Visual Studio Code .vscode/* diff --git a/package-lock.json b/package-lock.json index f140234..b4f06de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "@angular/platform-browser": "^17.3.7", "@angular/platform-browser-dynamic": "^17.3.7", "@angular/router": "^17.3.7", + "@codemirror/collab": "^6.1.1", "@codemirror/lang-cpp": "^6.0.2", "@codemirror/lang-javascript": "^6.2.2", "@codemirror/state": "^6.4.1", @@ -2447,6 +2448,15 @@ "@lezer/common": "^1.0.0" } }, + "node_modules/@codemirror/collab": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@codemirror/collab/-/collab-6.1.1.tgz", + "integrity": "sha512-tkIn9Jguh98ie12dbBuba3lE8LHUkaMrIFuCVeVGhncSczFdKmX25vC12+58+yqQW5AXi3py6jWY0W+jelyglA==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0" + } + }, "node_modules/@codemirror/commands": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.5.0.tgz", diff --git a/package.json b/package.json index afaa066..d23a824 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@angular/platform-browser": "^17.3.7", "@angular/platform-browser-dynamic": "^17.3.7", "@angular/router": "^17.3.7", + "@codemirror/collab": "^6.1.1", "@codemirror/lang-cpp": "^6.0.2", "@codemirror/lang-javascript": "^6.2.2", "@codemirror/state": "^6.4.1", diff --git a/src/app/app-routing.module.ts b/src/app/app.routes.ts similarity index 81% rename from src/app/app-routing.module.ts rename to src/app/app.routes.ts index 2ec202c..29b9581 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app.routes.ts @@ -1,5 +1,4 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; +import { Routes } from '@angular/router'; import { EditorComponent } from './components/editor/editor.component'; import { LandingPageComponent } from './components/landing-page/landing-page.component'; import { DocumentationComponent } from './components/documentation/documentation.component'; @@ -9,18 +8,13 @@ import { OurStoryComponent } from './components/our-story/our-story.component'; import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-policy.component'; // Toutes les routes de l'application sont définies ici -const routes: Routes = [ +export const routes: Routes = [ { path: '', component: LandingPageComponent }, { path: 'editor', component: EditorComponent }, + { path: 'editor-live/:idRoom', component: EditorComponent }, { path: 'documentation', component: DocumentationComponent }, { path: 'contact', component: FormComponent }, { path: 'our-story', component: OurStoryComponent }, { path: 'terms-of-service', component: TermsOfServiceComponent }, { path: 'privacy-policy', component: PrivacyPolicyComponent }, ]; - -@NgModule({ - imports: [RouterModule.forRoot(routes)], - exports: [RouterModule], -}) -export class AppRoutingModule {} diff --git a/src/app/components/editor/editor.component.html b/src/app/components/editor/editor.component.html index df54939..ad07817 100644 --- a/src/app/components/editor/editor.component.html +++ b/src/app/components/editor/editor.component.html @@ -59,6 +59,13 @@ } + +