-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(unlock-app): Refactored UI for attendee list (#13204)
* support for multiple locks on the filter when showing attendee list * updated filters handling * more progress
- Loading branch information
Showing
9 changed files
with
360 additions
and
126 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
112 changes: 112 additions & 0 deletions
112
unlock-app/src/components/content/event/attendees/AttendeeInfo.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,112 @@ | ||
import { Button, Detail } from '@unlock-protocol/ui' | ||
import { useEffect, useState } from 'react' | ||
import { ExpireAndRefundModal } from '~/components/interface/ExpireAndRefundModal' | ||
import useEns from '~/hooks/useEns' | ||
import { addressMinify } from '~/utils/strings' | ||
import { BiCopy as CopyIcon } from 'react-icons/bi' | ||
import useClipboard from 'react-use-clipboard' | ||
import { ToastHelper } from '~/components/helpers/toast.helper' | ||
import { Metadata } from '@unlock-protocol/core' | ||
|
||
interface AttendeeInfoProps { | ||
network: number | ||
lockAddress: string | ||
owner: string | ||
token: string | ||
metadata: Metadata | ||
} | ||
|
||
export const AttendeeInfo = ({ | ||
network, | ||
lockAddress, | ||
owner, | ||
token, | ||
metadata, | ||
}: AttendeeInfoProps) => { | ||
const [expireAndRefundOpen, setExpireAndRefundOpen] = useState(false) | ||
|
||
const addressToEns = useEns(owner) | ||
const resolvedAddress = | ||
addressToEns === owner ? addressMinify(owner) : addressToEns | ||
const addressToCopy = addressToEns === owner ? owner : addressToEns | ||
|
||
const [isCopied, setCopied] = useClipboard(addressToCopy, { | ||
successDuration: 2000, | ||
}) | ||
|
||
useEffect(() => { | ||
if (!isCopied) return | ||
ToastHelper.success('Address copied') | ||
}, [isCopied]) | ||
|
||
return ( | ||
<> | ||
<ExpireAndRefundModal | ||
network={network} | ||
isOpen={expireAndRefundOpen} | ||
setIsOpen={setExpireAndRefundOpen} | ||
lockAddress={lockAddress} | ||
keyOwner={owner} | ||
tokenId={token} | ||
/> | ||
|
||
<div className="flex md:flex-row flex-col gap-4 space-between w-full"> | ||
<Detail label="#" valueSize="medium" className="w-8"> | ||
{token} | ||
</Detail> | ||
|
||
<Detail label="Full Name" valueSize="medium" className="grow w-24"> | ||
{metadata.fullname} | ||
</Detail> | ||
|
||
<Detail label="Email" valueSize="medium" className="grow w-32"> | ||
{metadata.email} | ||
</Detail> | ||
|
||
<Detail label="Wallet" valueSize="medium" className="grow"> | ||
<div className="flex self-start gap-2"> | ||
<div>{resolvedAddress}</div> | ||
<div className="mt-auto"> | ||
<Button | ||
variant="borderless" | ||
onClick={setCopied} | ||
aria-label="copy" | ||
> | ||
<CopyIcon size={20} /> | ||
</Button> | ||
</div> | ||
</div> | ||
</Detail> | ||
|
||
{/* {isManager && ( | ||
<div className="w-full col-span-3 gap-3 mx-auto md:mx-0 md:ml-auto md:col-span-2 md:w-auto"> | ||
{!refundDisabled && ( | ||
<Button | ||
size="small" | ||
variant="outlined-primary" | ||
disabled={refundDisabled} | ||
aria-label="refund" | ||
onClick={() => { | ||
if (refundDisabled) return | ||
setExpireAndRefundOpen(true) | ||
}} | ||
> | ||
Cancel | ||
</Button> | ||
)} | ||
{canExtendKey && ( | ||
<Button | ||
variant="outlined-primary" | ||
size="small" | ||
onClick={() => setExtendKeysOpen(true)} | ||
className="mt-1" | ||
> | ||
Extend | ||
</Button> | ||
)} | ||
</div> | ||
)} */} | ||
</div> | ||
</> | ||
) | ||
} |
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
Oops, something went wrong.