mirror of
https://gitlab.bixilon.de/bixilon/pixlyzer-vitrine.git
synced 2025-08-03 10:06:35 -04:00
biomes
This commit is contained in:
parent
89816dc11b
commit
966a9cd41f
16121
package-lock.json
generated
16121
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,7 @@
|
||||
"@angular/platform-browser": "~11.2.13",
|
||||
"@angular/platform-browser-dynamic": "~11.2.13",
|
||||
"@angular/router": "~11.2.13",
|
||||
"ngx-color-picker": "^11.0.0",
|
||||
"rxjs": "~6.6.0",
|
||||
"tslib": "^2.0.0",
|
||||
"zone.js": "~0.11.3"
|
||||
|
@ -1,6 +1,22 @@
|
||||
<!--
|
||||
~ Minosoft
|
||||
~ Copyright (C) 2021 Moritz Zwerger
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
~
|
||||
~ This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
-->
|
||||
|
||||
<html>
|
||||
<mat-tab-group [selectedIndex]="1">
|
||||
<mat-tab label="Blocks" disabled> Coming soon</mat-tab>
|
||||
<mat-tab label="Biomes">
|
||||
<app-biomes [biomes]="data.biomes"></app-biomes>
|
||||
</mat-tab>
|
||||
<mat-tab label="Version">
|
||||
<app-version [version]="data.version"></app-version>
|
||||
</mat-tab>
|
||||
|
@ -23,13 +23,23 @@ import {MatCardModule} from '@angular/material/card';
|
||||
import {MatDatepickerModule} from '@angular/material/datepicker';
|
||||
import {MatInputModule} from '@angular/material/input';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {CardComponent} from './version/card/card.component';
|
||||
import {SimplePropertyComponent} from './version/simple-property/simple-property.component';
|
||||
import {BiomesComponent} from './biomes/biomes.component';
|
||||
import {BiomeComponent} from './biomes/biome/biome.component';
|
||||
import {ColorPickerModule} from 'ngx-color-picker';
|
||||
import {MatListModule} from '@angular/material/list';
|
||||
import {ColorDisplayComponent} from './color-display/color-display.component';
|
||||
import {CardPropertyComponent} from './card-property/card-property.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
VersionComponent,
|
||||
CardComponent
|
||||
SimplePropertyComponent,
|
||||
BiomesComponent,
|
||||
BiomeComponent,
|
||||
ColorDisplayComponent,
|
||||
CardPropertyComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -40,22 +50,12 @@ import {CardComponent} from './version/card/card.component';
|
||||
MatDatepickerModule,
|
||||
MatInputModule,
|
||||
FormsModule,
|
||||
ColorPickerModule,
|
||||
MatListModule,
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule {
|
||||
|
||||
public static formatValue(value: any): string {
|
||||
switch (value) {
|
||||
case true:
|
||||
case 'true':
|
||||
return '<p class="true">true</p>';
|
||||
case false:
|
||||
case 'false':
|
||||
return '<p class="false">false</p>';
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
33
src/app/biomes/biome/biome.component.html
Normal file
33
src/app/biomes/biome/biome.component.html
Normal file
@ -0,0 +1,33 @@
|
||||
<!--
|
||||
~ Minosoft
|
||||
~ Copyright (C) 2021 Moritz Zwerger
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
~
|
||||
~ This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
-->
|
||||
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-subtitle>{{resourceLocation}}</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<mat-list>
|
||||
<app-card-property [value]="resourceLocation" icon="fingerprint" name="Resource Location"></app-card-property>
|
||||
<app-card-property [value]="data.id" icon="tag" name="Id"></app-card-property>
|
||||
<app-card-property [value]="data.depth" icon="golf_course" name="Depth"></app-card-property>
|
||||
<app-card-property [value]="data.scale" icon="linear_scale" name="Scale"></app-card-property>
|
||||
<app-card-property [value]="data.temperature" icon="thermostat" name="Temperature"></app-card-property>
|
||||
|
||||
<app-card-property [value]="data.water_color" icon="opacity" name="Water color" type="color"></app-card-property>
|
||||
<app-card-property [value]="data.water_fog_color" icon="water_drop" name="Water fog color" type="color"></app-card-property>
|
||||
<app-card-property [value]="data.fog_color" icon="lens_blur" name="Fog color" type="color"></app-card-property>
|
||||
<app-card-property [value]="data.sky_color" icon="cloud" name="Sky color" type="color"></app-card-property>
|
||||
</mat-list>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
@ -13,21 +13,21 @@
|
||||
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {CardComponent} from './card.component';
|
||||
import {BiomeComponent} from './biome.component';
|
||||
|
||||
describe('CardComponent', () => {
|
||||
let component: CardComponent;
|
||||
let fixture: ComponentFixture<CardComponent>;
|
||||
describe('BiomeComponent', () => {
|
||||
let component: BiomeComponent;
|
||||
let fixture: ComponentFixture<BiomeComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [CardComponent]
|
||||
declarations: [BiomeComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CardComponent);
|
||||
fixture = TestBed.createComponent(BiomeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
34
src/app/biomes/biome/biome.component.ts
Normal file
34
src/app/biomes/biome/biome.component.ts
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-biomes-biome',
|
||||
templateUrl: './biome.component.html',
|
||||
styleUrls: ['./biome.component.css']
|
||||
})
|
||||
export class BiomeComponent implements OnInit {
|
||||
@Input()
|
||||
resourceLocation: string;
|
||||
@Input()
|
||||
data: any;
|
||||
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
13
src/app/biomes/biomes.component.css
Normal file
13
src/app/biomes/biomes.component.css
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
14
src/app/biomes/biomes.component.html
Normal file
14
src/app/biomes/biomes.component.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!--
|
||||
~ Minosoft
|
||||
~ Copyright (C) 2021 Moritz Zwerger
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
~
|
||||
~ This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
-->
|
||||
|
||||
<app-biomes-biome *ngFor="let biome of biomes | keyvalue:originalOrder" [data]="biome.value" [resourceLocation]="biome.key"></app-biomes-biome>
|
38
src/app/biomes/biomes.component.spec.ts
Normal file
38
src/app/biomes/biomes.component.spec.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {BiomesComponent} from './biomes.component';
|
||||
|
||||
describe('BiomesComponent', () => {
|
||||
let component: BiomesComponent;
|
||||
let fixture: ComponentFixture<BiomesComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [BiomesComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BiomesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
36
src/app/biomes/biomes.component.ts
Normal file
36
src/app/biomes/biomes.component.ts
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {KeyValue} from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-biomes',
|
||||
templateUrl: './biomes.component.html',
|
||||
styleUrls: ['./biomes.component.css']
|
||||
})
|
||||
export class BiomesComponent implements OnInit {
|
||||
@Input()
|
||||
biomes: any;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
originalOrder = (a: KeyValue<any, any>, b: KeyValue<any, any>): number => {
|
||||
return 0;
|
||||
};
|
||||
|
||||
}
|
13
src/app/card-property/card-property.component.css
Normal file
13
src/app/card-property/card-property.component.css
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
22
src/app/card-property/card-property.component.html
Normal file
22
src/app/card-property/card-property.component.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!--
|
||||
~ Minosoft
|
||||
~ Copyright (C) 2021 Moritz Zwerger
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
~
|
||||
~ This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
-->
|
||||
|
||||
<mat-list-item [style.display]="value == null ? 'none' : 'block'">
|
||||
<mat-icon mat-list-icon>{{icon}}</mat-icon>
|
||||
<div mat-line>{{name}}</div>
|
||||
<div *ngIf="description != null" mat-line>{{description}}</div>
|
||||
<div *ngIf="value != null" mat-line>
|
||||
<span *ngIf="type==='color'"> <app-color-display [color]="value"></app-color-display> </span>
|
||||
<span *ngIf="type!=='color'"> {{formatValue(value)}} </span>
|
||||
</div>
|
||||
</mat-list-item>
|
38
src/app/card-property/card-property.component.spec.ts
Normal file
38
src/app/card-property/card-property.component.spec.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {CardPropertyComponent} from './card-property.component';
|
||||
|
||||
describe('CardPropertyComponent', () => {
|
||||
let component: CardPropertyComponent;
|
||||
let fixture: ComponentFixture<CardPropertyComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [CardPropertyComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CardPropertyComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
45
src/app/card-property/card-property.component.ts
Normal file
45
src/app/card-property/card-property.component.ts
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Formatting} from '../../formatting';
|
||||
|
||||
@Component({
|
||||
selector: 'app-card-property',
|
||||
templateUrl: './card-property.component.html',
|
||||
styleUrls: ['./card-property.component.css']
|
||||
})
|
||||
export class CardPropertyComponent implements OnInit {
|
||||
@Input()
|
||||
name: string;
|
||||
@Input()
|
||||
icon: string;
|
||||
@Input()
|
||||
description: string;
|
||||
@Input()
|
||||
value: any;
|
||||
@Input()
|
||||
type: any;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
|
||||
public formatValue(value: any): string {
|
||||
return Formatting.formatValue(value);
|
||||
}
|
||||
|
||||
}
|
13
src/app/color-display/color-display.component.css
Normal file
13
src/app/color-display/color-display.component.css
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
14
src/app/color-display/color-display.component.html
Normal file
14
src/app/color-display/color-display.component.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!--
|
||||
~ Minosoft
|
||||
~ Copyright (C) 2021 Moritz Zwerger
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
~
|
||||
~ This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
-->
|
||||
|
||||
<div [style.background-color]="hexColor" [style.color]="getContractColor()">{{hexColor}}</div>
|
38
src/app/color-display/color-display.component.spec.ts
Normal file
38
src/app/color-display/color-display.component.spec.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ColorDisplayComponent} from './color-display.component';
|
||||
|
||||
describe('ColorDisplayComponent', () => {
|
||||
let component: ColorDisplayComponent;
|
||||
let fixture: ComponentFixture<ColorDisplayComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ColorDisplayComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ColorDisplayComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
52
src/app/color-display/color-display.component.ts
Normal file
52
src/app/color-display/color-display.component.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-color-display',
|
||||
templateUrl: './color-display.component.html',
|
||||
styleUrls: ['./color-display.component.css']
|
||||
})
|
||||
export class ColorDisplayComponent implements OnInit {
|
||||
@Input()
|
||||
color: any;
|
||||
|
||||
hexColor: string;
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (typeof this.color === 'number') {
|
||||
this.hexColor = this.intToColor(this.color);
|
||||
} else {
|
||||
this.hexColor = '#' + this.color.toString();
|
||||
}
|
||||
}
|
||||
|
||||
intToColor(int: number): string {
|
||||
return '#' + int.toString(16).padStart(6, '0');
|
||||
}
|
||||
|
||||
// thanks https://stackoverflow.com/questions/11867545/change-text-color-based-on-brightness-of-the-covered-background-area
|
||||
getContractColor(): string {
|
||||
const hexColor = this.hexColor.replace('#', '');
|
||||
const r = parseInt(hexColor.substr(0, 2), 16);
|
||||
const g = parseInt(hexColor.substr(2, 2), 16);
|
||||
const b = parseInt(hexColor.substr(4, 2), 16);
|
||||
const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
|
||||
return (yiq >= 128) ? 'black' : 'white';
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
mat-card {
|
||||
background: aliceblue;
|
||||
margin: 20px;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {SimplePropertyComponent} from './card.component';
|
||||
|
||||
describe('CardComponent', () => {
|
||||
let component: SimplePropertyComponent;
|
||||
let fixture: ComponentFixture<SimplePropertyComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [SimplePropertyComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SimplePropertyComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -15,11 +15,11 @@ import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Formatting} from '../../../formatting';
|
||||
|
||||
@Component({
|
||||
selector: 'app-card',
|
||||
templateUrl: './card.component.html',
|
||||
styleUrls: ['./card.component.css']
|
||||
selector: 'app-simple-property',
|
||||
templateUrl: './simple-property.component.html',
|
||||
styleUrls: ['./simple-property.component.css']
|
||||
})
|
||||
export class CardComponent implements OnInit {
|
||||
export class SimplePropertyComponent implements OnInit {
|
||||
@Input()
|
||||
icon: string;
|
||||
@Input()
|
@ -11,18 +11,18 @@
|
||||
~ This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
-->
|
||||
|
||||
<app-card [data]="version.id" [icon]="'fingerprint'" [title]="'Id'"></app-card>
|
||||
<app-simple-property *ngIf="version.id != null" [data]="version.id" [icon]="'fingerprint'" [title]="'Id'"></app-simple-property>
|
||||
|
||||
<app-card [data]="version.name" [icon]="'label'" [title]="'Name'"></app-card>
|
||||
<app-simple-property *ngIf="version.name != null" [data]="version.name" [icon]="'label'" [title]="'Name'"></app-simple-property>
|
||||
|
||||
<app-card [data]="version.stable" [icon]="'video_stable'" [title]="'Is stable'"></app-card>
|
||||
<app-simple-property *ngIf="version.stable != null" [data]="version.stable" [icon]="'video_stable'" [title]="'Is stable'"></app-simple-property>
|
||||
|
||||
<app-card [data]="version.world_version" [icon]="'public'" [title]="'World version'"></app-card>
|
||||
<app-simple-property *ngIf="version.world_version != null" [data]="version.world_version" [icon]="'public'" [title]="'World version'"></app-simple-property>
|
||||
|
||||
<app-card [data]="formatProtocolVersion(version.protocol_version)" [icon]="'wifi'" [title]="'Protocol version'"></app-card>
|
||||
<app-simple-property *ngIf="version.protocol_version != null" [data]="formatProtocolVersion(version.protocol_version)" [icon]="'wifi'" [title]="'Protocol version'"></app-simple-property>
|
||||
|
||||
<app-card [data]="version.pack_version" [icon]="'local_shipping'" [title]="'Pack version'"></app-card>
|
||||
<app-simple-property *ngIf="version.pack_version != null" [data]="version.pack_version" [icon]="'local_shipping'" [title]="'Pack version'"></app-simple-property>
|
||||
|
||||
<app-card [data]="version.build_time" [icon]="'schedule'" [title]="'Build time'"></app-card>
|
||||
<app-simple-property *ngIf="version.build_time != null" [data]="version.build_time" [icon]="'schedule'" [title]="'Build time'"></app-simple-property>
|
||||
|
||||
<app-card [data]="version.release_target" [icon]="'adjust'" [title]="'Release target'"></app-card>
|
||||
<app-simple-property *ngIf="version.release_target != null" [data]="version.release_target" [icon]="'adjust'" [title]="'Release target'"></app-simple-property>
|
||||
|
@ -29,7 +29,7 @@
|
||||
},
|
||||
"max-classes-per-file": false,
|
||||
"max-line-length": [
|
||||
true,
|
||||
false,
|
||||
140
|
||||
],
|
||||
"member-ordering": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user