6 Commits
v2.1 ... v2.2.1

Author SHA1 Message Date
eneller
29633a94c0 feat: better table formatting 2025-03-12 22:57:53 +01:00
eneller
3d3a177b7c fix: ServiceWorker intercepting requests
created wrapper for SW to exclude paths because ngsw-config only
disables caching, but the SW would still handle the request
2025-03-05 22:57:56 +01:00
eneller
07b84586b6 Revert "fix: serviceworker doesnt intercept other urls"
This reverts commit 5267eb6ab1.
2025-03-05 21:16:49 +01:00
eneller
5267eb6ab1 fix: serviceworker doesnt intercept other urls
since i am using the same subdomain also for '/redirects', they were
being intercepted by the service worker
chrome now blocks the redirect altogether because of CORS when redirects
are not allowed (default on linux chromium)
2025-03-04 23:44:50 +01:00
eneller
5daa64d962 chore: audit fix 2025-03-02 00:10:51 +01:00
eneller
b939f4d4f3 style: better type hint 2025-03-01 23:38:00 +01:00
7 changed files with 1250 additions and 668 deletions

View File

@@ -30,7 +30,8 @@
{
"glob": "**/*",
"input": "public"
}
},
"src/sw.js"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",

1875
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,3 @@
<style>
*{
text-align: center;
}
</style>
<main class="main">
<div class="row justify-content-md-center">
<h1>Please select the number of teams:</h1>
@@ -40,7 +35,7 @@
<button type="button" (click)="onButtonGenerate(playerNames.value)" class="btn btn-primary">Generate</button>
</form>
<table class="table table-striped">
<table class="table table-striped custom-table">
<thead>
<tr>
<th scope="col">Size</th>
@@ -50,8 +45,8 @@
<tbody>
@for (team of teamsArray; track $index) {
<tr>
<td>{{ team.length | number }}</td>
<td>{{ team }}</td>
<td style="text-wrap: wrap;">{{ team.length | number }}</td>
<td class="wrap-cell">{{ team }}</td>
</tr>
}
</tbody>

View File

@@ -0,0 +1,11 @@
*{
text-align: center;
}
.custom-table {
//table-layout: fixed;
width: 100%; /* Or a specific max-width */
}
.wrap-cell{
word-break: break-word;
white-space: normal;
}

View File

@@ -23,7 +23,7 @@ export class AppComponent implements OnInit {
constructor(private activatedRoute: ActivatedRoute){}
ngOnInit(): void {
//consiedr using Angular's ActivatedRoute here instead
//TODO consider using Angular's ActivatedRoute here instead
const params = new URLSearchParams(window.location.search);
const names = params.get('names')?.replaceAll(',', '\n');
if (names) this.playerNamesValue = names;
@@ -47,7 +47,7 @@ export class AppComponent implements OnInit {
var playersPerTeam = Math.floor(names.length / this.numTeamsSelected);
let nameslen = names.length;
function* iter(list: any){
function* iter(list: any[]){
let index = 0;
while(true){
yield list[index % list.length];

View File

@@ -7,7 +7,7 @@ import { provideAnimationsAsync } from '@angular/platform-browser/animations/asy
import { provideServiceWorker } from '@angular/service-worker';
export const appConfig: ApplicationConfig = {
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes), provideClientHydration(withEventReplay()), provideAnimationsAsync('noop'), provideServiceWorker('ngsw-worker.js', {
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes), provideClientHydration(withEventReplay()), provideAnimationsAsync('noop'), provideServiceWorker('./sw.js', {
enabled: !isDevMode(),
registrationStrategy: 'registerWhenStable:30000'
})]

12
src/sw.js Normal file
View File

@@ -0,0 +1,12 @@
self.addEventListener('fetch', event => {
if (event &&
event.request &&
event.request.url &&
// check if basename includes a dot, i.e. if it is not a file
! event.request.url.split(/[\\/]/).pop().includes(".")
) {
event.stopImmediatePropagation();
}
});
self.importScripts('./ngsw-worker.js');