added diff name and setup skeleton for top recent plays

This commit is contained in:
Polaris
2024-08-14 11:52:19 -04:00
parent a2f5febb60
commit ad12f07cde
7 changed files with 93 additions and 8 deletions

View 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;
}

View 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>
);
};