fix
Some checks failed
Deploy Backend / deploy (push) Successful in 4m14s
Deploy Website / deploy (push) Failing after 2m42s

This commit is contained in:
Lee 2024-10-15 19:43:23 +01:00
parent 970ab22e2f
commit f2ef170f01
14 changed files with 33 additions and 32 deletions

View File

@ -11,6 +11,6 @@ export default class ImageController {
}),
})
public async getOpenGraphImage({ params: { id } }: { params: { id: string } }) {
return await ImageService.generateOpenGraphImage(id);
return await ImageService.generatePlayerImage(id);
}
}

View File

@ -1,7 +1,7 @@
import { ImageResponse } from "@vercel/og";
import { scoresaberService } from "@ssr/common/service/impl/scoresaber";
import { formatNumberWithCommas, formatPp } from "website/src/common/number-utils";
import React from "react";
import { formatNumberWithCommas, formatPp } from "@ssr/common/utils/number-utils";
export class ImageService {
/**
@ -9,7 +9,7 @@ export class ImageService {
*
* @param id the player's id
*/
public static async generateOpenGraphImage(id: string) {
public static async generatePlayerImage(id: string) {
const player = await scoresaberService.lookupPlayer(id);
if (player == undefined) {
return undefined;

View File

@ -7,3 +7,23 @@
export function isWholeNumber(number: number) {
return number % 1 === 0;
}
/**
* Formats a number without trailing zeros.
*
* @param num the number to format
* @returns the formatted number
*/
export function formatNumberWithCommas(num: number) {
return num.toLocaleString();
}
/**
* Formats the pp value
*
* @param num the pp to format
* @returns the formatted pp
*/
export function formatPp(num: number) {
return num.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
}

View File

@ -1,19 +0,0 @@
/**
* Formats a number without trailing zeros.
*
* @param num the number to format
* @returns the formatted number
*/
export function formatNumberWithCommas(num: number) {
return num.toLocaleString();
}
/**
* Formats the pp value
*
* @param num the pp to format
* @returns the formatted pp
*/
export function formatPp(num: number) {
return num.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
}

View File

@ -1,6 +1,6 @@
"use client";
import { formatNumberWithCommas } from "@/common/number-utils";
import { formatNumberWithCommas } from "@ssr/common/utils/number-utils";
import { zodResolver } from "@hookform/resolvers/zod";
import Link from "next/link";
import { useState } from "react";

View File

@ -1,4 +1,4 @@
import { formatNumberWithCommas } from "@/common/number-utils";
import { formatNumberWithCommas } from "@ssr/common/utils/number-utils";
import { XMarkIcon } from "@heroicons/react/24/solid";
import clsx from "clsx";
import { getScoreBadgeFromAccuracy } from "@/common/song-utils";

View File

@ -1,6 +1,6 @@
"use client";
import { formatNumberWithCommas } from "@/common/number-utils";
import { formatNumberWithCommas } from "@ssr/common/utils/number-utils";
import React from "react";
import { DatasetConfig } from "@/components/chart/generic-chart";
import GenericPlayerChart from "@/components/player/chart/generic-player-chart";

View File

@ -1,4 +1,4 @@
import { formatNumberWithCommas, formatPp } from "@/common/number-utils";
import { formatNumberWithCommas, formatPp } from "@ssr/common/utils/number-utils";
import { GlobeAmericasIcon } from "@heroicons/react/24/solid";
import Card from "../card";
import CountryFlag from "../country-flag";

View File

@ -1,4 +1,4 @@
import { formatNumberWithCommas } from "@/common/number-utils";
import { formatNumberWithCommas } from "@ssr/common/utils/number-utils";
import StatValue from "@/components/stat-value";
import ScoreSaberPlayer from "@ssr/common/types/player/impl/scoresaber-player";

View File

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

View File

@ -1,4 +1,4 @@
import { formatNumberWithCommas, formatPp } from "@/common/number-utils";
import { formatNumberWithCommas, formatPp } from "@ssr/common/utils/number-utils";
import { GlobeAmericasIcon } from "@heroicons/react/24/solid";
import { useQuery } from "@tanstack/react-query";
import Link from "next/link";

View File

@ -1,6 +1,6 @@
"use client";
import { formatNumberWithCommas, formatPp } from "@/common/number-utils";
import { formatNumberWithCommas, formatPp } from "@ssr/common/utils/number-utils";
import CountryFlag from "@/components/country-flag";
import ScoreSaberPlayerToken from "@ssr/common/types/token/scoresaber/score-saber-player-token";
import Link from "next/link";

View File

@ -1,4 +1,4 @@
import { formatNumberWithCommas } from "@/common/number-utils";
import { formatNumberWithCommas } from "@ssr/common/utils/number-utils";
import { format } from "@formkit/tempo";
import { GlobeAmericasIcon } from "@heroicons/react/24/solid";
import Tooltip from "../tooltip";

View File

@ -1,4 +1,4 @@
import { formatNumberWithCommas, formatPp } from "@/common/number-utils";
import { formatNumberWithCommas, formatPp } from "@ssr/common/utils/number-utils";
import { getScoreBadgeFromAccuracy } from "@/common/song-utils";
import { XMarkIcon } from "@heroicons/react/24/solid";
import clsx from "clsx";