diff --git a/nise-frontend/src/app/app.component.html b/nise-frontend/src/app/app.component.html index 324ff0f..8b00c5e 100644 --- a/nise-frontend/src/app/app.component.html +++ b/nise-frontend/src/app/app.component.html @@ -11,7 +11,7 @@
  • ./suspicious-scores
  • ./stolen-replays
  • ./advanced-search
  • -
  • ./contribute <3
  • +
  • ./contribute <3
  • @@ -35,5 +35,5 @@
    - v20240309 + v20240508
    diff --git a/nise-frontend/src/app/contribute/contribute.component.css b/nise-frontend/src/app/contribute/contribute.component.css index 6d93dab..1630955 100644 --- a/nise-frontend/src/app/contribute/contribute.component.css +++ b/nise-frontend/src/app/contribute/contribute.component.css @@ -9,13 +9,38 @@ img { max-height:100%; } -.btn-patreon { +.btn-paypal { padding: 5px; - border: 2px solid rgba(185, 82, 48, 0.94); - color: #ff683bf0; + border: 2px solid #003087; + color: #009cde; + background-color: black; } -.btn-patreon:hover { - background-color: #ff683bf0; +.btn-paypal:hover { + background-color: #009cde; color: white; } + +.disabled { + pointer-events: none; + cursor: not-allowed; + opacity: 50%; +} + +.hide-contributions-button { + background-color: #0c090a; + font-family: monospace, monospace; + border: 2px dotted #d2d6de; + display: block; + margin-bottom: 12px; + padding: 10px; + color: #d2d6de; +} + +.hide-contributions-button:hover { + background-color: #211f1f; +} + +.hide-contributions-button.disabled { + pointer-events: none; +} diff --git a/nise-frontend/src/app/contribute/contribute.component.html b/nise-frontend/src/app/contribute/contribute.component.html index 06ff51a..40c2dc9 100644 --- a/nise-frontend/src/app/contribute/contribute.component.html +++ b/nise-frontend/src/app/contribute/contribute.component.html @@ -1,3 +1,7 @@ +
    + i'm not interested (or have already contributed) - hide the link for now. +
    +
    @@ -7,23 +11,27 @@

    the website does not run ads, paywall features, or collect your private data in any way. i have no intention to change that since I want to provide the best possible service to the osu! community.

    still, hosting a (relatively) computationally expensive service has costs that are simply unavoidable. that's why I'd encourage people that find this website useful to contribute:

    -

    the money will be used to pay for the server hosting and development costs.

    +

    the money will be uniquely used to pay for the server hosting and development costs.

    - - + + - + -
    + + + - +
    server hosting~220$/yearserver hosting (contabo - cloud vps 3)~222$/year
    domaindomain (namecheap - .moe renewal) ~17$/year
    +
    +
    total~237$/year~239$/year
    diff --git a/nise-frontend/src/app/contribute/contribute.component.ts b/nise-frontend/src/app/contribute/contribute.component.ts index 8ad5072..c4dbca4 100644 --- a/nise-frontend/src/app/contribute/contribute.component.ts +++ b/nise-frontend/src/app/contribute/contribute.component.ts @@ -1,6 +1,7 @@ -import { Component } from '@angular/core'; +import {Component} from '@angular/core'; import {CuteLoadingComponent} from "../../corelib/components/cute-loading/cute-loading.component"; import {DecimalPipe, NgForOf, NgIf} from "@angular/common"; +import {UserService} from "../../corelib/service/user.service"; @Component({ selector: 'app-contribute', @@ -16,4 +17,10 @@ import {DecimalPipe, NgForOf, NgIf} from "@angular/common"; }) export class ContributeComponent { + constructor(public userService: UserService) { } + + hideLink(): void { + this.userService.ephemeralUserInfo = { ...this.userService.ephemeralUserInfo, showContributions: false }; + } + } diff --git a/nise-frontend/src/corelib/service/user.service.ts b/nise-frontend/src/corelib/service/user.service.ts index b8df8e5..f86dabd 100644 --- a/nise-frontend/src/corelib/service/user.service.ts +++ b/nise-frontend/src/corelib/service/user.service.ts @@ -1,12 +1,19 @@ -import {Injectable} from '@angular/core'; -import {HttpClient} from "@angular/common/http"; -import {environment} from "../../environments/environment"; +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { environment } from '../../environments/environment'; interface UserInfo { userId: number; username: string; } +/** + * This stuff gets saved to localStorage ONLY. + */ +interface EphemeralUserInfo { + showContributions: boolean; +} + @Injectable({ providedIn: 'root' }) @@ -14,14 +21,28 @@ export class UserService { currentUser: UserInfo | null = null; + private _ephemeralUserInfo: EphemeralUserInfo = { + showContributions: true + }; + loginCallback: () => void = () => {}; constructor(private httpClient: HttpClient) { this.currentUser = this.loadCurrentUserFromLocalStorage(); + this._ephemeralUserInfo = this.loadEphemeralUserInfoFromLocalStorage(); this.updateUser() .catch(reason => console.debug(reason)); } + get ephemeralUserInfo(): EphemeralUserInfo { + return this._ephemeralUserInfo; + } + + set ephemeralUserInfo(value: EphemeralUserInfo) { + this._ephemeralUserInfo = value; + this.saveEphemeralUserInfoToLocalStorage(value); + } + isUserLoggedIn(): boolean { return this.currentUser !== null; } @@ -48,11 +69,11 @@ export class UserService { } public getLoginUrl(): string { - return `${environment.apiUrl}/oauth2/authorization/osu` + return `${environment.apiUrl}/oauth2/authorization/osu`; } public getLogoutUrl(): string { - return `${environment.apiUrl}/logout` + return `${environment.apiUrl}/logout`; } saveCurrentUserToLocalStorage(user: UserInfo) { @@ -69,4 +90,13 @@ export class UserService { document.cookie = 'SESSION=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; } + saveEphemeralUserInfoToLocalStorage(info: EphemeralUserInfo) { + localStorage.setItem('ephemeralUserInfo', JSON.stringify(info)); + } + + loadEphemeralUserInfoFromLocalStorage(): EphemeralUserInfo { + const savedInfo = localStorage.getItem('ephemeralUserInfo'); + return savedInfo ? JSON.parse(savedInfo) : { showContributions: true }; + } + }