Del our-story + translate work + button editor work + work
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
0e97f37bff
commit
dfaf146cd5
@ -1,112 +1,133 @@
|
||||
<div id="editor">
|
||||
<div id="editor-bar-header">
|
||||
<div class="editor-section-bar-header">
|
||||
<div class="param-editor">
|
||||
<label for="fileInput">
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
||||
<g
|
||||
id="SVGRepo_tracerCarrier"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"></g>
|
||||
<g id="SVGRepo_iconCarrier">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M1 5C1 3.34315 2.34315 2 4 2H8.55848C9.84977 2 10.9962 2.82629 11.4045 4.05132L11.7208 5H20C21.1046 5 22 5.89543 22 7V9.00961C23.1475 9.12163 23.9808 10.196 23.7695 11.3578L22.1332 20.3578C21.9603 21.3087 21.132 22 20.1654 22H3C1.89543 22 1 21.1046 1 20V5ZM20 9V7H11.7208C10.8599 7 10.0956 6.44914 9.82339 5.63246L9.50716 4.68377C9.37105 4.27543 8.98891 4 8.55848 4H4C3.44772 4 3 4.44772 3 5V12.2709L3.35429 10.588C3.54913 9.66249 4.36562 9 5.31139 9H20ZM3.36634 20C3.41777 19.9109 3.4562 19.8122 3.47855 19.706L5.31139 11L21 11H21.8018L20.1654 20L3.36634 20Z"
|
||||
fill="#000000"></path>
|
||||
</g>
|
||||
</svg>
|
||||
</label>
|
||||
<input
|
||||
style="display: none"
|
||||
type="file"
|
||||
id="fileInput"
|
||||
(change)="loadFromFile($event)"/>
|
||||
</div>
|
||||
<div id="editor-bar-header">
|
||||
<div class="editor-section-bar-header">
|
||||
<div class="param-editor">
|
||||
<label for="fileInput">
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
||||
<g
|
||||
id="SVGRepo_tracerCarrier"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"></g>
|
||||
<g id="SVGRepo_iconCarrier">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M1 5C1 3.34315 2.34315 2 4 2H8.55848C9.84977 2 10.9962 2.82629 11.4045 4.05132L11.7208 5H20C21.1046 5 22 5.89543 22 7V9.00961C23.1475 9.12163 23.9808 10.196 23.7695 11.3578L22.1332 20.3578C21.9603 21.3087 21.132 22 20.1654 22H3C1.89543 22 1 21.1046 1 20V5ZM20 9V7H11.7208C10.8599 7 10.0956 6.44914 9.82339 5.63246L9.50716 4.68377C9.37105 4.27543 8.98891 4 8.55848 4H4C3.44772 4 3 4.44772 3 5V12.2709L3.35429 10.588C3.54913 9.66249 4.36562 9 5.31139 9H20ZM3.36634 20C3.41777 19.9109 3.4562 19.8122 3.47855 19.706L5.31139 11L21 11H21.8018L20.1654 20L3.36634 20Z"
|
||||
fill="#000000"></path>
|
||||
</g>
|
||||
</svg>
|
||||
</label>
|
||||
<input
|
||||
style="display: none"
|
||||
type="file"
|
||||
id="fileInput"
|
||||
(change)="loadFromFile($event)" />
|
||||
</div>
|
||||
|
||||
<div class="param-editor">
|
||||
<button class="button-icon" type="button" (click)="saveToFile()">
|
||||
<svg
|
||||
width="800px"
|
||||
height="800px"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M3 15C3 17.8284 3 19.2426 3.87868 20.1213C4.75736 21 6.17157 21 9 21H15C17.8284 21 19.2426 21 20.1213 20.1213C21 19.2426 21 17.8284 21 15"
|
||||
stroke="#1C274C"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"/>
|
||||
<path
|
||||
d="M12 3V16M12 16L16 11.625M12 16L8 11.625"
|
||||
stroke="#1C274C"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="param-editor">
|
||||
<button class="button-icon" type="button" (click)="addToDatabase()">
|
||||
ADD BDD
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="editor-section-bar-header">
|
||||
@if (errorMessage) {
|
||||
<div class="param-editor">
|
||||
<p style="color: red">{{ errorMessage }}</p>
|
||||
</div>
|
||||
}
|
||||
<div class="param-editor">
|
||||
<button class="button-icon" type="button" (click)="saveToFile()">
|
||||
<svg
|
||||
width="800px"
|
||||
height="800px"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M3 15C3 17.8284 3 19.2426 3.87868 20.1213C4.75736 21 6.17157 21 9 21H15C17.8284 21 19.2426 21 20.1213 20.1213C21 19.2426 21 17.8284 21 15"
|
||||
stroke="#1C274C"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
<path
|
||||
d="M12 3V16M12 16L16 11.625M12 16L8 11.625"
|
||||
stroke="#1C274C"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="param-editor">
|
||||
<button class="button-icon" type="button" (click)="addToDatabase()">
|
||||
ADD BDD
|
||||
</button>
|
||||
</div>
|
||||
<div class="param-editor">
|
||||
<button
|
||||
class="btn-share"
|
||||
type="button"
|
||||
(click)="shareButtonClicked()"
|
||||
[disabled]="isLoaded">
|
||||
{{ 'Work.Share' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<select id="language" [(ngModel)]="selectedLanguage">
|
||||
@for (language of languages; track language.name) {
|
||||
<option [ngValue]="language">{{ language.name }}</option>
|
||||
}
|
||||
</select>
|
||||
<!--TODO if userID de la session =! userID du work then btn-save.style(display : none) else btn-save.style(display : block)-->
|
||||
<div class="param-editor">
|
||||
<button
|
||||
class="btn-save"
|
||||
type="button"
|
||||
(click)="saveButtonClicked()"
|
||||
[disabled]="isLoaded">
|
||||
{{ 'Work.Save' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="editor-section-bar-header">
|
||||
@if (errorMessage) {
|
||||
<div class="param-editor">
|
||||
<p style="color: red">{{ errorMessage }}</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="param-editor">
|
||||
<button
|
||||
class="button-icon button-run"
|
||||
type="button"
|
||||
(click)="onRunButtonClicked()"
|
||||
[disabled]="isLoaded">
|
||||
<div>RUN</div>
|
||||
<svg
|
||||
viewBox="0 0 16 16"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="#000000">
|
||||
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
||||
<g
|
||||
id="SVGRepo_tracerCarrier"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"></g>
|
||||
<g id="SVGRepo_iconCarrier">
|
||||
<path
|
||||
d="M2.78 2L2 2.41v12l.78.42 9-6V8l-9-6zM3 13.48V3.35l7.6 5.07L3 13.48z"></path>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M6 14.683l8.78-5.853V8L6 2.147V3.35l7.6 5.07L6 13.48v1.203z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<select id="language" [(ngModel)]="selectedLanguage">
|
||||
@for (language of languages; track language.name) {
|
||||
<option [ngValue]="language">{{ language.name }}</option>
|
||||
}
|
||||
</select>
|
||||
|
||||
<div class="editor-center">
|
||||
<div class="editor-child-element">
|
||||
<codemirror6-editor [(ngModel)]="editorContent" [extensions]="extensions">
|
||||
</codemirror6-editor>
|
||||
</div>
|
||||
<div class="editor-child-element">
|
||||
<pre id="resultDiv" [innerHTML]="resultContent | safeHTML"></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="param-editor">
|
||||
<button
|
||||
class="button-icon button-run"
|
||||
type="button"
|
||||
(click)="onRunButtonClicked()"
|
||||
[disabled]="isLoaded">
|
||||
<div>RUN</div>
|
||||
<svg
|
||||
viewBox="0 0 16 16"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="#000000">
|
||||
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
||||
<g
|
||||
id="SVGRepo_tracerCarrier"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"></g>
|
||||
<g id="SVGRepo_iconCarrier">
|
||||
<path
|
||||
d="M2.78 2L2 2.41v12l.78.42 9-6V8l-9-6zM3 13.48V3.35l7.6 5.07L3 13.48z"></path>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
clip-rule="evenodd"
|
||||
d="M6 14.683l8.78-5.853V8L6 2.147V3.35l7.6 5.07L6 13.48v1.203z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="editor-center">
|
||||
<div class="editor-child-element">
|
||||
<codemirror6-editor [(ngModel)]="editorContent" [extensions]="extensions">
|
||||
</codemirror6-editor>
|
||||
</div>
|
||||
<div class="editor-child-element">
|
||||
<pre id="resultDiv" [innerHTML]="resultContent | safeHTML"></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Propulsé par Gitea Version: 1.18.0 Page: 34ms Modèle: 1ms Licences API
|
||||
|
@ -1,36 +0,0 @@
|
||||
<body>
|
||||
<main>
|
||||
<div>
|
||||
<img class="colin" [src]="colin" alt="Photo-Colin" />
|
||||
<h1>COLIN FRIZOT</h1>
|
||||
<p>Bonjour, je suis Colin, un poisson développeur. (fraude)</p>
|
||||
|
||||
<img class="hugo" [src]="hugo" alt="Photo-Hugo" />
|
||||
<h1>HUGO PRADIER</h1>
|
||||
<p>
|
||||
Bonjour, je suis Hugo, un développeur bientôt chauve. (suit tous les
|
||||
tutos en ligne, mais ça marche jamais)
|
||||
</p>
|
||||
|
||||
<img class="bastien" [src]="bastien" alt="Photo-Bastien" />
|
||||
<h1>BASTIEN OLLIER</h1>
|
||||
<p>
|
||||
Bonjour, je suis Bastien, un développeur visuellement parlant, très
|
||||
puant. (connaît l'adresse de la grand-mère de Colin)
|
||||
</p>
|
||||
|
||||
<img class="clement" [src]="clement" alt="Photo-Clement" />
|
||||
<h1>CLÉMENT FRÉVILLE</h1>
|
||||
<p>
|
||||
Bonjour, je suis Clément, un développeur meilleur que tes profs. (dieu)
|
||||
</p>
|
||||
|
||||
<img class="matis" [src]="matis" alt="Photo-Matis" />
|
||||
<h1>MATIS MAZINGUE</h1>
|
||||
<p>
|
||||
Bonjour, je suis Matis, un "développeur". (est là que pour l'argent,
|
||||
mais il est nul)
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
@ -1,22 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { OurStoryComponent } from './our-story.component';
|
||||
|
||||
describe('OurStoryComponent', () => {
|
||||
let component: OurStoryComponent;
|
||||
let fixture: ComponentFixture<OurStoryComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [OurStoryComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(OurStoryComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -1,22 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-our-story',
|
||||
templateUrl: './our-story.component.html',
|
||||
styleUrl: './our-story.component.scss',
|
||||
standalone: true,
|
||||
})
|
||||
export class OurStoryComponent {
|
||||
constructor(private router: Router) {}
|
||||
colin: string = 'assets/img/colin.png';
|
||||
hugo: string = 'assets/img/hugo.png';
|
||||
bastien: string = 'assets/img/bastien.png';
|
||||
clement: string = 'assets/img/clement.png';
|
||||
matis: string = 'assets/img/matis.png';
|
||||
|
||||
// Si click sur "Run", on redirige vers la page de notre histoire
|
||||
onContinue(): void {
|
||||
this.router.navigateByUrl('/our-story');
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
body {
|
||||
margin: 0 150px 0 150px;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
body {
|
||||
margin: 0 150px 0 150px;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<div>
|
||||
<h2>Works</h2>
|
||||
|
||||
<ul>
|
||||
<li *ngFor="let work of works">
|
||||
{{ work.id_work }} - {{ work.link }} - {{ work.content }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<form #addBookForm="ngForm" (ngSubmit)="onSubmit(addBookForm)">
|
||||
<div class="form-group">
|
||||
<label for="link">Link</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="link"
|
||||
name="link"
|
||||
ngModel
|
||||
required />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="content">Content</label>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="content"
|
||||
name="content"
|
||||
ngModel
|
||||
required />
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
|
||||
<!--<app-editor></app-editor>-->
|
||||
</div>
|
@ -0,0 +1,56 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { ThemeService } from '../../services/theme.service';
|
||||
import { NgClass } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import {Work} from "../../models/work.model";
|
||||
import {WorkService} from "../../services/work.service";
|
||||
import {NgForOf} from "@angular/common";
|
||||
import {FormsModule, NgForm} from "@angular/forms";
|
||||
|
||||
@Component({
|
||||
selector: 'app-work',
|
||||
templateUrl: './work.component.html',
|
||||
styleUrl: './work.component.scss',
|
||||
standalone: true,
|
||||
imports: [NgClass,
|
||||
TranslateModule,
|
||||
RouterLink,
|
||||
NgForOf,
|
||||
FormsModule
|
||||
],
|
||||
})
|
||||
|
||||
export class WorkComponent implements OnInit {
|
||||
// à retirer quand les boutons seront dans editor.component
|
||||
isLoaded: boolean = false; // Pour vérifier si le chargement est terminé
|
||||
|
||||
themeClass!: string;
|
||||
works: Work[] = [];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private themeService: ThemeService,
|
||||
protected workService: WorkService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.themeService.isDarkTheme.subscribe((value) => {
|
||||
value
|
||||
? (this.themeClass = 'dark-theme')
|
||||
: (this.themeClass = 'light-theme');
|
||||
});
|
||||
this.workService.getWorks().subscribe((response: Work[]) => this.works = response);
|
||||
}
|
||||
|
||||
|
||||
// Si click sur "Work", on redirige vers la page des travaux
|
||||
onContinue(): void {
|
||||
this.router.navigateByUrl('/work');
|
||||
}
|
||||
|
||||
|
||||
onSubmit(form: NgForm) {
|
||||
this.workService.postWork(form);
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
<h2>Works</h2>
|
||||
|
||||
<ul>
|
||||
<li *ngFor="let work of works">
|
||||
{{ work.id_work }} - {{ work.link }} - {{ work.content }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<form #addBookForm="ngForm" (ngSubmit)="onSubmit(addBookForm)">
|
||||
<div class="form-group">
|
||||
<label for="link">Link</label>
|
||||
<input type="text" class="form-control" id="link" name="link" ngModel required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="content">Content</label>
|
||||
<input type="text" class="form-control" id="content" name="content" ngModel required>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
@ -1,30 +0,0 @@
|
||||
import {Component} from '@angular/core';
|
||||
import {Work} from "../../models/work.model";
|
||||
import {WorksService} from "../../services/works.service";
|
||||
import {NgForOf} from "@angular/common";
|
||||
import {FormsModule, NgForm} from "@angular/forms";
|
||||
|
||||
@Component({
|
||||
selector: 'app-works-list',
|
||||
standalone: true,
|
||||
imports: [
|
||||
NgForOf,
|
||||
FormsModule
|
||||
],
|
||||
templateUrl: './works-list.component.html',
|
||||
styleUrl: './works-list.component.css'
|
||||
})
|
||||
export class WorksListComponent {
|
||||
works: Work[] = [];
|
||||
|
||||
constructor(protected workService: WorksService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.workService.getWorks().subscribe((response: Work[]) => this.works = response)
|
||||
}
|
||||
|
||||
onSubmit(form: NgForm) {
|
||||
this.workService.postWork(form);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WorkService } from './work.service';
|
||||
|
||||
describe('WorkService', () => {
|
||||
let service: WorkService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(WorkService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,34 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Work} from "../models/work.model";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {Observable} from "rxjs";
|
||||
import {NgForm} from "@angular/forms";
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WorkService {
|
||||
API_URL = 'http://127.0.0.1:3000'
|
||||
|
||||
private works: Work[] = [];
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
}
|
||||
|
||||
getWorks(): Observable<any> {
|
||||
return this.http.get(`${this.API_URL}/works`);
|
||||
}
|
||||
|
||||
postWork(form: NgForm): void {
|
||||
let body = {link: crypto.randomUUID(), id_user: 1, id_language: 1, code: form.value.content, saveDate: new Date()}
|
||||
this.http.post<any>(`${this.API_URL}/works`, body).subscribe();
|
||||
}
|
||||
|
||||
postWorkCode(code: string): void {
|
||||
let body = {link: crypto.randomUUID(), id_user: 1, id_language: 1, code: code}
|
||||
this.http.post<any>(`${this.API_URL}/works`, body).subscribe();
|
||||
}
|
||||
|
||||
getIdLastWorkByUserId(id_user: string): string { return ""}
|
||||
}
|
Loading…
Reference in new issue