Skip to content

Commit

Permalink
Merge branch 'master' into contests
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed May 6, 2024
2 parents da399dc + 3c8addb commit 1b6e134
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/app/api/token-storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export class TokenStorageService {
const str = localStorage.getItem(this.UserKey);
if (!str) return null;

return JSON.parse(str);
try {
return JSON.parse(str);
} catch (e) {
console.error("Stored user is null");
return null;
}
}

public SetStoredUser(user: ExtendedUser): void {
Expand Down
10 changes: 5 additions & 5 deletions src/app/components/level-preview/level-preview.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<fa-icon [icon]="faCircleCheck" class="pr-1"></fa-icon>
</tooltip>
<level-statistics [level]="_level" class="text-sm"></level-statistics>
<p-gentle>by <user-link [user]="_level.publisher" class="pl-0.5" *ngIf="_level.publisher"
<p-gentle>by <tooltip [active]="_level.isReUpload"
[text]="'This level is a re-upload, originally published by ' + (_level.originalPublisher === null ? 'an unknown publisher' : _level.originalPublisher) + '.'"><user-link [user]="_level.publisher" class="pl-0.5" *ngIf="_level.publisher"
[ngClass]="_level.isReUpload ? 'line-through' : ''"></user-link>
<tooltip class="pl-0.5"
[text]="'This level is a re-upload, originally created by ' + _level.originalPublisher + '.'">
<span>{{ _level.originalPublisher }}</span>
</tooltip></p-gentle>

<span class="pl-0.5">{{ _level.originalPublisher }}</span>
</tooltip></p-gentle>
<p-gentle>Created in {{getGameVersion(_level.gameVersion)}} <date [date]="_level.publishDate"></date></p-gentle>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/tooltip/tooltip.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
py-2.5 px-5 bg-backdrop flex items-center justify-center
transition-opacity duration-300
not-italic text-foreground font-normal text-base whitespace-nowrap
rounded drop-shadow-lg">
rounded drop-shadow-lg" *ngIf="_active">
{{_text}}
</span>
</div>
6 changes: 6 additions & 0 deletions src/app/components/tooltip/tooltip.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ import {Component, Input} from '@angular/core';
})
export class TooltipComponent {
_text: string = "";
_active: boolean = true;

@Input()
set text(text: string) {
this._text = text;
}

@Input()
set active(active: boolean) {
this._active = active;
}
}
7 changes: 4 additions & 3 deletions src/app/pages/level/level.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

<div class="inline-block text-sm font-normal">
<span-gentle>by
<tooltip [active]="level.isReUpload"
[text]="'This level is a re-upload, originally published by ' + (level.originalPublisher === null ? 'an unknown publisher' : level.originalPublisher) + '.'">
<user-link [user]="level.publisher" class="pl-1" *ngIf="level.publisher"
[ngClass]="level.isReUpload ? 'line-through' : ''"></user-link>
<tooltip *ngIf="level.isReUpload" class="pl-1"
[text]="'This level is a re-upload, originally created by ' + level.originalPublisher + '.'">
<span>{{ level.originalPublisher }}</span>

<span class="pl-1">{{ level.originalPublisher }}</span>
</tooltip>
</span-gentle>
</div>
Expand Down

0 comments on commit 1b6e134

Please sign in to comment.