Skip to content

Commit

Permalink
Merge pull request #20 from Fasguy/dev
Browse files Browse the repository at this point in the history
v1.1.1
  • Loading branch information
Fasguy authored Sep 4, 2022
2 parents e9f327b + 6437c6d commit e8cc9a8
Show file tree
Hide file tree
Showing 37 changed files with 385 additions and 325 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "toolbox",
"version": "1.1.0",
"version": "1.1.1",
"type": "commonjs",
"scripts": {
"ng": "ng",
"start": "ng serve toolbox-main",
"start-utilities": "ng serve toolbox-utilities --port 4201",
"prebuild": "node --inspect -r ts-node/register projects/toolbox-main/prebuild.ts",
"build": "ng build toolbox-main",
"postbuild": "node --inspect -r ts-node/register projects/toolbox-main/postbuild.ts",
"watch": "ng build toolbox-main --watch --configuration development",
Expand Down
28 changes: 28 additions & 0 deletions projects/toolbox-main/prebuild.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { readFileSync, writeFileSync } from 'fs';

(() => {
const packageJson = require('../../package.json');

const changelogFile = "./projects/toolbox-main/src/resources/data/changelog.json";
const changelog = <any[]>JSON.parse(readFileSync(changelogFile, { encoding: "utf-8" }));

const previousEntry = changelog[changelog.length - 2];
const currentEntry = changelog[changelog.length - 1];

if (currentEntry.version || currentEntry.build_date) {
console.error("A unset entry must be present in the changelog.");
process.exit(-1);
}

if (packageJson.version === previousEntry.version) {
console.error("The version in package.json must be updated before building.");
process.exit(-1);
}

currentEntry.version = packageJson.version;
currentEntry.build_date = new Date().toISOString().split('T')[0];

writeFileSync(changelogFile, JSON.stringify(changelog, undefined, "\t"));

console.log(`Building Minecraft Toolbox v${packageJson.version}...`);
})();
20 changes: 11 additions & 9 deletions projects/toolbox-main/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ViewChild, ViewContainerRef } from '@angular/core';
import { AfterViewInit, Component, ViewChild, ViewContainerRef } from '@angular/core';
import packageJson from '../../../../package.json';
import { PanoramaService } from './common/services/panorama-service/panorama.service';
import { TitleService } from './common/services/title-service/title.service';
Expand All @@ -10,21 +10,23 @@ import { WindowService } from './common/services/window-service/window.service';
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
public version = packageJson.version;
export class AppComponent implements AfterViewInit {
protected version = packageJson.version;

@ViewChild('windowContainer', { read: ViewContainerRef })
public windowContainerTarget!: ViewContainerRef;
protected windowContainerTarget!: ViewContainerRef;

constructor(
private _toolboxSettings: ToolboxSettingsService,
private _panorama: PanoramaService,
public constructor(
private _window: WindowService,
private _titleService: TitleService

//This essentially bootstraps the services to the start of the application.
toolboxSettings: ToolboxSettingsService,
panorama: PanoramaService,
titleService: TitleService
) {
}

ngAfterViewInit() {
public ngAfterViewInit() {
this._window.windowContainer = this.windowContainerTarget;
}
}
8 changes: 0 additions & 8 deletions projects/toolbox-main/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ import { LootTableRandomizerFAQComponent } from './loot-table-randomizer/views/f
import { LootTableRandomizerInstructionsComponent } from './loot-table-randomizer/views/instructions/instructions.component';
import { LootTableRandomizerViewComponent } from './loot-table-randomizer/views/loot-table-randomizer-view/loot-table-randomizer-view.component';

//Services
import { PanoramaService } from './common/services/panorama-service/panorama.service';
import { TitleService } from './common/services/title-service/title.service';
import { ToolboxSettingsService } from './common/services/toolbox-settings/toolbox-settings.service';

//Interceptors
import { CacheInterceptor } from './common/interceptors/cache/cache.interceptor';
import { LocalInterceptor } from './common/interceptors/local/local.interceptor';
Expand Down Expand Up @@ -85,9 +80,6 @@ import { ReversePipe } from './common/pipes/reverse/reverse.pipe';
HttpClientModule
],
providers: [
TitleService,
PanoramaService,
ToolboxSettingsService,
{
provide: APP_BASE_HREF,
useValue: angularJson.projects['toolbox-main'].architect.build.options.baseHref
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { ActivityMonitorService } from '../../services/activity-monitor/activity
styleUrls: ['./activity-monitor.component.scss']
})
export class ActivityMonitorComponent implements OnInit {
public get activities() {
protected get activities() {
return this._activityMonitor.activities;
}

constructor(
private _ref: ElementRef,
public constructor(
private _ref: ElementRef<HTMLElement>,
private _activityMonitor: ActivityMonitorService
) {
}
Expand All @@ -21,7 +21,7 @@ export class ActivityMonitorComponent implements OnInit {
this._ref.nativeElement.style.display = enabled ? "block" : "none";
}

ngOnInit(): void {
public ngOnInit(): void {
this._activityMonitor.setActivityMonitor(this);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'button[standard]',
templateUrl: './button.component.html',
styleUrls: ['./button.component.scss']
template: '<ng-content></ng-content>',
styleUrls: ['./button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ButtonComponent {
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ export class ErrorHandlerComponent implements OnInit {
) {
}

ngOnInit(): void {
public ngOnInit(): void {
this.errorHandler.setErrorHandler(this);
}

public reportIssue() {
protected reportIssue() {
window.open("https://github.com/Fasguy/MinecraftToolbox/issues", "_blank", "noopener,noreferrer")
}

public close() {
protected close() {
this.errorHandler.error = null;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'tbx-error-indicator',
templateUrl: './error-indicator.component.html',
styleUrls: ['./error-indicator.component.scss']
styleUrls: ['./error-indicator.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class ErrorIndicatorComponent {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { WindowService } from '../../services/window-service/window.service';
import { ChangelogComponent } from '../../views/windows/changelog/changelog.component';
import { CreditsComponent } from '../../views/windows/credits/credits.component';
Expand All @@ -7,10 +7,12 @@ import { SettingsComponent } from '../../views/windows/settings/settings.compone
@Component({
selector: 'tbx-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss']
styleUrls: ['./footer.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class FooterComponent {
public items = [
protected currentYear = new Date().getFullYear();
protected items = [
{
text: "Credits",
click: () => this._window.createWindow(CreditsComponent)
Expand All @@ -33,11 +35,7 @@ export class FooterComponent {
}
];

public get currentYear(): number {
return new Date().getFullYear();
}

constructor(
public constructor(
private _window: WindowService
) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Route, Router, Routes } from '@angular/router';
changeDetection: ChangeDetectionStrategy.OnPush
})
export class HeaderComponent implements OnInit {
public routes: Routes = [];
protected routes: Routes = [];

@Input()
public version!: string;
Expand All @@ -21,11 +21,11 @@ export class HeaderComponent implements OnInit {
this.routes.push(...router.config);
}

ngOnInit(): void {
public ngOnInit(): void {
this._changeDetector.detectChanges();
}

filterTitledRoutes(t: Route): boolean {
protected filterTitledRoutes(t: Route): boolean {
return t.data?.["title"] != null;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Component } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';

@Component({
selector: 'input[standard][type=text]',
templateUrl: './input.component.html',
styleUrls: ['./input.component.scss']
template: '',
styleUrls: ['./input.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class InputComponent {
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, ViewChild } from '@angular/core';
import { randomRange } from 'src/lib/utils';

@Component({
selector: 'tbx-loading-indicator',
templateUrl: './loading-indicator.component.html',
styleUrls: ['./loading-indicator.component.scss']
styleUrls: ['./loading-indicator.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class LoadingIndicatorComponent implements AfterViewInit {
@ViewChild("item")
private item!: ElementRef<HTMLDivElement>;

ngAfterViewInit(): void {
this.item.nativeElement.addEventListener("animationiteration", (e) => {
public ngAfterViewInit(): void {
let animationListener = (e: AnimationEvent) => {
(<HTMLDivElement>e.target).style.backgroundPositionX = `calc(100% * ${randomRange(0, 3)})`;
});
};

this.item.nativeElement.addEventListener("animationstart", animationListener);
this.item.nativeElement.addEventListener("animationiteration", animationListener);
}
}
Loading

0 comments on commit e8cc9a8

Please sign in to comment.