Fixed styling issues. Fixed dialog themes after changing theme.

This commit is contained in:
Tom 2025-04-02 15:57:54 +00:00
parent e053529d49
commit 5489eb4df6
17 changed files with 70 additions and 39 deletions

View File

@ -3,10 +3,10 @@
<section> <section>
<article> <article>
<mat-form-field> <mat-form-field subscriptSizing="dynamic">
<mat-label>Filter by type</mat-label> <mat-label>Filter by type</mat-label>
<mat-select (selectionChange)="onFilterChange($event.value)" <mat-select value="0"
value="0"> (selectionChange)="onFilterChange($event.value)">
<mat-select-trigger> <mat-select-trigger>
<mat-icon matPrefix>filter_list</mat-icon>&nbsp;{{filter.name}} <mat-icon matPrefix>filter_list</mat-icon>&nbsp;{{filter.name}}
</mat-select-trigger> </mat-select-trigger>
@ -17,7 +17,7 @@
</mat-form-field> </mat-form-field>
</article> </article>
<article> <article>
<mat-form-field> <mat-form-field subscriptSizing="dynamic">
<mat-label>Search</mat-label> <mat-label>Search</mat-label>
<input matInput <input matInput
type="text" type="text"
@ -28,7 +28,7 @@
</mat-form-field> </mat-form-field>
</article> </article>
</section> </section>
<action-list class="center" <action-list class="list center"
[actions]="actions" [actions]="actions"
(actionsChange)="items.push($event)" /> (actionsChange)="items.push($event)" />
</content> </content>

View File

@ -1,12 +1,12 @@
body, content,
h3 { h3 {
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
body { content {
height: 100vh; display: flex;
overflow: auto; flex-direction: column;
margin-top: 3em; margin-top: 3em;
} }
@ -19,8 +19,7 @@ section {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 70%; width: 70%;
margin-left: auto; margin: 0 auto;
margin-right: auto;
@media (max-width:1250px) { @media (max-width:1250px) {
display: block; display: block;
@ -30,6 +29,7 @@ section {
article { article {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
margin: 1em 0;
} }
} }

View File

@ -1,6 +1,6 @@
<main> <main>
<topbar class="top" /> <topbar class="top" />
<div [class.container]="isSidebarOpen" <div [class.grid]="isSidebarOpen"
[class.full]="!isSidebarOpen"> [class.full]="!isSidebarOpen">
@if (isSidebarOpen) { @if (isSidebarOpen) {
<sidebar class="navigation" /> <sidebar class="navigation" />

View File

@ -1,9 +1,8 @@
.container { .grid {
display: grid; display: grid;
grid-template-columns: 20em 0px 1fr; grid-template-columns: 20em 0px 1fr;
} }
.full { .full {
width: 80%;
margin: 0 auto; margin: 0 auto;
} }

View File

@ -107,12 +107,20 @@ export class AppComponent implements OnInit, OnDestroy {
this.overlayContainer.getContainerElement().classList.add(this.themeService.theme + '-theme'); this.overlayContainer.getContainerElement().classList.add(this.themeService.theme + '-theme');
this.addSubscription(this.events.listen('theme_change', data => {
const classList = this.overlayContainer.getContainerElement().classList;
classList.remove(data.previous_theme + '-theme');
classList.add(data.current_theme + '-theme');
}));
this.ngZone.runOutsideAngular(() => setInterval(() => this.client.heartbeat(), 15000)); this.ngZone.runOutsideAngular(() => setInterval(() => this.client.heartbeat(), 15000));
} }
ngOnDestroy() { ngOnDestroy() {
for (let s of this.subscriptions) { for (let s of this.subscriptions) {
s.unsubscribe(); if (s) {
s.unsubscribe();
}
} }
} }

View File

@ -1,5 +1,6 @@
@use "@angular/material" as mat; @use "@angular/material" as mat;
ul { ul {
padding: 0; padding: 0;
} }
@ -8,9 +9,9 @@ li {
list-style: none; list-style: none;
width: 100%; width: 100%;
display: flex; display: flex;
flex-grow: 1;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
margin: 0.5em 0;
} }
a { a {

View File

@ -60,6 +60,7 @@
</button> </button>
<button mat-button <button mat-button
class="confirm" class="confirm"
[disabled]="formGroup.invalid || waitForResponse"
(click)="save()"> (click)="save()">
<mat-icon>{{(isNew ? 'add' : 'save')}}</mat-icon>{{(isNew ? 'Add' : 'Save')}} <mat-icon>{{(isNew ? 'add' : 'save')}}</mat-icon>{{(isNew ? 'Add' : 'Save')}}
</button> </button>

View File

@ -1,4 +1,9 @@
.buttons { .buttons {
margin: -0.75em; margin: -0.75em;
}
.mat-mdc-card-content {
display: grid;
row-gap: 1em;
align-self: center;
} }

View File

@ -1,4 +1,4 @@
<div class="content"> <content>
<button mat-button <button mat-button
class="add" class="add"
(click)="add()"><mat-icon>add</mat-icon> Add Redemption</button> (click)="add()"><mat-icon>add</mat-icon> Add Redemption</button>
@ -64,4 +64,4 @@
*matRowDef="let row; columns: displayedColumns;"></tr> *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>
</div> </div>
</div> </content>

View File

@ -1,9 +1,3 @@
.content {
height: 100vh;
display: flex;
flex-direction: column;
}
.add { .add {
width: 100%; width: 100%;
margin-top: 3em; margin-top: 3em;
@ -21,10 +15,10 @@
} }
.table-container { .table-container {
min-width: 800px; width: 800px;
flex: 1; flex: 1;
height: 60vh; height: 60vh;
overflow: auto; overflow: scroll;
margin-bottom: 2em; margin-bottom: 2em;
border-radius: 15px; border-radius: 15px;
} }

View File

@ -1,9 +1,11 @@
import { Injectable, signal } from '@angular/core'; import { inject, Injectable, signal } from '@angular/core';
import EventService from './EventService';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class ThemeService { export class ThemeService {
private events = inject(EventService);
private _current = signal<'light' | 'dark'>('dark'); private _current = signal<'light' | 'dark'>('dark');
get theme() { get theme() {
@ -11,7 +13,12 @@ export class ThemeService {
} }
set theme(value: 'light' | 'dark') { set theme(value: 'light' | 'dark') {
const previous = this._current();
this._current.set(value); this._current.set(value);
this.events.emit('theme_change', {
previous_theme: previous,
current_theme: value,
});
} }
isDarkTheme() { isDarkTheme() {

View File

@ -9,12 +9,16 @@ ul {
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-evenly; justify-content: space-evenly;
padding-left: 0;
align-items: center;
vertical-align: middle;
li { li {
list-style-type: none; list-style-type: none;
white-space: pre; white-space: pre;
text-align: start; text-align: start;
text-wrap: wrap; text-wrap: wrap;
padding: 0;
span { span {
overflow: hidden; overflow: hidden;

View File

@ -2,8 +2,8 @@
<ul class="data"> <ul class="data">
<li> <li>
<ul class="header"> <ul class="header">
<li>Search</li> <li>Search for...</li>
<li>Replace</li> <li>Replace with...</li>
<li></li> <li></li>
</ul> </ul>
</li> </li>

View File

@ -6,7 +6,7 @@ ul.data {
>li { >li {
display: block; display: block;
list-style-type: none; list-style-type: none;
padding: 0.75em 1em; padding: 0.5em 1em;
border-bottom: 1px solid #aaaaaa; border-bottom: 1px solid #aaaaaa;
} }

View File

@ -1,7 +1,6 @@
main { main {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100vh;
} }
article { article {
@ -11,6 +10,13 @@ article {
} }
.grow { .grow {
flex-grow: 1; width: 800px;
height: 60vh;
align-items: center;
align-self: center;
overflow: auto; overflow: auto;
flex-wrap: wrap;
justify-content: space-evenly;
border: 1px solid grey;
border-radius: 15px;
} }

View File

@ -14,9 +14,11 @@
rel="stylesheet"> rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" <link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"> rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> rel="stylesheet">
</head> <link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">
</head>
<body class="mat-typography"> <body class="mat-typography">
<app-root></app-root> <app-root></app-root>

View File

@ -12,6 +12,7 @@ html {
)); ));
} }
:root,
html, html,
body, body,
main { main {
@ -22,7 +23,7 @@ html,
body, body,
main, main,
content, content,
nav { sidebar {
background-color: var(--mat-sys-background); background-color: var(--mat-sys-background);
color: var(--mat-sys-on-background); color: var(--mat-sys-on-background);
} }
@ -99,7 +100,7 @@ body {
.confirm { .confirm {
@include mat.button-overrides(( //text-state-layer-color: rgb(52, 255, 62), @include mat.button-overrides(( //text-state-layer-color: rgb(52, 255, 62),
text-label-text-color: rgb(71, 218, 78), text-label-text-color: rgb(71, 218, 78),
text-disabled-label-text-color: rgb(71, 218, 78), text-disabled-label-text-color: rgb(107, 107, 107),
)); ));
} }
@ -120,10 +121,13 @@ body {
.danger { .danger {
@include mat.button-overrides(( //text-state-layer-color: rgb(255, 48, 48), @include mat.button-overrides(( //text-state-layer-color: rgb(255, 48, 48),
text-label-text-color: rgb(255, 52, 52), text-label-text-color: rgb(255, 52, 52),
text-disabled-label-text-color: rgb(255, 52, 52), text-disabled-label-text-color: rgb(107, 107, 107),
filled-label-text-color: rgb(255, 52, 52), filled-label-text-color: rgb(255, 52, 52),
filled-disabled-label-text-color: rgb(107, 107, 107),
outlined-label-text-color: rgb(255, 52, 52), outlined-label-text-color: rgb(255, 52, 52),
outlined-disabled-label-text-color: rgb(107, 107, 107),
protected-label-text-color: rgb(255, 52, 52), protected-label-text-color: rgb(255, 52, 52),
protected-disabled-label-text-color: rgb(107, 107, 107),
protected-state-layer-color: rgb(255, 75, 75), protected-state-layer-color: rgb(255, 75, 75),
protected-ripple-color: rgb(255, 154, 154), protected-ripple-color: rgb(255, 154, 154),
)); ));