-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FE] 방장은 다른 참가자를 강제퇴장 시킬 수 있다. (#129)
* chore: 디버깅용 console.log 제거 * chore: react-toastify 설치 및 ToastContainer App.tsx에 추가 * feat: 강퇴 관련 타입, 상태, 이벤트 설정 * feat: 강퇴 기능 구현 * feat: 강퇴 버튼을 클릭하면 KickDialog 띄우기 * style: 토스트 메시지 폰트 변경
- Loading branch information
1 parent
894af96
commit eac257f
Showing
10 changed files
with
186 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// pages/GamePage/PlayerList/KickDialog.tsx | ||
import { | ||
AlertDialog, | ||
AlertDialogAction, | ||
AlertDialogCancel, | ||
AlertDialogContent, | ||
AlertDialogDescription, | ||
AlertDialogFooter, | ||
AlertDialogHeader, | ||
AlertDialogTitle, | ||
} from '@/components/ui/alert-dialog'; | ||
import { RoomDialogProps } from '@/types/roomTypes'; | ||
import { gameSocket } from '@/services/gameSocket'; | ||
import { cn } from '@/lib/utils'; | ||
|
||
interface KickDialogProps extends RoomDialogProps { | ||
playerNickname: string; | ||
} | ||
|
||
const KickDialog = ({ | ||
open, | ||
onOpenChange, | ||
playerNickname, | ||
}: KickDialogProps) => { | ||
const handleKick = () => { | ||
gameSocket.kickPlayer(playerNickname); | ||
onOpenChange(false); | ||
}; | ||
|
||
return ( | ||
<AlertDialog open={open} onOpenChange={onOpenChange}> | ||
<AlertDialogContent className="font-galmuri sm:max-w-[22rem]"> | ||
<AlertDialogHeader> | ||
<AlertDialogTitle>강제 퇴장 확인</AlertDialogTitle> | ||
<AlertDialogDescription> | ||
{playerNickname}님을 정말로 강제 퇴장 하시겠습니까? | ||
</AlertDialogDescription> | ||
</AlertDialogHeader> | ||
<AlertDialogFooter> | ||
<AlertDialogCancel>취소</AlertDialogCancel> | ||
<AlertDialogAction | ||
onClick={handleKick} | ||
className={cn('bg-destructive hover:bg-destructive/90')} | ||
> | ||
확인 | ||
</AlertDialogAction> | ||
</AlertDialogFooter> | ||
</AlertDialogContent> | ||
</AlertDialog> | ||
); | ||
}; | ||
|
||
export default KickDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters