mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
weight audio card update
This commit is contained in:
1 parent
dbaa0b5cc8
commit
b9ee6f012e
3 files changed
+13
-1
No files matched your search
@@ -9,6 +9,7 @@ import FavoriteButton from "components/common/FavoriteButton";
|
||||
import CreatorName from "../CreatorName";
|
||||
import { faArrowRight } from "@fortawesome/pro-solid-svg-icons";
|
||||
import Button from "components/common/Button";
|
||||
import useWeightTypeInfo from "hooks/useWeightTypeInfo/useWeightTypeInfo";
|
||||
|
||||
interface AudioCardProps {
|
||||
data: any;
|
||||
@@ -50,6 +51,9 @@ export default function AudioCard({
|
||||
return true; // temporary, replace with like function
|
||||
};
|
||||
|
||||
const { label: weightBadgeLabel, color: weightBadgeColor } =
|
||||
useWeightTypeInfo(data.weights_type);
|
||||
|
||||
return (
|
||||
<Card padding={true} onClick={handleCardClick}>
|
||||
{type === "media" && (
|
||||
@@ -113,7 +117,7 @@ export default function AudioCard({
|
||||
<div className="flex-grow-1">
|
||||
<div className="d-flex align-items-center">
|
||||
<div className="d-flex flex-grow-1">
|
||||
<Badge label="RVC" color="orange" />
|
||||
<Badge label={weightBadgeLabel} color={weightBadgeColor} />
|
||||
</div>
|
||||
<Button
|
||||
icon={faArrowRight}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
export default function useShortenNumber(num: number): string {
|
||||
if (isNaN(num)) return "0";
|
||||
if (num === 0) return "0";
|
||||
if (Math.abs(num) < 1e3) return num.toString();
|
||||
if (Math.abs(num) < 1e6) return (num / 1e3).toFixed(1) + "k";
|
||||
if (Math.abs(num) < 1e9) return (num / 1e6).toFixed(1) + "M";
|
||||
|
||||
@@ -103,6 +103,7 @@ export default function MediaTab() {
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
@@ -113,6 +114,7 @@ export default function MediaTab() {
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
@@ -123,6 +125,7 @@ export default function MediaTab() {
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
@@ -136,6 +139,9 @@ export default function MediaTab() {
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.VOCODER:
|
||||
card = <></>;
|
||||
break;
|
||||
default:
|
||||
card = <div>Unsupported weight type</div>;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user