-
Notifications
You must be signed in to change notification settings - Fork 21
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
105 additions
and
13 deletions.
There are no files selected for viewing
File renamed without changes.
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
27 changes: 27 additions & 0 deletions
27
apps/scoutgameadmin/components/users/ViewTransactionsButton/ViewTransactionsButton.tsx
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,27 @@ | ||
'use client'; | ||
|
||
import { Button } from '@mui/material'; | ||
import type { ButtonProps } from '@mui/material'; | ||
import { useState } from 'react'; | ||
import type { ReactNode } from 'react'; | ||
|
||
import { ViewTransactionsModal } from './ViewTransactionsModal'; | ||
|
||
export function ViewTransactionsButton({ | ||
children, | ||
scoutId, | ||
...props | ||
}: { | ||
children: ReactNode; | ||
scoutId: string; | ||
} & ButtonProps) { | ||
const [isModalOpen, setIsModalOpen] = useState(false); | ||
return ( | ||
<> | ||
<Button onClick={() => setIsModalOpen(true)} {...props}> | ||
{children} | ||
</Button> | ||
<ViewTransactionsModal open={isModalOpen} onClose={() => setIsModalOpen(false)} scoutId={scoutId} /> | ||
</> | ||
); | ||
} |
44 changes: 44 additions & 0 deletions
44
apps/scoutgameadmin/components/users/ViewTransactionsButton/ViewTransactionsModal.tsx
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,44 @@ | ||
import { LoadingButton } from '@mui/lab'; | ||
import { | ||
Dialog, | ||
DialogTitle, | ||
DialogContent, | ||
DialogActions, | ||
Stack, | ||
Button, | ||
TextField, | ||
CircularProgress, | ||
InputAdornment, | ||
Link, | ||
Typography, | ||
Box | ||
} from '@mui/material'; | ||
import React from 'react'; | ||
|
||
import { useGetScoutEvents } from 'hooks/api/onchain'; | ||
|
||
type Props = { | ||
open: boolean; | ||
onClose: () => void; | ||
scoutId: string; | ||
}; | ||
|
||
export function ViewTransactionsModal({ open, onClose, scoutId }: Props) { | ||
const { data, error, isLoading } = useGetScoutEvents(open ? scoutId : ''); | ||
return ( | ||
<Dialog open={open} onClose={onClose} PaperProps={{ sx: { maxWidth: 800 } }} fullWidth> | ||
<DialogTitle>NFT Purchase transactions</DialogTitle> | ||
<DialogContent> | ||
<Box component='pre' maxHeight={600} overflow='auto' fontFamily='monospace' fontSize={12}> | ||
{JSON.stringify(data, null, 2)} | ||
</Box> | ||
{isLoading && <CircularProgress />} | ||
{error && ( | ||
<Typography variant='caption' color='red'> | ||
{error.message} | ||
</Typography> | ||
)} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { RepoSearchResult } from '../../app/api/github/search-repos/route'; | ||
|
||
import { useGET } from './helpers'; | ||
|
||
export function useGetScoutEvents(scoutId: string) { | ||
return useGET<RepoSearchResult[]>(scoutId ? '/api/onchain/scout-events' : null, { scoutId }); | ||
} | ||
|
||
export function useGetTransactionStatus({ chainId, txHash }: { chainId: string; txHash: string }) { | ||
return useGET<RepoSearchResult[]>(chainId && txHash ? '/api/onchain/transaction-status' : null, { chainId, txHash }); | ||
} |
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