From e757454e51b74ae68580d965725a59255415baec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arma=C4=9Fan=20Dalk=C4=B1ran?= Date: Fri, 7 Mar 2025 01:13:04 +0300 Subject: [PATCH] chore: figma plugin test --- .../room/grooming-board/connecting-info.tsx | 12 ---- .../grooming-board/grooming-board-logs.tsx | 4 -- .../grooming-board-participant.tsx | 12 +--- .../grooming-board-participants.tsx | 44 ++++++++++-- .../room/grooming-board/grooming-board.tsx | 12 ---- .../room/grooming-navbar/grooming-navbar.tsx | 4 -- .../src/app/contexts/GroomingRoomContext.tsx | 69 ++++++++++++++++++- gurubu-client/src/app/room/[id]/page.tsx | 1 - 8 files changed, 109 insertions(+), 49 deletions(-) diff --git a/gurubu-client/src/app/components/room/grooming-board/connecting-info.tsx b/gurubu-client/src/app/components/room/grooming-board/connecting-info.tsx index 91dd0b27..4a1c466b 100644 --- a/gurubu-client/src/app/components/room/grooming-board/connecting-info.tsx +++ b/gurubu-client/src/app/components/room/grooming-board/connecting-info.tsx @@ -23,18 +23,6 @@ const ConnectingInfo = ({ roomId }: IProps) => { setRoomStatus(ROOM_STATUS.FOUND); }; - useEffect(() => { - fetchRoomId(); - }, []); - - if (roomStatus === ROOM_STATUS.NOT_FOUND) { - notFound(); - } - - if (roomStatus === ROOM_STATUS.FOUND) { - return null; - } - return (

Connecting to the room...

diff --git a/gurubu-client/src/app/components/room/grooming-board/grooming-board-logs.tsx b/gurubu-client/src/app/components/room/grooming-board/grooming-board-logs.tsx index a3338fc0..27eff1eb 100644 --- a/gurubu-client/src/app/components/room/grooming-board/grooming-board-logs.tsx +++ b/gurubu-client/src/app/components/room/grooming-board/grooming-board-logs.tsx @@ -25,8 +25,6 @@ const GroomingBoardLogs = ({ roomId }: Props) => { return (
- {isGroomingInfoLoaded && ( - <>
    Participants ({Object.keys(groomingInfo?.participants || {}).length || "0"}) @@ -55,8 +53,6 @@ const GroomingBoardLogs = ({ roomId }: Props) => { roomId={roomId} /> )} - - )}
); }; diff --git a/gurubu-client/src/app/components/room/grooming-board/grooming-board-participant.tsx b/gurubu-client/src/app/components/room/grooming-board/grooming-board-participant.tsx index b5cce7bc..1683feaf 100644 --- a/gurubu-client/src/app/components/room/grooming-board/grooming-board-participant.tsx +++ b/gurubu-client/src/app/components/room/grooming-board/grooming-board-participant.tsx @@ -22,9 +22,6 @@ const GroomingBoardParticipant = ({ participantKey }: Props) => { [createAvatarSvg, serializedAvatar] ); - if (!participant) { - return null; - } const { isAdmin, sockets, votes = {}, nickname } = participant; const hasSockets = sockets.length > 0; const hasMaxVotes = @@ -45,12 +42,7 @@ const GroomingBoardParticipant = ({ participantKey }: Props) => { const noVote = isResultShown && vote === 0; return ( - { ); })}
- + ); }; diff --git a/gurubu-client/src/app/components/room/grooming-board/grooming-board-participants.tsx b/gurubu-client/src/app/components/room/grooming-board/grooming-board-participants.tsx index bef1e81c..648f9097 100644 --- a/gurubu-client/src/app/components/room/grooming-board/grooming-board-participants.tsx +++ b/gurubu-client/src/app/components/room/grooming-board/grooming-board-participants.tsx @@ -5,8 +5,42 @@ import { AnimatePresence } from "framer-motion"; const GroomingBoardParticipants = () => { const { groomingInfo } = useGroomingRoom(); - const groomingInfoParticipants = Object.keys(groomingInfo.participants || {}); - const [sortedParticipants, setSortedParticipants] = useState([]); + const groomingInfoParticipants = Object.keys({ + "0": { + "userID": 0, + "nickname": "Armagan", + "roomID": "e44fabf2-fe3f-4115-885e-117d7d6355bf", + "sockets": [ + "ZvbLDqyZZdoZ47lqAAAH" + ], + "isAdmin": true, + "connected": true, + "avatar": { + "seed": "xie3wsmnu9", + "scale": 150 + }, + "votes": { + "storyPoint": "2" + } + }, + "1": { + "userID": 1, + "nickname": "HelloFigma", + "roomID": "e44fabf2-fe3f-4115-885e-117d7d6355bf", + "sockets": [ + "NcA0GdSQRLhyWPbKAAAF" + ], + "isAdmin": false, + "connected": true, + "avatar": { + "seed": "yzrl7syjjdc" + }, + "votes": { + "storyPoint": "3" + } + } + },); + const [sortedParticipants, setSortedParticipants] = useState(["1","0"]); useEffect(() => { if (groomingInfo.isResultShown) { @@ -27,17 +61,19 @@ const GroomingBoardParticipants = () => { } }, [groomingInfo]); + console.log(sortedParticipants) + return ( <>
    - + {/* */} {sortedParticipants.map((participantKey) => ( ))} - + {/* */}
); diff --git a/gurubu-client/src/app/components/room/grooming-board/grooming-board.tsx b/gurubu-client/src/app/components/room/grooming-board/grooming-board.tsx index 80437dee..22ff7ca2 100644 --- a/gurubu-client/src/app/components/room/grooming-board/grooming-board.tsx +++ b/gurubu-client/src/app/components/room/grooming-board/grooming-board.tsx @@ -141,18 +141,6 @@ const GroomingBoard = ({ setEditVoteClicked(!editVoteClicked); }; - if (showNickNameForm) { - return null; - } - - if (encounteredError.id === ENCOUTERED_ERROR_TYPE.ROOM_EXPIRED) { - notFound(); - } - - if (!isGroomingInfoLoaded && roomStatus !== ROOM_STATUS.CHECKING) { - return ; - } - return (
{showLoader && } diff --git a/gurubu-client/src/app/components/room/grooming-navbar/grooming-navbar.tsx b/gurubu-client/src/app/components/room/grooming-navbar/grooming-navbar.tsx index d593f007..345824d3 100644 --- a/gurubu-client/src/app/components/room/grooming-navbar/grooming-navbar.tsx +++ b/gurubu-client/src/app/components/room/grooming-navbar/grooming-navbar.tsx @@ -36,10 +36,6 @@ const GroomingNavbar = ({ showNickNameForm, roomId }: Props) => { const { groomingInfo, roomStatus, userInfo, jiraSidebarExpanded } = useGroomingRoom(); const [isGroomingLinkCopied, setIsGroomingLinkCopied] = useState(false); - if (roomStatus !== ROOM_STATUS.FOUND || showNickNameForm) { - return null; - } - const getGroomingLink = () => { let currentUrl: string = ""; if (typeof window !== "undefined") { diff --git a/gurubu-client/src/app/contexts/GroomingRoomContext.tsx b/gurubu-client/src/app/contexts/GroomingRoomContext.tsx index 8551c3ad..88727160 100644 --- a/gurubu-client/src/app/contexts/GroomingRoomContext.tsx +++ b/gurubu-client/src/app/contexts/GroomingRoomContext.tsx @@ -34,8 +34,73 @@ export function useGroomingRoom() { export function GroomingRoomProvider({ children, roomId }: GroomingRoomProviderProps) { const [roomStatus, setRoomStatus] = useState(ROOM_STATUS.CHECKING); - const [userInfo, setUserinfo] = useState({} as UserInfo); - const [groomingInfo, setGroomingInfo] = useState({} as GroomingInfo); + const [userInfo, setUserinfo] = useState({lobby: {isAdmin: true },nickname: "Armagan"} as any); + const [groomingInfo, setGroomingInfo] = useState({ + "mode": "0", + "participants": { + "0": { + "userID": 0, + "nickname": "Armagan", + "roomID": "e44fabf2-fe3f-4115-885e-117d7d6355bf", + "sockets": [ + "ZvbLDqyZZdoZ47lqAAAH" + ], + "isAdmin": true, + "connected": true, + "avatar": { + "seed": "xie3wsmnu9", + "scale": 150 + }, + "votes": { + "storyPoint": "2" + } + }, + "1": { + "userID": 1, + "nickname": "HelloFigma", + "roomID": "e44fabf2-fe3f-4115-885e-117d7d6355bf", + "sockets": [ + "NcA0GdSQRLhyWPbKAAAF" + ], + "isAdmin": false, + "connected": true, + "avatar": { + "seed": "yzrl7syjjdc" + }, + "votes": { + "storyPoint": "3" + } + } + }, + "metrics": [ + { + "id": 1, + "name": "storyPoint", + "displayName": "Story Point", + "points": [ + "0.5", + "1", + "2", + "3", + "5", + "8", + "13", + "21", + "?", + "break" + ], + "text": "Story point of task" + } + ], + "score": "3.00", + "status": "ongoing", + "isResultShown": true, + "issues": [], + "timer": { + "timeLeft": 0, + "isRunning": false + } + } as any); const [userVote, setUserVote] = useState({} as UserVote); const [encounteredError, setEncounteredError] = useState({} as EncounteredError); const [showErrorPopup, setShowErrorPopup] = useState(false); diff --git a/gurubu-client/src/app/room/[id]/page.tsx b/gurubu-client/src/app/room/[id]/page.tsx index 66c8a02f..d28b3bc5 100644 --- a/gurubu-client/src/app/room/[id]/page.tsx +++ b/gurubu-client/src/app/room/[id]/page.tsx @@ -97,7 +97,6 @@ const GroomingRoomContent = ({ params }: { params: { id: string } }) => { [`${currentTheme}-active`]: isThemeActive, })} > -