added diff name and setup skeleton for top recent plays
This commit is contained in:
@ -31,14 +31,14 @@ import { z } from "zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { toast } from "../../ui/use-toast";
|
||||
import { updateAvatarParts } from "./actions";
|
||||
type chunithm_avatar = chuni_static_avatar;
|
||||
|
||||
|
||||
const getAvatarTextureSrc = (id: number | undefined) => {
|
||||
if (id === undefined) return "";
|
||||
return `avatarAccessory/CHU_UI_Avatar_Tex_0${id}.png`;
|
||||
};
|
||||
|
||||
import { updateAvatarParts } from "./actions";
|
||||
type chunithm_avatar = chuni_static_avatar;
|
||||
}
|
||||
|
||||
type AvatarSelectionProps = {
|
||||
avatarHeadSelectionData: {
|
||||
|
35
components/RecentChunithmScores/action.ts
Normal file
35
components/RecentChunithmScores/action.ts
Normal file
@ -0,0 +1,35 @@
|
||||
"use server";
|
||||
|
||||
import { getAuth } from "@/auth/queries/getauth";
|
||||
import { supportedVersionNumber } from "@/lib/helpers";
|
||||
import { artemis } from "@/lib/prisma";
|
||||
|
||||
export async function getUserRecentPlays() {
|
||||
const { user } = await getAuth();
|
||||
|
||||
if (!user || !user.accessCode) {
|
||||
throw new Error("User is not authenticated or accessCode is missing");
|
||||
}
|
||||
|
||||
const userRatingBaseHotList = await artemis.chuni_profile_rating.findMany({
|
||||
where: {
|
||||
user: user.UserId,
|
||||
// userRatingBaseList recent 30 // userRatingBaseHotList recent 15
|
||||
type: "userRatingBaseList",
|
||||
version: supportedVersionNumber, // TODO: eventually change this so the user can set their own version
|
||||
},
|
||||
select: {
|
||||
score:true,
|
||||
difficultId: true,
|
||||
musicId: true,
|
||||
type:true,
|
||||
version: true,
|
||||
romVersionCode: true,
|
||||
id: true,
|
||||
index:true,
|
||||
user: true,
|
||||
|
||||
},
|
||||
});
|
||||
return userRatingBaseHotList;
|
||||
}
|
23
components/RecentChunithmScores/page.tsx
Normal file
23
components/RecentChunithmScores/page.tsx
Normal file
@ -0,0 +1,23 @@
|
||||
import { chuni_profile_rating, chuni_profile_recent_rating } from '@/prisma/schemas/artemis/generated/artemis';
|
||||
import React, { FC } from 'react';
|
||||
|
||||
type chunithm_recent = chuni_profile_rating
|
||||
|
||||
type ChunithmProfileRecentPlays = {
|
||||
chuniProfileRecentPlays: {
|
||||
recentRating: chunithm_recent[];
|
||||
};
|
||||
};
|
||||
|
||||
export const ChunithmRecentPlays: FC<ChunithmProfileRecentPlays> = ({ chuniProfileRecentPlays }) => {
|
||||
return (
|
||||
<div>
|
||||
{chuniProfileRecentPlays.recentRating.map((playersRecentRatingList, index) => (
|
||||
<div key={index}>
|
||||
{playersRecentRatingList.score}
|
||||
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
@ -18,7 +18,7 @@ import { generateShareToken } from "@/app/(sharing)/[token]/token";
|
||||
import { ArrowUpDown, MoreHorizontalIcon } from "lucide-react";
|
||||
import { chuni_score_playlog } from "@/prisma/schemas/artemis/generated/artemis";
|
||||
import { chuni_static_music } from "@/prisma/schemas/artemis/generated/artemis";
|
||||
import { getGrade } from "@/lib/helpers";
|
||||
import { getDifficultyText, getGrade } from "@/lib/helpers";
|
||||
import { Skeleton } from "../ui/skeleton";
|
||||
|
||||
type chunithm = chuni_score_playlog &
|
||||
@ -105,7 +105,13 @@ export const columns: ColumnDef<chunithm>[] = [
|
||||
{
|
||||
accessorKey: "difficulty",
|
||||
header: "Difficulty",
|
||||
cell: ({ row }) => <div className="font-medium">{row.original.level}</div>,
|
||||
cell: ({ row }) => (
|
||||
<div className="font-medium">
|
||||
{row.original.level}
|
||||
<br />
|
||||
{getDifficultyText(row.original.chartId)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "FC / AJ",
|
||||
|
Reference in New Issue
Block a user