Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(unlock-app): No more tools #15396

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 1 addition & 80 deletions unlock-app/src/components/content/event/EventDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@

import { BiQrScan as ScanIcon } from 'react-icons/bi'
import { useRouter } from 'next/navigation'
import {
Button,
Card,
Disclosure,
Icon,
minifyAddress,
} from '@unlock-protocol/ui'
import { Button, Icon } from '@unlock-protocol/ui'
import { getEventDate, getEventEndDate, getEventUrl } from './utils'
import { useEventOrganizer } from '~/hooks/useEventOrganizer'
import { useEventOrganizers } from '~/hooks/useEventOrganizers'
import dayjs from 'dayjs'
import { Event, PaywallConfigType } from '@unlock-protocol/core'
import { useEvent } from '~/hooks/useEvent'
import { SettingEmail } from '~/components/interface/locks/Settings/elements/SettingEmail'
import { FaUsers } from 'react-icons/fa'
import { TbSettings } from 'react-icons/tb'
import { useEventVerifiers } from '~/hooks/useEventVerifiers'
Expand Down Expand Up @@ -200,78 +193,6 @@ export const EventDetails = ({
</div>
</div>
{renderEventLayout()}
<section className="flex flex-col">
{isOrganizer && (
<div className="grid gap-6 mt-12">
<span className="text-2xl font-bold text-brand-dark">
Tools for you, the event organizer
</span>
<div className="grid gap-4">
<Disclosure
label="Emails"
description="Customize the emails your attendees will receive."
>
<div className="flex flex-col gap-4">
{Object.keys(checkoutConfig.config.locks).map(
(lockAddress: string) => {
const network =
checkoutConfig.config.locks[lockAddress].network ||
checkoutConfig.config.network
if (Object.keys(checkoutConfig.config.locks).length > 1) {
return (
<Disclosure
label={`Emails for ${minifyAddress(lockAddress)}`}
key={lockAddress}
>
<SettingEmail
key={lockAddress}
lockAddress={lockAddress}
network={network!}
isManager={true}
isLoading={false}
/>
</Disclosure>
)
} else {
return (
<SettingEmail
key={lockAddress}
lockAddress={lockAddress}
network={network!}
isManager={true}
isLoading={false}
/>
)
}
}
)}
</div>
</Disclosure>
{/* Put that only if the event requires the checkout? */}
<Card className="grid grid-cols-1 gap-2 md:items-center md:grid-cols-3">
<div className="md:col-span-2">
<Card.Label
title="Checkout configuration"
description="Configure the checkout experience for your event: collect attendee info... etc."
/>
</div>
<div className="md:col-span-1">
<Button
variant="black"
className="button border w-full"
size="small"
onClick={() => {
router.push(`/locks/checkout-url?id=${checkoutConfig.id}`)
}}
>
Configure
</Button>
</div>
</Card>
</div>
</div>
)}
</section>
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Card, Detail, Icon } from '@unlock-protocol/ui'
import dayjs from 'dayjs'
import { useEventAttendees } from '~/hooks/useEventAttendees'
import { useEventRSVP } from '~/hooks/useRsvp'
import { WrappedAddress } from '~/components/interface/WrappedAddress'

interface EventCardProps {
event: {
Expand Down Expand Up @@ -36,8 +35,6 @@ const EventImage = ({ imageUrl }: EventImageProps) => {

export const EventCard = ({ event }: EventCardProps) => {
const { name, checkoutConfig, slug, ticket, image: imageUrl } = event
const lockAddress = Object.keys(checkoutConfig.config.locks)[0]
const network = checkoutConfig.config.locks[lockAddress].network
const eventDate = dayjs(ticket.event_start_date).format('D MMM YYYY')
const eventEndDate = dayjs(ticket.event_end_date).format('D MMM YYYY')

Expand All @@ -62,12 +59,6 @@ export const EventCard = ({ event }: EventCardProps) => {
{name}
</span>
</div>
<WrappedAddress
className="text-brand-dark text-sm md:text-base overflow-hidden overflow-ellipsis line-clamp-3"
address={lockAddress}
network={network}
addressType="lock"
/>
</div>
</div>

Expand Down
Loading