diff --git a/.gitignore b/.gitignore index 5964d03..ceb01d9 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ npm-debug.log testem.log /typings package-lock.json +/units # e2e /e2e/*.js diff --git a/.travis.yml b/.travis.yml index 7127315..56e5ad3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ install: - npm install - npm run electron:linux script: + - npm run test:unit:coverage - npm run test:e2e notifications: email: false diff --git a/README.md b/README.md index e1dd2fb..7d8120d 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ Cette application a été réalisée par des étudiants de Master 1 Génie de l' Pour cela, nous avons utilisé : - Angular v7.1.4 -- Electron v2.0.7 -- Electron Builder v20.28.1 +- Electron v4.0.0 +- Electron Builder v20.36.1 - Bootstrap 4 - le [kit de démarrage](https://github.com/maximegris/angular-electron) de maximegris @@ -28,6 +28,14 @@ Pour assurer le fonctionnement de cette application depuis n'importe quel OS, il Nous utiliserons aussi yarn. +Pour la gestion des mots de passes, il est nécessaire d'avoir installé le package `libsecret` sur Linux. +Selon la distribution, il faut lancer les commandes suivantes : + +- Debian/Ubuntu: `sudo apt-get install libsecret-1-dev` +- Red Hat-based: `sudo yum install libsecret-devel` +- Arch Linux: `sudo pacman -S libsecret` + + ### Installation de Node.js **Windows et macOS** @@ -83,6 +91,8 @@ Installer les dépendances |`node_modules/`| Dossier contenant les modules natifs et installés. | |`release/`| Dossier contenant la release après génération. | |`tests/`| Dossier contenant les fichiers de test. | +|`coverage/`| Dossier contenant le résultat de la couverture de code. | +|`units/units.html`| Fichier de rapport des tests unitaires. | |`src/styles.scss`| Feuille de style globale. | |`src/variables.scss`| Feuille des variables de style. | |`src/assets/`| Dossier contenant les fichiers de traduction. | @@ -106,11 +116,18 @@ Comme expliqué plus haut, nous avons utilisé le kit de démarrage. Le fichier |`yarn electron:linux`| Sous Linux, build l'application et crée un `.AppImage`. | |`yarn electron:windows`| Sous Windows, build l'application et crée un `.exe`, exécutable pour les systèmes en 32 et 64 bits. | |`yarn electron:mac`| Sous macOS, build l'application et crée un `.dmg` contenant le `.app`. | +|`yarn test:unit`| Lance les tests unitaires | +|`yarn test:unit:coverage`| Lance les tests unitaires et le couvrage de code | |`yarn test:e2e`| Lance les tests end-to-end (e2e) | ⚠️ Il faut supprimer le dossier release avant d'en regénérer un autre ⚠️ -## Lancer les tests +## Lancer les tests unitaires + +Il est nécessaire d'avoir installé chrome auparavant sur son ordinateur pour lancer les tests unitaires. +Une fois cette condition réalisée, il suffit de lancé `yarn test:unit`. Le rapport est alors disponible dans `units/units.html`. + +## Lancer les tests end-to-end Comme expliqué ci-dessus, la commande `yarn test:e2e` lance les tests end-to-end. Cependant, il est nécessaire de créer une release avant de lancer cette commande. diff --git a/angular.json b/angular.json index 2344834..5bf0e75 100644 --- a/angular.json +++ b/angular.json @@ -97,6 +97,13 @@ "polyfills": "src/polyfills-test.ts", "tsConfig": "src/tsconfig.spec.json", "karmaConfig": "src/karma.conf.js", + "codeCoverageExclude": [ + "src/app/providers/*", + "src/app/components/**", + "src/app/screens/toolbox/**", + "src/app/models/**", + "src/environments/**" + ], "scripts": [], "styles": [ "src/styles.scss" diff --git a/e2e/app.e2e-spec.ts b/e2e/app.e2e-spec.ts deleted file mode 100644 index a481968..0000000 --- a/e2e/app.e2e-spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { GitHarponPage } from './app.po'; -import { browser, element, by } from 'protractor'; - -describe('git-harpon App', () => { - let page: AngularElectronPage; - - beforeEach(() => { - page = new AngularElectronPage(); - }); - - it('should display message saying App works !', () => { - page.navigateTo('/'); - expect(element(by.css('app-home h1')).getText()).toMatch('App works !'); - }); -}); diff --git a/e2e/app.po.ts b/e2e/app.po.ts deleted file mode 100644 index a4151f3..0000000 --- a/e2e/app.po.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { browser, element, by } from 'protractor'; - -/* tslint:disable */ -export class GitHarponPage { - navigateTo(route: string) { - return browser.get(route); - } -} diff --git a/e2e/protractor.conf.js b/e2e/protractor.conf.js deleted file mode 100644 index e46f106..0000000 --- a/e2e/protractor.conf.js +++ /dev/null @@ -1,37 +0,0 @@ -// Protractor configuration file, see link for more information -// https://github.com/angular/protractor/blob/master/lib/config.ts - -const { SpecReporter } = require('jasmine-spec-reporter'); - -exports.config = { - allScriptsTimeout: 25000, - delayBrowserTimeInSeconds: 0, - specs: [ - './**/*.e2e-spec.ts' - ], - capabilities: { - 'browserName': 'chrome', - chromeOptions: { - args: ["--no-sandbox", "--headless", "--disable-gpu"] - } - }, - chromeOnly: true, - directConnect: true, - baseUrl: 'http://localhost:4200/', - framework: 'jasmine2', - jasmineNodeOpts: { - showColors: true, - defaultTimeoutInterval: 30000, - print: function () { }, - realtimeFailure: true - }, - useAllAngular2AppRoots: true, - beforeLaunch: function () { - require('ts-node').register({ - project: 'e2e/tsconfig.e2e.json' - }); - }, - onPrepare() { - jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); - } -}; diff --git a/e2e/tsconfig.e2e.json b/e2e/tsconfig.e2e.json deleted file mode 100644 index ac7a373..0000000 --- a/e2e/tsconfig.e2e.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/e2e", - "module": "commonjs", - "target": "es5", - "types":[ - "jasmine", - "node" - ] - } -} diff --git a/package.json b/package.json index 5c6b926..f4c5e15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,13 @@ { "name": "git-harpon", - "version": "1.0.0", + "version": "1.1.0", + "description": "Open-source GUI for git", + "author": { + "name": "GitHarpon", + "email": "githarpon@gmail.com", + "url": "https://github.com/GitHarpon" + }, + "license": "SEE LICENSE IN LICENSE.md", "keywords": [ "angular", "angular 7", @@ -28,9 +35,10 @@ "electron:linux": "npm run build:prod && npx electron-builder build --linux", "electron:windows": "npm run build:prod && npx electron-builder build --windows", "electron:mac": "npm run build:prod && npx electron-builder build --mac", - "test": "npm run postinstall:web && ng test", "e2e": "npm run postinstall:web && ng e2e", - "test:e2e": "mocha --timeout 15000 tests/test.js" + "test:unit": "npm run postinstall:web && ng test", + "test:unit:coverage": "npm run postinstall:web && ng test --watch=false --code-coverage", + "test:e2e": "mocha --timeout 15000 tests/*.js" }, "dependencies": { "@angular/animations": "^7.2.4", @@ -38,22 +46,28 @@ "@angular/material": "^7.3.1", "@angular/platform-server": "^7.1.4", "@ng-bootstrap/ng-bootstrap": "^4.0.2", + "angular-resizable-element": "^3.2.3", "bootstrap": "4.1.3", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", + "git-url-parse": "^11.1.2", "jquery": "^3.3.1", + "karma-htmlfile-reporter": "^0.3.8", "mocha": "^5.2.0", "mocha-sinon": "^2.1.0", "monaco-editor": "^0.14.3", "ngx-clipboard": "^11.1.9", "ngx-contextmenu": "^5.1.1", "ngx-scrollbar": "^4.1.1", + "ngx-store": "^2.1.0", "ngx-toastr": "^9.1.1", "popper.js": "^1.14.7", "rxjs-compat": "^6.3.3", "rxjs-tslint": "^0.1.6", + "simple-git": "^1.107.0", "sinon": "^7.2.3", - "spectron": "^5.0.0" + "spectron": "^5.0.0", + "valid-url": "^1.0.9" }, "devDependencies": { "@angular-devkit/build-angular": "^0.11.4", @@ -76,7 +90,7 @@ "@types/node": "^10.12.18", "codelyzer": "^4.5.0", "core-js": "^2.6.1", - "electron": "^4.0.0", + "electron": "4.0.0", "electron-builder": "20.36.1", "electron-reload": "1.3.0", "jasmine-core": "^3.3.0", @@ -97,5 +111,9 @@ "wait-on": "2.1.0", "webdriver-manager": "12.0.6", "zone.js": "^0.8.26" + }, + "browser": { + "fs": false, + "child_process": false } } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4bae517..c5a27d6 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,8 +1,9 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { ToolboxComponent } from './components/toolbox/toolbox.component'; -import { HomeComponent } from './components/home/home.component'; +import { ToolboxComponent } from './screens/toolbox/toolbox.component'; +import { HomeComponent } from './screens/home/home.component'; +import { PreferencesComponent } from './screens/preferences/preferences.component'; const ROUTES: Routes = [ { @@ -17,6 +18,10 @@ const ROUTES: Routes = [ { path: 'toolbox', component: ToolboxComponent + }, + { + path: 'preferences', + component: PreferencesComponent } ]; diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts deleted file mode 100644 index e8f25b5..0000000 --- a/src/app/app.component.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { TestBed, async } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { AppComponent } from './app.component'; -import { TranslateModule } from '@ngx-translate/core'; -import { ElectronService } from './providers/electron.service'; - -describe('AppComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ - AppComponent - ], - providers: [ - ElectronService - ], - imports: [ - RouterTestingModule, - TranslateModule.forRoot() - ] - }).compileComponents(); - })); - - it('should create the app', async(() => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - })); -}); - -class TranslateServiceStub { - setDefaultLang(lang: string): void { - } -} diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 780e174..c0c858c 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -13,15 +13,11 @@ export class AppComponent { private translate: TranslateService) { this.translate.addLangs(['fr', 'en']); - this.translate.setDefaultLang(this.translate.getLangs()[0]); - console.log('AppConfig', AppConfig); - if (electronService.isElectron()) { - console.log('Mode electron'); - console.log('Electron ipcRenderer', electronService.ipcRenderer); - console.log('NodeJS childProcess', electronService.childProcess); + if (localStorage.getItem('lang') === null || localStorage.getItem('lang') === 'fr') { + this.translate.setDefaultLang('fr'); } else { - console.log('Mode web'); + this.translate.setDefaultLang('en'); } } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 926dda2..df1cf07 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -10,16 +10,20 @@ import { HttpClientModule, HttpClient } from '@angular/common/http'; import { AppRoutingModule } from './app-routing.module'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { NgScrollbarModule } from 'ngx-scrollbar'; -import {MatTabsModule, MatIconModule } from '@angular/material'; +import { MatTabsModule, MatIconModule, MatExpansionModule, MatSortModule, MatFormFieldModule } from '@angular/material'; import { ContextMenuModule } from 'ngx-contextmenu'; import { ClipboardModule } from 'ngx-clipboard'; - +import { ResizableModule } from 'angular-resizable-element'; // NG Translate import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { ElectronService } from './providers/electron.service'; +import { GitService } from './providers/git.service'; +import { LanguagePreferencesService } from './providers/language-preferences.service'; +import { TerminalManagerService } from './providers/terminal-manager.service'; +import { ThemePreferencesService } from './providers/theme-preferences.service'; import { WebviewDirective } from './directives/webview.directive'; @@ -27,12 +31,13 @@ import { AppComponent } from './app.component'; import { MonacoEditorWrapperComponent } from './components/monaco-wrapper/monaco-editor-wrapper.component'; import { CommonModule } from '@angular/common'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { WebStorageModule } from 'ngx-store'; import { ToastrModule } from 'ngx-toastr'; import { EditorPreferencesService } from './providers/editor-preferences.service'; import { FooterComponent } from './components/footer/footer.component'; -import { HomeComponent } from './components/home/home.component'; -import { ToolboxComponent } from './components/toolbox/toolbox.component'; +import { HomeComponent } from './screens/home/home.component'; +import { ToolboxComponent } from './screens/toolbox/toolbox.component'; import { ContainerComponent } from './components/container/container.component'; import { CheckboxComponent } from './components/checkbox/checkbox.component'; import { ButtonComponent } from './components/button/button.component'; @@ -43,6 +48,9 @@ import { LoaderComponent } from './components/loader/loader.component'; import { ModalComponent } from './components/modal/modal.component'; import { InputNumberComponent } from './components/input-number/input-number.component'; import { CopyButtonComponent } from './components/copy-button/copy-button.component'; +import { PreferencesComponent } from './screens/preferences/preferences.component'; +import { AccordionComponent } from './components/accordion/accordion.component'; +import { InfoBarComponent } from './components/info-bar/info-bar.component'; // AoT requires an exported function for factories @@ -67,12 +75,18 @@ export function HttpLoaderFactory(http: HttpClient) { LoaderComponent, ModalComponent, InputNumberComponent, - CopyButtonComponent + CopyButtonComponent, + PreferencesComponent, + AccordionComponent, + InfoBarComponent ], imports: [ ReactiveFormsModule, MatIconModule, MatTabsModule, + MatSortModule, + MatExpansionModule, + MatFormFieldModule, NgScrollbarModule, NgbModule, ClipboardModule, @@ -81,6 +95,8 @@ export function HttpLoaderFactory(http: HttpClient) { FormsModule, HttpClientModule, AppRoutingModule, + ResizableModule, + WebStorageModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, @@ -94,7 +110,14 @@ export function HttpLoaderFactory(http: HttpClient) { useBootstrap4: true }) ], - providers: [ElectronService, EditorPreferencesService], + providers: [ + ElectronService, + GitService, + EditorPreferencesService, + LanguagePreferencesService, + ThemePreferencesService, + TerminalManagerService + ], bootstrap: [AppComponent] }) export class AppModule { } diff --git a/src/app/components/accordion/accordion.component.html b/src/app/components/accordion/accordion.component.html new file mode 100644 index 0000000..cbf6f35 --- /dev/null +++ b/src/app/components/accordion/accordion.component.html @@ -0,0 +1,12 @@ + + + + {{ title }} + + +
    +
  • branche test
  • +
+
+
+
\ No newline at end of file diff --git a/src/app/components/accordion/accordion.component.scss b/src/app/components/accordion/accordion.component.scss new file mode 100644 index 0000000..039cd2b --- /dev/null +++ b/src/app/components/accordion/accordion.component.scss @@ -0,0 +1,95 @@ +@import '../../../variables.scss'; + +.gh-accordion { + & i { + float: left; + padding: 5px; + font-size: 12px; + } + + & /deep/ .card { + @include wX(340px); + margin-bottom: 76px; + border: 0; + } + + & /deep/ .card-block { + @include wX(340px); + } + + & /deep/ .card-header { + @include wX(340px); + padding: 0; + border-radius: 0 !important; + } + + & /deep/ .card-body { + @include wX(340px); + font-size: 12px; + } + + & /deep/ .btn-link { + font-size: 12px; + @include wX(100%); + text-decoration: none; + text-align: left; + + &:hover, &:focus { + text-decoration: none; + } + } + +} + +.gh-accordion.dark { + & /deep/ .card { + border: 1px solid $light-grey; + background: $light-grey; + } + + & /deep/ .card-header { + background: $light-grey; + border: 1px solid $dark-grey; + + & .icon-dark { + color: $muted-white; + } + } + + & /deep/ .card-body { + background: $dark-grey; + color: $white; + border: 1px solid $dark-grey; + } + + & /deep/ .btn-link { + color: $white; + &:hover, &:focus { + color: $white; + } + } +} + + +.gh-accordion.light { + & /deep/ .card-header { + background: $dark-grey-light; + border: 1px solid $border-dark-grey-light; + & .icon-light { + color: rgb(141, 141, 141); + } + } + + & /deep/ .card-body { + background: $light-grey-light; + color: $dark; + border: 1px solid $border-dark-grey-light; + } + + & /deep/ .btn-link { + color: $dark; + &:hover, &:focus { + color: $dark; + } + } +} \ No newline at end of file diff --git a/src/app/components/accordion/accordion.component.ts b/src/app/components/accordion/accordion.component.ts new file mode 100644 index 0000000..0426842 --- /dev/null +++ b/src/app/components/accordion/accordion.component.ts @@ -0,0 +1,33 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { Subscription } from 'rxjs'; +import { ThemePreferencesService } from '../../providers/theme-preferences.service'; + +@Component({ + selector: 'app-accordion', + templateUrl: './accordion.component.html', + styleUrls: ['./accordion.component.scss'] +}) +export class AccordionComponent implements OnInit { + + @Input() title: String; + @Input() disabled: Boolean = false; + @Input() icon: { + name: String, + isFab: Boolean + }; + themePrefSubscription: Subscription; + currentTheme: string; + + constructor(private themePrefService: ThemePreferencesService) { + this.themePrefSubscription = this.themePrefService.themePreferenceSubject.subscribe( + (newTheme: string) => { + this.currentTheme = newTheme; + } + ); + this.themePrefService.emitThemePreferencesSubject(); + } + + ngOnInit() { + } + +} diff --git a/src/app/components/button/button.component.html b/src/app/components/button/button.component.html index cd6ddc7..09dbe46 100644 --- a/src/app/components/button/button.component.html +++ b/src/app/components/button/button.component.html @@ -1,2 +1,2 @@ \ No newline at end of file + [ngClass]="[type + '-' + currentTheme, (disabled ? 'disabled' : ''), (large ? 'large' : '')]" /> \ No newline at end of file diff --git a/src/app/components/button/button.component.scss b/src/app/components/button/button.component.scss index 890072b..73bfa9e 100644 --- a/src/app/components/button/button.component.scss +++ b/src/app/components/button/button.component.scss @@ -3,12 +3,11 @@ .gh-button { border-style: solid; border-radius: 2px; - color: $white; outline: none; - - &.primary { + &.primary-dark { @include bg-color($dark-blue); border-color: $light-blue; + color: $white; cursor: pointer; &:hover { @@ -27,10 +26,33 @@ } } - &.success { + &.primary-light { + @include bg-color($light-blue-light); + border-color: $dark-blue-light; + cursor: pointer; + color: $dark; + + &:hover { + @include bg-color($dark-blue-light); + } + + &.disabled { + @include bg-color($disabled-blue-light); + border-color: $dark-blue-light; + color: $dark; + + &:hover { + cursor: not-allowed; + color: $white; + } + } + } + + &.success-dark { @include bg-color($dark-green); border-color: $light-green; cursor: pointer; + color: $white; &:hover { @include bg-color($light-green); @@ -49,10 +71,34 @@ } } - &.danger { + &.success-light { + @include bg-color($light-green-light); + border-color: $dark-green-light; + cursor: pointer; + color: $dark; + + &:hover { + @include bg-color($dark-green-light); + } + + &.disabled { + @include bg-color($disabled-green-light); + border-color: $dark-green-light; + color: $dark; + + + &:hover { + cursor: not-allowed; + color: $white; + } + } + } + + &.danger-dark { @include bg-color($dark-red); border-color: $light-red; cursor: pointer; + color: $white; &:hover { @include bg-color($light-red); @@ -69,6 +115,28 @@ } } } + + &.danger-light { + @include bg-color($light-red-light); + border-color: $dark-red-light; + cursor: pointer; + color: $dark; + + &:hover { + @include bg-color($dark-red-light); + } + + &.disabled { + @include bg-color($disabled-red-light); + border-color: $dark-red-light; + color: $dark; + + &:hover { + cursor: not-allowed; + color: $white; + } + } + } } .large { diff --git a/src/app/components/button/button.component.spec.ts b/src/app/components/button/button.component.spec.ts deleted file mode 100644 index 794fc67..0000000 --- a/src/app/components/button/button.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ButtonComponent } from './button.component'; - -describe('ButtonComponent', () => { - let component: ButtonComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ButtonComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ButtonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/button/button.component.ts b/src/app/components/button/button.component.ts index a911cd3..e5ba507 100644 --- a/src/app/components/button/button.component.ts +++ b/src/app/components/button/button.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; +import { ThemePreferencesService } from '../../providers/theme-preferences.service'; +import { Subscription } from 'rxjs'; @Component({ selector: 'app-button', @@ -14,8 +16,16 @@ export class ButtonComponent implements OnInit { @Input() large: Boolean = false; @Input() type: String = 'primary'; @Output() buttonClicked: EventEmitter = new EventEmitter(); + themePrefSubscription: Subscription; + currentTheme: string; - constructor(private translateService: TranslateService) { + constructor(private translateService: TranslateService, private themePrefService: ThemePreferencesService) { + this.themePrefSubscription = this.themePrefService.themePreferenceSubject.subscribe( + (newTheme: string) => { + this.currentTheme = newTheme; + } + ); + this.themePrefService.emitThemePreferencesSubject(); } ngOnInit() { diff --git a/src/app/components/checkbox/checkbox.component.spec.ts b/src/app/components/checkbox/checkbox.component.spec.ts deleted file mode 100644 index be613b0..0000000 --- a/src/app/components/checkbox/checkbox.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CheckboxComponent } from './checkbox.component'; - -describe('CheckboxComponent', () => { - let component: CheckboxComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CheckboxComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CheckboxComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/checkbox/checkbox.component.ts b/src/app/components/checkbox/checkbox.component.ts index ffcb214..3247bf2 100644 --- a/src/app/components/checkbox/checkbox.component.ts +++ b/src/app/components/checkbox/checkbox.component.ts @@ -24,8 +24,7 @@ export class CheckboxComponent implements OnInit { this.valueChange.emit(this.currentValue); } - constructor(private electronService: ElectronService, - private toastr: ToastrService, private translateService: TranslateService) { } + constructor() { } ngOnInit() { } diff --git a/src/app/components/container/container.component.html b/src/app/components/container/container.component.html index f72a7f8..5863e19 100644 --- a/src/app/components/container/container.component.html +++ b/src/app/components/container/container.component.html @@ -1,3 +1,3 @@ -
+
\ No newline at end of file diff --git a/src/app/components/container/container.component.scss b/src/app/components/container/container.component.scss index 4e25cb3..cbd9fa0 100644 --- a/src/app/components/container/container.component.scss +++ b/src/app/components/container/container.component.scss @@ -15,12 +15,19 @@ @include wX-hX(100%, calc(100% - #{$footer-height})); overflow: auto; - &.white { + &.light { background-color: $white; + &.gh-border { + border: 1px solid $border-dark-grey-light; + } } &.dark-grey { background-color: $dark-grey; + &.gh-border { + border: 1px solid $dark; + } + } &.light-grey { @@ -35,10 +42,6 @@ background-color: $dark; } - &.dark-border { - border: 1px solid $dark; - } - &.loader-dark { background-color: $dark; opacity: 0.8; diff --git a/src/app/components/container/container.component.spec.ts b/src/app/components/container/container.component.spec.ts deleted file mode 100644 index f71eaab..0000000 --- a/src/app/components/container/container.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ContainerComponent } from './container.component'; - -describe('ContainerComponent', () => { - let component: ContainerComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ContainerComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ContainerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/copy-button/copy-button.component.html b/src/app/components/copy-button/copy-button.component.html index 6aa4f38..5c836fb 100644 --- a/src/app/components/copy-button/copy-button.component.html +++ b/src/app/components/copy-button/copy-button.component.html @@ -1,8 +1,8 @@ -
-
+
+
-
+
diff --git a/src/app/components/copy-button/copy-button.component.scss b/src/app/components/copy-button/copy-button.component.scss index b27286e..1cdc9b1 100644 --- a/src/app/components/copy-button/copy-button.component.scss +++ b/src/app/components/copy-button/copy-button.component.scss @@ -18,7 +18,6 @@ font-size: $fs-medium; &__button { - background: $light-grey; width: 40px; height: 40px; border-radius: 50%; @@ -27,6 +26,13 @@ display: flex; align-items: center; justify-content: center; + &.dark { + background-color: $light-grey; + } + + &.light { + background-color: $button-bar-light; + } } &__copy { diff --git a/src/app/components/copy-button/copy-button.component.spec.ts b/src/app/components/copy-button/copy-button.component.spec.ts deleted file mode 100644 index 115d714..0000000 --- a/src/app/components/copy-button/copy-button.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CopyButtonComponent } from './copy-button.component'; - -describe('CopyButtonComponent', () => { - let component: CopyButtonComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CopyButtonComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CopyButtonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/copy-button/copy-button.component.ts b/src/app/components/copy-button/copy-button.component.ts index 4db0b74..14766a0 100644 --- a/src/app/components/copy-button/copy-button.component.ts +++ b/src/app/components/copy-button/copy-button.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { ClipboardService } from 'ngx-clipboard'; +import { Subscription } from 'rxjs'; +import { ThemePreferencesService } from '../../providers/theme-preferences.service'; @Component({ selector: 'app-copy-button', @@ -10,9 +12,18 @@ export class CopyButtonComponent implements OnInit { @Input() template: string; copy: Boolean; + themePrefSubscription: Subscription; + currentTheme: string; - constructor(private clipboardService: ClipboardService) {} + constructor(private clipboardService: ClipboardService, private themePrefService: ThemePreferencesService) { + this.themePrefSubscription = this.themePrefService.themePreferenceSubject.subscribe( + (newTheme: string) => { + this.currentTheme = newTheme; + } + ); + this.themePrefService.emitThemePreferencesSubject(); + } ngOnInit() { diff --git a/src/app/components/dropdown/dropdown.component.html b/src/app/components/dropdown/dropdown.component.html index d741cfe..d613e45 100644 --- a/src/app/components/dropdown/dropdown.component.html +++ b/src/app/components/dropdown/dropdown.component.html @@ -1,4 +1,4 @@ - - + diff --git a/src/app/components/dropdown/dropdown.component.scss b/src/app/components/dropdown/dropdown.component.scss index dacc1ff..1fa750e 100644 --- a/src/app/components/dropdown/dropdown.component.scss +++ b/src/app/components/dropdown/dropdown.component.scss @@ -10,9 +10,6 @@ } outline: none; - background-color: $dark; - color: $white; - border : 1px solid $dark-grey; border-radius: 3px; font-size: $fs-medium; padding: $gap-md; @@ -25,12 +22,33 @@ outline: 0; } - &.disabled { + &.dark { + background-color: $dark; + color: $white; + border : 1px solid $dark-grey; + &.disabled { color: $muted-white; &:hover { cursor: not-allowed; color: $white; } + } } + + &.light { + background-color: $white; + color: $dark; + border : 1px solid $border-light-grey-light; + + &.disabled { + color: $muted-dark; + + &:hover { + cursor: not-allowed; + color: $dark; + } + } + } + } \ No newline at end of file diff --git a/src/app/components/dropdown/dropdown.component.spec.ts b/src/app/components/dropdown/dropdown.component.spec.ts deleted file mode 100644 index e0edf7a..0000000 --- a/src/app/components/dropdown/dropdown.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { DropdownComponent } from './dropdown.component'; - -describe('DropdownComponent', () => { - let component: DropdownComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ DropdownComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(DropdownComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/components/dropdown/dropdown.component.ts b/src/app/components/dropdown/dropdown.component.ts index 797c7bf..05134de 100644 --- a/src/app/components/dropdown/dropdown.component.ts +++ b/src/app/components/dropdown/dropdown.component.ts @@ -1,4 +1,6 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { Subscription } from 'rxjs'; +import { ThemePreferencesService } from '../../providers/theme-preferences.service'; @Component({ selector: 'app-dropdown', @@ -9,6 +11,8 @@ export class DropdownComponent implements OnInit { @Input() disabled: Boolean = false; @Input() required: Boolean = false; + themePrefSubscription: Subscription; + currentTheme: string; currentValue: string; @Input() idKey: String; @@ -29,7 +33,14 @@ export class DropdownComponent implements OnInit { } } - constructor() { } + constructor(private themePrefService: ThemePreferencesService) { + this.themePrefSubscription = this.themePrefService.themePreferenceSubject.subscribe( + (newTheme: string) => { + this.currentTheme = newTheme; + } + ); + this.themePrefService.emitThemePreferencesSubject(); + } getOptKey(option: any) { if (this.idKey) { @@ -38,11 +49,13 @@ export class DropdownComponent implements OnInit { } isSelected(opt) { - var valeur = this.getOptKey(opt); - if (valeur === this.currentValue) { - return 'selected'; + const Value = this.getOptKey(opt); + const Selected = 'selected'; + const Empty = ''; + if (Value === this.currentValue) { + return Selected; } - return ''; + return Empty; } getOptValue(option: any) { diff --git a/src/app/components/footer/footer.component.html b/src/app/components/footer/footer.component.html index e67f77e..c30f20e 100644 --- a/src/app/components/footer/footer.component.html +++ b/src/app/components/footer/footer.component.html @@ -1,6 +1,6 @@ -