diff --git a/src/app/components/shared/footer/footer.component.html b/src/app/components/shared/footer/footer.component.html index 857d8f6093c8fa644bb1ad82d069ee78d3bd388a..f30c3b5eed16f5d8a4cfcae4b22b003aee42594e 100644 --- a/src/app/components/shared/footer/footer.component.html +++ b/src/app/components/shared/footer/footer.component.html @@ -48,21 +48,27 @@ <div id="themeMenu"> <div class="scrollWrp"> - <button *ngFor="let theme of themes" (click)="changeTheme(theme)" matRipple [matRippleColor]="'rgba(0,0,0,0.1)'"> + <button + *ngFor="let theme of themes" + (click)="changeTheme(theme);" + matRipple [matRippleColor]="'rgba(0,0,0,0.1)'" + title="{{theme.toString()}}" + aria-label="test"> <div class="btnContent"> - <div class="btnColorIcon" [ngStyle]="{'background-color':theme.previewColor}"> - <div class="checked" [ngClass]="{'checked_true':theme.key===themeClass,'checked_false':theme.key!==themeClass}"> - <mat-icon> + <div class="btnColorIcon" [ngStyle]="{'background-color':theme.getPreviewColor()}"> + <div class="checked" + [ngClass]="{'checked_true':theme.key===themeClass,'checked_false':theme.key!==themeClass}"> + <mat-icon [ngStyle]="{'color':theme.getOnPreviewColor()}"> checked </mat-icon> </div> </div> <div class="btnAppend"> <div class="title"> - <p class="title_bold">{{theme.name}}</p> + <p class="title_bold">{{theme.getName(getLanguage())}}</p> </div> <div class="title"> - <p>{{theme.description}}</p> + <p>{{theme.getDescription(getLanguage())}}</p> </div> </div> </div> diff --git a/src/app/components/shared/footer/footer.component.scss b/src/app/components/shared/footer/footer.component.scss index b6fd5bbde1f5c2a67f8cdf66aaec5fccab6c5f1a..e47c98747d698a41fc22951eb0b2dddf4d7d48ae 100644 --- a/src/app/components/shared/footer/footer.component.scss +++ b/src/app/components/shared/footer/footer.component.scss @@ -56,8 +56,24 @@ mat-icon { line-height: 100%!important; } +::ng-deep .color-menu { + padding: 0 8px 0 8px; +} + +.check { + font-size: 25px; + height: 25px; + width: 25px; + line-height: 100%!important; + position: absolute; + top:calc( 50% + 1px ); + left:calc( 50% + 1px ); + transform:translate(-50%,-50%); + color: white; +} + #themeMenu{ - width:250px; + width:100%; height:215px; margin-bottom:8px; float:left; @@ -96,10 +112,6 @@ mat-icon { border-radius:2px; } -.btnContent:hover{ - background-color:rgba(0,0,0,0.05); -} - .btnContent>.btnColorIcon{ width:40px; height:40px; @@ -121,13 +133,21 @@ mat-icon { .checked.checked_true{ transform:scale(1); opacity:1; + background-color:transparent; } .checked.checked_false{ - transform:scale(0.2); + opacity:1; +} + +.checked.checked_false>mat-icon{ opacity:0; } +.checked.checked_true>mat-icon{ + opacity:1; +} + .checked>mat-icon{ float:left; position:relative; @@ -135,6 +155,8 @@ mat-icon { top:50%; transform:translate(-50%,-50%); color:#FFFFFF; + border-radius:100%; + transition:all 0.1s; } .btnContent>.btnAppend{ @@ -173,19 +195,3 @@ mat-icon { color:rgba(0,0,0,0.9); font-weight:500; } - -::ng-deep .color-menu { - padding: 0 8px 0 8px; -} - -.check { - font-size: 25px; - height: 25px; - width: 25px; - line-height: 100%!important; - position: absolute; - top:calc( 50% + 1px ); - left:calc( 50% + 1px ); - transform:translate(-50%,-50%); - color: white; -} diff --git a/src/app/components/shared/footer/footer.component.ts b/src/app/components/shared/footer/footer.component.ts index 5bb17c79674d5b5c61b9aa851e8acbb041eae65d..9864c3612d5e75bd87911c2184c9c9cb549b466f 100644 --- a/src/app/components/shared/footer/footer.component.ts +++ b/src/app/components/shared/footer/footer.component.ts @@ -136,7 +136,11 @@ export class FooterComponent implements OnInit { } changeTheme(theme: Theme) { - this.themeClass = theme.name; - this.themeService.activate(theme.name); + this.themeClass = theme.key; + this.themeService.activate(theme.key); + } + + getLanguage():string{ + return localStorage.getItem('currentLang'); } } diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html index 420bb08bcd105be7d0b63036f96c13918dec0ed9..e5f17e632fc97a51337e9123848dbd8888e13c5e 100644 --- a/src/app/components/shared/header/header.component.html +++ b/src/app/components/shared/header/header.component.html @@ -4,7 +4,7 @@ matTooltip="{{'header.back' | translate}}"> <mat-icon class="header-icons">arrow_back</mat-icon> </button> - <button mat-icon-button> + <button mat-icon-button aria-hidden="true"> <mat-icon class="header-icons" (click)="getRescale().activeScale();">fullscreen</mat-icon> </button> diff --git a/src/theme/Theme.ts b/src/theme/Theme.ts index a931bbb79d0048724b6817e6c35356efb55091f4..c2e4925bffc8926e01fdd5693d950306936a64fe 100644 --- a/src/theme/Theme.ts +++ b/src/theme/Theme.ts @@ -47,21 +47,30 @@ export class Theme { */ public main: ColorElem[]; + public order:number; + public name:ThemeTranslationList; + public description:ThemeTranslationList; + public previewColor:string; + constructor( public key: string, - public name: string, - public description: string, - public previewColor: string, public palette: Object, - public order: number + public meta: Object ) { - + this.order=meta['order']; + this.name=new ThemeTranslationList( + 'name',this.meta['translation']['name'] + ); + this.description=new ThemeTranslationList( + 'description',this.meta['translation']['description'] + ); + this.previewColor=this.palette['--primary']; this.colors = []; this.main = []; for (const k in palette) { if (palette.hasOwnProperty(k)) { - if (k !== 'name' && k !== description) { + if (k !== 'name') { this.colors.push(new ColorElem( k.slice(2, k.length), k, @@ -79,7 +88,6 @@ export class Theme { Theme.variantColors.forEach(e => { this.get(e).variant = this.get(e + '-variant'); }); - } public get(name: string): ColorElem { @@ -89,10 +97,56 @@ export class Theme { return null; } + public getName(language:string):string{ + return this.name.get(language); + } + + public getDescription(language:string):string{ + return this.description.get(language); + } + + public getPreviewColor():string{ + return this.previewColor; + } + + public getOnPreviewColor():string{ + return this.get('primary').on.color; + } + + public getSecondaryColor():string{ + return this.get('secondary').color; + } + public toString(): string { return this.name + ' - ' + this.description; } +} +export class ThemeTranslationList{ + map:string[][]=[]; + + constructor(private name,translation:Object){ + for(let k in translation){ + if(translation.hasOwnProperty(k)){ + this.map.push([k,translation[k]]); + } + } + } + + public get(language:string){ + for(let i=0;i<this.map.length;i++){ + if(this.map[i][0]===language)return this.map[i][1]; + } + console.error('ThemeTranslationList: Translation Error, Unknown Language: '+language); + return 'unknown'; + } } + + + + + + + diff --git a/src/theme/blue-theme/blueTheme.const.ts b/src/theme/blue-theme/blueTheme.const.ts index 4517335c89165238fd97832d10d459b94d32cf32..977d05632b2df84497ab6ddd41a71f3d75e36424 100644 --- a/src/theme/blue-theme/blueTheme.const.ts +++ b/src/theme/blue-theme/blueTheme.const.ts @@ -30,8 +30,16 @@ export const blue = { export const blue_meta = { - 'name': 'NAME', - 'description': 'DESCRIPTION', + 'translation':{ + 'name':{ + 'en':'ENGLISH_NAME', + 'de':'GERMAN_NAME' + }, + 'description':{ + 'en':'ENGLISH_DESCRIPTION', + 'de':'GERMAN_DESCRIPTION' + } + }, 'order': 4 }; diff --git a/src/theme/dark-theme/darkTheme.const.ts b/src/theme/dark-theme/darkTheme.const.ts index 61844e5170ba0ed38575d14a0971fd7d835275f2..2f67c748d171b4294a88a0d57f19a6df8cd62bf0 100644 --- a/src/theme/dark-theme/darkTheme.const.ts +++ b/src/theme/dark-theme/darkTheme.const.ts @@ -30,8 +30,16 @@ export const dark = { export const dark_meta = { - 'name': 'Dark ARSnova', - 'description': 'Dark Default Theme', + 'translation':{ + 'name':{ + 'en':'Dark', + 'de':'Dunkel' + }, + 'description':{ + 'en':'Battery Friendly', + 'de':'Akkufreundliche Darstellung' + } + }, 'order': 3 }; diff --git a/src/theme/default-theme/defaultTheme.const.ts b/src/theme/default-theme/defaultTheme.const.ts index fcbea2708c5b68de8f05134a44e7b17f3965399d..ff37a565128f6ecea58d4c44f0e7285ca4c56263 100644 --- a/src/theme/default-theme/defaultTheme.const.ts +++ b/src/theme/default-theme/defaultTheme.const.ts @@ -30,8 +30,16 @@ export const arsnova = { export const arsnova_meta = { - 'name': 'Light ARSnova', - 'description': 'Bright Theme', + 'translation':{ + 'name':{ + 'en':'Bright', + 'de':'Hell' + }, + 'description':{ + 'en':'Bright Theme', + 'de':'Helle Darstellung' + } + }, 'order': 2 }; diff --git a/src/theme/high-contrast-theme/highContrastTheme.const.ts b/src/theme/high-contrast-theme/highContrastTheme.const.ts index 280eec1dea759826fa2f7876d9f18343e76e1bed..56960947ab40a75f18ac7402836b294162d657b0 100644 --- a/src/theme/high-contrast-theme/highContrastTheme.const.ts +++ b/src/theme/high-contrast-theme/highContrastTheme.const.ts @@ -29,8 +29,16 @@ export const highcontrast = { export const highcontrast_meta = { - 'name': 'High Contrast', - 'description': 'Dark High Contrast Theme', + 'translation':{ + 'name':{ + 'en':'High Contrast', + 'de':'Kontrastreich' + }, + 'description':{ + 'en':'Visibility optimized', + 'de':'Kontrastreiche Darstellung' + } + }, 'order': 0 }; diff --git a/src/theme/purple-theme/purpleTheme.const.ts b/src/theme/purple-theme/purpleTheme.const.ts index a3b4f17e22c580e250955246e087457a926c2a1d..99bb27dc9963db8a27a74ace13b566b9ebaa7c2f 100644 --- a/src/theme/purple-theme/purpleTheme.const.ts +++ b/src/theme/purple-theme/purpleTheme.const.ts @@ -29,8 +29,16 @@ export const purple = { export const purple_meta = { - 'name': 'Projector', - 'description': 'Projector Friendly Theme', + 'translation':{ + 'name':{ + 'en':'Projector', + 'de':'Beamer' + }, + 'description':{ + 'en':'Projector optimized', + 'de':'Beamer optimierte Darstellung' + } + }, 'order': 1 }; diff --git a/src/theme/theme.service.ts b/src/theme/theme.service.ts index 7195401b0c281383a80cb8d5748f0cd294d84505..9393193ffc926ca994813ec3f52fc64db64f003e 100644 --- a/src/theme/theme.service.ts +++ b/src/theme/theme.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; import { themes, themes_meta } from './arsnova-theme.const'; -import { Theme } from './Theme'; +import { Theme, ThemeTranslationList } from './Theme'; @Injectable({ providedIn: 'root' @@ -16,18 +16,14 @@ export class ThemeService { for (const k in themes) { this.themes.push(new Theme( k, - themes_meta[k]['name'], - themes_meta[k]['description'], - themes[k]['--primary'], themes[k], - themes_meta[k]['order']) + themes_meta[k]) ); } this.themes.sort((a, b) => { if (a.order < b.order) {return -1; } else if (a.order > b.order) {return 1; } return 0; }); - console.log(this.themes); } public getTheme() {