surely it works now
All checks were successful
Deploy Website / deploy (push) Successful in 3m55s

This commit is contained in:
Lee 2024-10-17 15:57:51 +01:00
parent ba0a406eb4
commit 73b7d17597
5 changed files with 8 additions and 42 deletions

@ -1,37 +0,0 @@
import BeatSaverMap from "@/common/database/types/beatsaver-map";
import { db } from "@/common/database/database";
import { beatsaverService } from "@ssr/common/service/impl/beatsaver";
/**
* Gets the map that match the query.
*
* @param query the query to search for
* @returns the map that match the query, or undefined if no map were found
*/
export async function lookupBeatSaverMap(query: string): Promise<BeatSaverMap | undefined> {
let map = await db.beatSaverMaps.get(query);
// The map is cached
if (map != undefined) {
return map;
}
const response = await beatsaverService.lookupMap(query);
// Map not found
if (response == undefined) {
return undefined;
}
const bsr = response.id;
if (bsr == undefined) {
return undefined;
}
// Save map the the db
await db.beatSaverMaps.add({
hash: query,
bsr: bsr,
fullData: response,
});
map = await db.beatSaverMaps.get(query);
return map;
}

@ -1,4 +1,4 @@
import { PlayerHistory } from "@ssr/common/types/player/player-history";
import { PlayerHistory } from "@ssr/common/player/player-history";
/**
* Gets a value from an {@link PlayerHistory}

@ -5,7 +5,7 @@ import ky from "ky";
import Tooltip from "@/components/tooltip";
import { InformationCircleIcon } from "@heroicons/react/16/solid";
import { formatNumberWithCommas } from "@ssr/common/utils/number-utils";
import { PlayerTrackedSince } from "@ssr/common/types/player/player-tracked-since";
import { PlayerTrackedSince } from "@ssr/common/player/player-tracked-since";
import ScoreSaberPlayer from "@ssr/common/player/impl/scoresaber-player";
import { Config } from "@ssr/common/config";

@ -7,6 +7,8 @@ import { parseDate } from "@ssr/common/utils/time-utils";
import Link from "next/link";
import useWebSocket, { ReadyState } from "react-use-websocket";
import { ScoreSaberWebsocketMessageToken } from "@ssr/common/types/token/scoresaber/websocket/scoresaber-websocket-message";
import { getScoreSaberScoreFromToken } from "@ssr/common/score/impl/scoresaber-score";
import { getScoreSaberLeaderboardFromToken } from "@ssr/common/leaderboard/impl/scoresaber-leaderboard";
export default function ScoreFeed() {
const { readyState, lastJsonMessage } = useWebSocket<ScoreSaberWebsocketMessageToken>("wss://scoresaber.com/ws");
@ -49,7 +51,8 @@ export default function ScoreFeed() {
</Link>
</p>
<Score
score={score}
score={getScoreSaberScoreFromToken(score.score)}
leaderboard={getScoreSaberLeaderboardFromToken(score.leaderboard)}
settings={{
noScoreButtons: true,
}}

@ -5,7 +5,7 @@ import Image from "next/image";
import { songDifficultyToColor } from "@/common/song-utils";
import Link from "next/link";
import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leaderboard";
import { BeatSaverMap } from "@ssr/common/model/beatsaver-map";
import { BeatSaverMap } from "@ssr/common/model/beatsaver/beatsaver-map";
type Props = {
leaderboard: ScoreSaberLeaderboard;
@ -14,7 +14,7 @@ type Props = {
export default function ScoreSongInfo({ leaderboard, beatSaverMap }: Props) {
const mappersProfile =
beatSaverMap != undefined ? `https://beatsaver.com/profile/${beatSaverMap?.author.authorId}` : undefined;
beatSaverMap != undefined ? `https://beatsaver.com/profile/${beatSaverMap?.author.id}` : undefined;
const starCount = leaderboard.stars;
const difficulty = leaderboard.difficulty;