Skip to content

Commit

Permalink
refactor: move stuff around
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelRauber committed Jan 26, 2024
1 parent 28c70fc commit c4c6d1e
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 41 deletions.
2 changes: 0 additions & 2 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { APP_INITIALIZER, ApplicationConfig } from '@angular/core';
import { provideRouter, withHashLocation, withInMemoryScrolling } from '@angular/router';
import { routes } from './app.routes';
import { flowbiteAppInitializer } from './flowbite';
import { provideAnimations } from '@angular/platform-browser/animations';
import { provideHttpClient, withFetch } from '@angular/common/http';
import { DATABASE_TABLE, databaseInitializerFactory, databaseInitializerFactoryDeps } from './services/database.service';
Expand All @@ -10,7 +9,6 @@ import { characterStoreInitializerFactory, characterStoreInitializerFactoryDeps

export const appConfig: ApplicationConfig = {
providers: [
{ provide: APP_INITIALIZER, useFactory: () => flowbiteAppInitializer, multi: true },
provideAnimations(),
provideRouter(
routes,
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const routes: Routes = [
children: [
{
path: 'dice',
loadComponent: () => import('./components/dice/dice.component'),
loadComponent: () => import('./components/tools/dice/dice.component'),
},
],
},
Expand Down
23 changes: 0 additions & 23 deletions src/app/components/dice/dice.component.html

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<button
[disabled]="disabled"
class="w-full rounded-lg border border-transparent bg-blue-700 px-5 py-2.5 text-center text-sm font-medium
text-white
hover:bg-blue-800
focus:outline-none focus:ring-4 focus:ring-blue-300
disabled:cursor-not-allowed disabled:border-gray-200 disabled:bg-white disabled:text-gray-400
dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800
disabled:dark:border-red-400 disabled:dark:bg-gray-950 sm:w-auto"
focus:outline-none
focus:ring-4 focus:ring-blue-300 disabled:cursor-not-allowed
disabled:border-gray-200 disabled:bg-white disabled:text-gray-400 dark:bg-blue-600
dark:hover:bg-blue-700 dark:focus:ring-blue-800
disabled:dark:border-gray-400 disabled:dark:bg-gray-950 sm:w-auto"
type="submit">
<ng-content></ng-content>
</button>
9 changes: 7 additions & 2 deletions src/app/components/root/root.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterOutlet } from '@angular/router';
import { SidebarComponent } from '../sidebar/sidebar.component';
import { HeaderComponent } from '../header/header.component';
import { initFlowbite } from 'flowbite';

@Component({
selector: 'pap-root',
Expand All @@ -11,4 +12,8 @@ import { HeaderComponent } from '../header/header.component';
templateUrl: './root.component.html',
styleUrl: './root.component.css',
})
export class RootComponent {}
export class RootComponent implements OnInit {
ngOnInit(): void {
initFlowbite();
}
}
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions src/app/components/tools/dice/dice.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<pap-h1>Würfeln</pap-h1>

<form class="mx-auto max-w-sm">
<div class="mb-5">
<label class="mb-2 block text-sm font-medium" for="dice">Definition</label>
<input
[(ngModel)]="dice"
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
id="dice"
name="dice"
placeholder="2d20"
required
type="text" />
</div>
<pap-submit-button (click)="roll()" [disabled]="!dice"> Würfeln! </pap-submit-button>

<div class="mt-4">Ergebnis: {{ result }}</div>
</form>
<canvas class="mt-4 w-full border" id="dice-canvas"></canvas>
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { AfterViewInit, Component } from '@angular/core';
import DiceBox from '@3d-dice/dice-box';
import { FormsModule } from '@angular/forms';
import { SubmitButtonComponent } from '../../inputs/submit-button/submit-button.component';
import { H1Component } from '../../headings/h1/h1.component';

@Component({
selector: 'pap-dice',
standalone: true,
imports: [FormsModule],
imports: [FormsModule, SubmitButtonComponent, H1Component],
templateUrl: './dice.component.html',
styleUrl: './dice.component.css',
})
Expand Down
8 changes: 0 additions & 8 deletions src/app/flowbite.ts

This file was deleted.

0 comments on commit c4c6d1e

Please sign in to comment.