From d0cad9a1a3529dbb60bb715083f423fffb1c0bbd Mon Sep 17 00:00:00 2001 From: TkymHrt <23.h.takayama.nutfes@gmail.com> Date: Fri, 15 Nov 2024 22:35:26 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC?= =?UTF-8?q?=E3=83=8D=E3=83=B3=E3=83=88=E3=81=AE=E5=91=BC=E3=81=B3=E5=87=BA?= =?UTF-8?q?=E3=81=97=E3=82=92=E3=83=AA=E3=83=95=E3=82=A1=E3=82=AF=E3=82=BF?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/app/user/page.tsx | 9 +- .../view/user/StatusChangeDialog.tsx | 45 ++++++---- app/src/components/view/user/StatusList.tsx | 90 +++++++++++-------- 3 files changed, 87 insertions(+), 57 deletions(-) diff --git a/app/src/app/user/page.tsx b/app/src/app/user/page.tsx index e16a499..5144e22 100644 --- a/app/src/app/user/page.tsx +++ b/app/src/app/user/page.tsx @@ -48,7 +48,6 @@ const UserPage = () => { if (!userData) return null; return (
-
{userData.photoURL ? ( {
setIsOpen(true)} - /> + speedPoint={10} + similarityPoint={40} + onClick={() => setIsOpen(true)} + />

過去のチャレンジ

{myScore.length === 0 ? ( diff --git a/app/src/components/view/user/StatusChangeDialog.tsx b/app/src/components/view/user/StatusChangeDialog.tsx index b0c3061..2cf97e2 100644 --- a/app/src/components/view/user/StatusChangeDialog.tsx +++ b/app/src/components/view/user/StatusChangeDialog.tsx @@ -8,11 +8,16 @@ import { DialogFooter, DialogHeader, DialogTitle, - DialogTrigger, } from "@/components/ui/dialog"; import { Slider } from "@/components/ui/slider"; -import { useStatusChangeDialog } from "@/lib/atom"; -import { useState } from "react"; +import { useEffect, useState } from "react"; + +interface StatusChangeDialogProps { + isOpen: boolean; + onClose: () => void; + initialSpeed: number; + initialSimilarity: number; +} interface PlayStyleSettings { speed: number; @@ -20,27 +25,35 @@ interface PlayStyleSettings { total: number; } -export default function StatusChangeDialog() { +export default function StatusChangeDialog({ + isOpen, + onClose, + initialSpeed, + initialSimilarity, +}: StatusChangeDialogProps) { const [settings, setSettings] = useState({ - speed: 12, - similarity: 70, + speed: initialSpeed, + similarity: initialSimilarity, total: 100, }); - const [isOpen, setIsOpen] = useStatusChangeDialog(); - // TODO APIの繋ぎ込みをおこなう。その際に値のバリデージョンも実装する。 + useEffect(() => { + setSettings({ + speed: initialSpeed, + similarity: initialSimilarity, + total: 100, + }); + }, [initialSpeed, initialSimilarity]); + const handleSave = async () => { - setIsOpen(false); + onClose(); }; const remainingPoints = settings.total - (settings.speed + settings.similarity); return ( - - - - + @@ -112,10 +125,12 @@ export default function StatusChangeDialog() {
- - + diff --git a/app/src/components/view/user/StatusList.tsx b/app/src/components/view/user/StatusList.tsx index 7165175..838dccd 100644 --- a/app/src/components/view/user/StatusList.tsx +++ b/app/src/components/view/user/StatusList.tsx @@ -1,6 +1,8 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Progress } from "@/components/ui/progress"; +import StatusChangeDialog from "@/components/view/user/StatusChangeDialog"; import { ChevronRight } from "lucide-react"; +import { useState } from "react"; type StatusListProps = { speedPoint: number; @@ -13,46 +15,60 @@ export default function StatusList({ similarityPoint, onClick, }: StatusListProps) { + const [isOpen, setIsOpen] = useState(false); + return ( - - - - プレイスタイル設定 - - - - -

- スピードと類似度のバランスを調整 -

-
-
-
- スピード - {speedPoint}ポイント + <> + { + setIsOpen(true); + onClick(); + }} + > + + + プレイスタイル設定 + + + + +

+ スピードと類似度のバランスを調整 +

+
+
+
+ スピード + {speedPoint}ポイント +
+
- -
-
-
- 類似度 - {similarityPoint}ポイント +
+
+ 類似度 + {similarityPoint}ポイント +
+
-
-
-
-
+ + + + setIsOpen(false)} + initialSpeed={speedPoint} + initialSimilarity={similarityPoint} + /> + ); }