Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added settings dialog and implemented dark theme.
- Loading branch information
Showing
22 changed files
with
311 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Action } from '@ngrx/store'; | ||
|
||
export const SHOW_SETTINGS = 'SHOW_SETTINGS'; | ||
export const HIDE_SETTINGS = 'HIDE_SETTINGS'; | ||
|
||
export const SET_THEME = 'SET_THEME'; | ||
export const SET_LANGUAGE = 'SET_LANGUAGE'; | ||
|
||
export class ShowSettingsAction implements Action { | ||
readonly type = SHOW_SETTINGS; | ||
} | ||
|
||
export class HideSettingsAction implements Action { | ||
readonly type = HIDE_SETTINGS; | ||
} | ||
|
||
export class SetThemeAction implements Action { | ||
readonly type = SET_THEME; | ||
|
||
constructor(public payload: { value: string }) {} | ||
} | ||
|
||
export class SetLanguageAction implements Action { | ||
readonly type = SET_LANGUAGE; | ||
|
||
constructor(public payload: { value: string }) { } | ||
} | ||
|
||
export type Action = | ||
| ShowSettingsAction | ||
| HideSettingsAction | ||
| SetThemeAction | ||
| SetLanguageAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/app/components/settings-dialog/settings-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<clr-modal [clrModalOpen]="settings.isShown" (clrModalOpenChange)="toggleDialogChange.next($event)"> | ||
<h3 class="modal-title"> | ||
<div class="app-dialog-header"> | ||
<div class="app-dialog-title">{{ 'SETTINGS_TEXT' | translate }}</div> | ||
{{ 'SETTINGS_SUB_TEXT' | translate }} | ||
</div> | ||
</h3> | ||
<div class="modal-body"> | ||
<div class="app-dialog-body"> | ||
<div class="app-dialog-section"> | ||
<label>{{ 'SETTINGS_THEME_TEXT' | translate }}</label> | ||
<select class="dialog-select" (change)="onSelectTheme($event.target.value)"> | ||
<option *ngFor="let theme of themes" value="{{ theme }}" [selected]="theme === settings.theme"> | ||
{{ theme | titlecase }} | ||
</option> | ||
</select> | ||
</div> | ||
|
||
<div class="app-dialog-section"> | ||
<label>{{ 'SETTINGS_LANGUAGE_TEXT' | translate }}</label> | ||
<select class="dialog-select" (change)="onSelectLanguage($event.target.value)"> | ||
<option *ngFor="let language of languages" value="{{ language[0] }}" [selected]="language === settings.language"> | ||
{{ language[1] | titlecase }} | ||
</option> | ||
</select> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<div class="app-dialog-footer"> | ||
<button class="app-button active-primary right" (click)="toggleDialogChange.next(false)">{{ 'SAVE_BUTTON' | translate }}</button> | ||
</div> | ||
</div> | ||
</clr-modal> |
Empty file.
36 changes: 36 additions & 0 deletions
36
src/app/components/settings-dialog/settings-dialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { FormsModule } from '@angular/forms'; | ||
import { ClarityModule } from 'clarity-angular'; | ||
import { CodemirrorModule } from 'ng2-codemirror'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
|
||
import { SettingsDialogComponent } from './settings-dialog.component'; | ||
|
||
describe('SettingsDialogComponent', () => { | ||
let component: SettingsDialogComponent; | ||
let fixture: ComponentFixture<SettingsDialogComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ SettingsDialogComponent ], | ||
imports: [ | ||
FormsModule, | ||
CodemirrorModule, | ||
ClarityModule.forRoot(), | ||
TranslateModule.forRoot() | ||
] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(SettingsDialogComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
33 changes: 33 additions & 0 deletions
33
src/app/components/settings-dialog/settings-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; | ||
|
||
import config from '../../config'; | ||
|
||
@Component({ | ||
selector: 'app-settings-dialog', | ||
templateUrl: './settings-dialog.component.html', | ||
styleUrls: ['./settings-dialog.component.scss'] | ||
}) | ||
export class SettingsDialogComponent implements OnInit { | ||
|
||
@Input() settings = {}; | ||
@Output() toggleDialogChange = new EventEmitter(); | ||
@Output() themeChange = new EventEmitter(); | ||
@Output() languageChange = new EventEmitter(); | ||
|
||
themes = config.themes; | ||
languages = Object.entries(config.languages); | ||
|
||
constructor() {} | ||
|
||
ngOnInit() { | ||
} | ||
|
||
onSelectTheme(theme) { | ||
return this.themeChange.next(theme); | ||
} | ||
|
||
onSelectLanguage(language) { | ||
return this.languageChange.next(language); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.