-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
158 additions
and
13 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,11 +1,15 @@ | ||
import { InjectedTxConsts } from '@shared/otherTypes'; | ||
|
||
type LogoutNoticeMessage = { type: 'logoutNotice' } | ||
type OpenAccountModalMessage = { type: 'openAccountModal' } | ||
type OpenPlayerModalMessage = { type: 'openPlayerModal', ref: PlayerModalRefType } | ||
|
||
export declare global { | ||
interface Window { | ||
txConsts: InjectedTxConsts; | ||
invokeNative?: (nativeName: string, ...args: any[]) => void; | ||
} | ||
type MessageEventFromIframe = MessageEvent<LogoutNoticeMessage> | ||
| MessageEvent<OpenAccountModalMessage> | ||
| MessageEvent<OpenPlayerModalMessage>; | ||
} |
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,37 @@ | ||
import { useAtom, useAtomValue, useSetAtom } from "jotai"; | ||
import { atomWithReset } from 'jotai/utils'; | ||
|
||
|
||
/** | ||
* Prompt Dialog Stuff | ||
*/ | ||
type PlayerModalRefType = { | ||
mutex: string; | ||
netid: number; | ||
} | { | ||
license: string; | ||
} | undefined; | ||
export const playerModalOpenAtom = atomWithReset(false); | ||
export const playerModalRefAtom = atomWithReset<PlayerModalRefType>(undefined); | ||
|
||
//Hook to open the player modal | ||
export const useOpenPlayerModal = () => { | ||
const setModalRef = useSetAtom(playerModalRefAtom); | ||
const setModalOpen = useSetAtom(playerModalOpenAtom); | ||
return (data: Exclude<PlayerModalRefType, undefined>) => { | ||
setModalRef(data); | ||
setModalOpen(true); | ||
} | ||
}; | ||
|
||
|
||
//General hook for the state of the modal | ||
export const usePlayerModalStateValue = () => { | ||
const playerRef = useAtomValue(playerModalRefAtom); | ||
const [isModalOpen, setIsModalOpen] = useAtom(playerModalOpenAtom); | ||
return { | ||
isModalOpen, | ||
playerRef, | ||
closeModal: () => setIsModalOpen(false), | ||
} | ||
} |
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,74 @@ | ||
import { | ||
Dialog, | ||
DialogContent, DialogFooter, | ||
DialogHeader, | ||
DialogTitle | ||
} from "@/components/ui/dialog"; | ||
import { Button } from "@/components/ui/button"; | ||
import { usePlayerModalStateValue } from "@/hooks/playerModal"; | ||
import { AlertTriangleIcon, MailIcon, ShieldCheckIcon, InfoIcon, ListIcon, HistoryIcon, BanIcon } from "lucide-react"; | ||
import { KickOneIcon } from '@/components/KickIcons'; | ||
|
||
|
||
export default function PlayerModal() { | ||
const { isModalOpen, closeModal, playerRef } = usePlayerModalStateValue(); | ||
|
||
const handleOpenClose = (newOpenState: boolean) => { | ||
if (isModalOpen && !newOpenState) { | ||
closeModal(); | ||
} | ||
}; | ||
|
||
return ( | ||
<Dialog open={isModalOpen} onOpenChange={handleOpenClose}> | ||
<DialogContent className="max-w-2xl" autoFocus={false}> | ||
<DialogHeader> | ||
<DialogTitle>[2] Tang Salvatore</DialogTitle> | ||
</DialogHeader> | ||
|
||
{JSON.stringify(playerRef)} | ||
<span className="text-fuchsia-500">pretend here lies the player modal content</span> | ||
|
||
<DialogFooter className="w-full justify-centerx xjustify-around sm:flex-colx gap-2"> | ||
<Button | ||
variant='outline' | ||
disabled={false} //FIXME: | ||
onClick={() => { }} //FIXME: | ||
className="pl-2" | ||
> | ||
<ShieldCheckIcon className="h-5 mr-1" /> Give Admin | ||
</Button> | ||
<Button | ||
variant='outline' | ||
disabled={false} //FIXME: | ||
onClick={() => { }} //FIXME: | ||
className="pl-2" | ||
> | ||
<MailIcon className="h-5 mr-1" /> DM | ||
</Button> | ||
<Button | ||
variant='outline' | ||
disabled={false} //FIXME: | ||
onClick={() => { }} //FIXME: | ||
className="pl-2" | ||
> | ||
<KickOneIcon style={{ | ||
height: '1.25rem', | ||
width: '1.75rem', | ||
marginRight: '0.25rem', | ||
fill: 'currentcolor' | ||
}} /> Kick | ||
</Button> | ||
<Button | ||
variant='outline' | ||
disabled={false} //FIXME: | ||
onClick={() => { }} //FIXME: | ||
className="pl-2" | ||
> | ||
<AlertTriangleIcon className="h-5 mr-1" /> Warn | ||
</Button> | ||
</DialogFooter> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
} |
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