diff --git a/app/(authenticated)/chunithm/page.tsx b/app/(authenticated)/chunithm/page.tsx
index bf6ec86..f6333a2 100644
--- a/app/(authenticated)/chunithm/page.tsx
+++ b/app/(authenticated)/chunithm/page.tsx
@@ -13,6 +13,16 @@ import { getSystemVoices } from "@/components/(customization)/systemvoicecustomi
import { SystemVoiceCustomization } from "@/components/(customization)/systemvoicecustomization/page";
import { MapIconCustomization } from "@/components/(customization)/mapiconcustomization/page";
import { getMapIcons } from "@/components/(customization)/mapiconcustomization/actions";
+import { ChunithmRecentPlays } from "@/components/RecentChunithmScores/page";
+import { getUserRecentPlays } from "@/components/RecentChunithmScores/action";
+
+
+const getChuniRecent = async () => {
+ const recentRating = await getUserRecentPlays();
+ return { recentRating };
+};
+
+
const getAvatarHeadAccessories = async () => {
const avatarParts = await getAllAvatarParts(2); // head
@@ -69,6 +79,8 @@ const Page = async () => {
const AllStaticNameplates = await getAllNameplates();
const AllSystemVoices = await getAllSystemVoices();
const AllMapIcons = await getAllMapIcons();
+ const RecentChuniPlays = await getChuniRecent();
+
return (
@@ -76,6 +88,8 @@ const Page = async () => {
Scores
Customize
+ Top / Recent Plays
+
@@ -110,6 +124,9 @@ const Page = async () => {
+
+
+
);
diff --git a/app/(sharing)/[token]/[id]/actions.ts b/app/(sharing)/[token]/[id]/actions.ts
index 5324907..a7b67fd 100644
--- a/app/(sharing)/[token]/[id]/actions.ts
+++ b/app/(sharing)/[token]/[id]/actions.ts
@@ -118,6 +118,7 @@ export async function getSongsWithTitles(userId: number) {
title: staticInfo?.title || "Unknown Title",
artist: staticInfo?.artist || "Unknown Artist",
genre: staticInfo?.genre || "Unknown Genre",
+ chartId: staticInfo?.chartId || "Unknown chartId",
level: staticInfo?.level || "Unknown Level",
chartlevel: song.level || "Unknown Level",
playCount: song.musicId !== null ? playCountMap[song.musicId] || 0 : 0,
diff --git a/components/(customization)/avatarcustomization/page.tsx b/components/(customization)/avatarcustomization/page.tsx
index fe9a6fa..7b3d9b1 100644
--- a/components/(customization)/avatarcustomization/page.tsx
+++ b/components/(customization)/avatarcustomization/page.tsx
@@ -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: {
diff --git a/components/RecentChunithmScores/action.ts b/components/RecentChunithmScores/action.ts
new file mode 100644
index 0000000..e79916e
--- /dev/null
+++ b/components/RecentChunithmScores/action.ts
@@ -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;
+}
\ No newline at end of file
diff --git a/components/RecentChunithmScores/page.tsx b/components/RecentChunithmScores/page.tsx
new file mode 100644
index 0000000..a240bf7
--- /dev/null
+++ b/components/RecentChunithmScores/page.tsx
@@ -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 = ({ chuniProfileRecentPlays }) => {
+ return (
+
+ {chuniProfileRecentPlays.recentRating.map((playersRecentRatingList, index) => (
+
+ {playersRecentRatingList.score}
+
+
+ ))}
+
+ );
+};
diff --git a/components/scoreplaylog/colums.tsx b/components/scoreplaylog/colums.tsx
index 093665f..37ff203 100644
--- a/components/scoreplaylog/colums.tsx
+++ b/components/scoreplaylog/colums.tsx
@@ -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[] = [
{
accessorKey: "difficulty",
header: "Difficulty",
- cell: ({ row }) => {row.original.level}
,
+ cell: ({ row }) => (
+
+ {row.original.level}
+
+ {getDifficultyText(row.original.chartId)}
+
+ ),
},
{
accessorKey: "FC / AJ",
diff --git a/lib/helpers.ts b/lib/helpers.ts
index 9beb192..3f5b0f4 100644
--- a/lib/helpers.ts
+++ b/lib/helpers.ts
@@ -17,10 +17,10 @@ export const getDifficultyClass = (level: number) => {
}
};
-export const getDifficultyText = (chartId: number) => {
+export const getDifficultyText = (chartId: number | null) => {
switch (chartId) {
case 0:
- return "EASY"; // Text for difficulty
+ return "EASY";
case 1:
return "ADVANCE";
case 2:
@@ -31,9 +31,12 @@ export const getDifficultyText = (chartId: number) => {
return "ULTIMA";
case 5:
return "WORLDS END";
+ default:
+ return "UNKNOWN"; // Default text if chartId doesn't match any case
}
};
+
export const getGrade = (score: number) => {
if (score >= 1009000) return "SSS+";
if (score >= 1007500 && score <= 1008999) return "SSS";