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

🌝 Add share buttons #205

Closed
wants to merge 79 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
396e3c3
DC7 (#1)
kevincharm Mar 28, 2024
fc0fbd5
🐔 Setup next repo (#2)
b-tarczynski Apr 4, 2024
ec909c0
💅 Enable styled components in next app (#3)
b-tarczynski Apr 8, 2024
ee226c9
🏎️ Migrate to turbo and pnpm (#4)
b-tarczynski Apr 10, 2024
94a2d33
🥷 Remove outdated code (#5)
b-tarczynski Apr 11, 2024
3629e80
🐔 Configure wagmi (#6)
b-tarczynski Apr 11, 2024
1b68408
🤟 Migrate Information component (#8)
b-tarczynski Apr 15, 2024
d5f04ea
👐 Add winners count to useReadAuctionParams (#9)
b-tarczynski Apr 15, 2024
bfc475a
👩‍🚀 Update auction ABI to the latest version (#10)
b-tarczynski Apr 15, 2024
5800c37
👖 Add a linter coinfiguration (#11)
p-sad Apr 16, 2024
1223af1
👩‍🚒 Add bids provider (#12)
b-tarczynski Apr 16, 2024
7efc05c
🦀 Run lint in CI (#13)
p-sad Apr 17, 2024
23c96aa
🎈 Use correct branch in CI job (#15)
b-tarczynski Apr 17, 2024
363777e
Update deployment scripts (#7)
kevincharm Apr 17, 2024
6ea254e
🪄 Support Hardhat chain in frontend app (#16)
b-tarczynski Apr 17, 2024
0c0aaa5
📜 Migrate bids list on homepage (#14)
b-tarczynski Apr 17, 2024
b046e27
🎈 Add environment example (#20)
b-tarczynski Apr 19, 2024
eaaac13
📖 Migrate bids page (#17)
b-tarczynski Apr 19, 2024
a0b2fc9
🪄 Utilize getBidsWithAddresses function (#19)
b-tarczynski Apr 19, 2024
35e430e
🧹 Migrate settled bids list (#18)
b-tarczynski Apr 19, 2024
ec1142d
🐔 Add a connect wallet warning (#21)
p-sad Apr 19, 2024
543c5ba
🤺 Persist bid place in BidsProvider (#22)
b-tarczynski Apr 19, 2024
639b82d
🎸 Add Gitcoin flow with first step (#23)
pazernykormoran Apr 22, 2024
be43040
🥾 Check Gitcoin score and adjust stepper (#24)
pazernykormoran Apr 23, 2024
ca92304
🍫 Add top bar (#25)
b-tarczynski Apr 23, 2024
9acfa97
🫴 Add Place Bid form (#26)
p-sad Apr 23, 2024
6fb17d4
🎪 Add user's Gitcoin score view (#27)
b-tarczynski Apr 23, 2024
1a1aef6
⏳ Add awaiting bidding view (#29)
b-tarczynski Apr 24, 2024
a6f9da9
🧱 Add claiming static views (#30)
b-tarczynski Apr 24, 2024
55483b5
Add You don't have passport page (#28)
pazernykormoran Apr 24, 2024
0ff473c
🧦 Handle user's invalid network (#31)
b-tarczynski Apr 24, 2024
0694819
ℹ️ Add WinType to useUserBid (#33)
pazernykormoran Apr 25, 2024
45df029
💅🏻 Update colors (#34)
mrushkova Apr 25, 2024
93dfb7a
🕹️ Update buttons (#35)
mrushkova Apr 25, 2024
f5c4b28
🏧 Add claiming flow components (#32)
b-tarczynski Apr 25, 2024
7434832
🖌️ Update typography (#38)
mrushkova Apr 25, 2024
e9d34dc
🥸 Update header (#40)
mrushkova Apr 26, 2024
27ba9cf
🪮 Add withdraw with voucher view (#39)
pazernykormoran Apr 26, 2024
75861c0
🔮 Add claimed field to useUserBid (#37)
pazernykormoran Apr 26, 2024
28286ec
🐷 Add Place Bid transaction flow (#36)
p-sad Apr 26, 2024
8a7cdd3
💅 Resolve transient props in styled components warnings (#41)
b-tarczynski Apr 26, 2024
6f81419
🎰 Update bid page & lists (#42)
mrushkova Apr 29, 2024
fe3079f
🪗 Update accordion styles (#46)
mrushkova Apr 29, 2024
cb47d98
🦑 Add Bump Bid flow (#43)
p-sad Apr 29, 2024
b791d3e
🫴 Handle voucher claiming (#44)
b-tarczynski Apr 29, 2024
710805c
🧚 Add footer (#48)
mrushkova Apr 29, 2024
a137e4a
🥸 Implement claiming review (#45)
pazernykormoran Apr 29, 2024
5386bac
🎲 Update action section (#50)
mrushkova Apr 30, 2024
222a65d
Migrate backend routes (#47)
kevincharm Apr 30, 2024
b4657f9
👨‍🎨 Correctly handle bid bumps (#53)
b-tarczynski Apr 30, 2024
ff866b6
🍡 Display balance with less precision digits (#51)
mrushkova Apr 30, 2024
0aefe81
🥇 Handle rest win flows (#52)
pazernykormoran Apr 30, 2024
7d26659
🍦 Integrate with voucher claiming api (#54)
b-tarczynski May 2, 2024
da17eb1
🌑 Integrate with Gitcoin backend (#55)
pazernykormoran May 9, 2024
7113e0a
🦙 Add status toasts for blockchain transactions (#56)
p-sad May 9, 2024
27c199c
🔀 Handle create passport button (#57)
pazernykormoran May 13, 2024
b32a639
🥘 Correctly calculate voucher expiration (#58)
b-tarczynski May 13, 2024
5818c27
🔦 Highlight auction bid only once (#59)
b-tarczynski May 13, 2024
46c1f9e
🎨 Update application metadata (#60)
b-tarczynski May 14, 2024
3472c4a
🤺 Update Arbitrum Sepolia contract address (#61)
b-tarczynski May 14, 2024
578a7e5
🎓 Make AddressLink black (#62)
b-tarczynski May 14, 2024
37a00f4
🐣 Send address for scoring when recalculating (#64)
b-tarczynski May 16, 2024
30829d8
add Feistel shuffle test coverage (#49)
kevincharm May 28, 2024
7be621f
add supplementary documentation (#65)
kevincharm May 28, 2024
6835de9
Make settling permissionless & cleanup (#67)
kevincharm Jun 6, 2024
31892be
☎️ Add mobile layout (#68)
mrushkova Jun 7, 2024
d95d689
🪙 Add mobile styles for all bids page (#69)
mrushkova Jun 10, 2024
b6fd919
👩🏻‍🎤 Add mobile styles for user action section (#70)
mrushkova Jun 11, 2024
30bb503
🎉 Add mobile styles for win flow (#71)
mrushkova Jun 11, 2024
c21dcd0
🤳🏻 Make buttons wide on mobile (#72)
mrushkova Jun 11, 2024
7595fab
🥅 Add mobile styles for modal (#73)
mrushkova Jun 11, 2024
a26a814
🎹 Add tablet styles (#74)
mrushkova Jun 12, 2024
08ea1bb
Add social media icons
mrushkova Jun 17, 2024
b7074c8
Add icon prop to button
mrushkova Jun 17, 2024
e54e1ba
Add twitter share button
mrushkova Jun 17, 2024
7aa5c1e
Add farcaster share button
mrushkova Jun 17, 2024
97dd6bf
Change back button style
mrushkova Jun 17, 2024
8fc6f98
Keep action Place
mrushkova Jun 17, 2024
e44d3e0
Adjust user action section styles for tablet
mrushkova Jun 17, 2024
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
Prev Previous commit
Next Next commit
🧹 Migrate settled bids list (#18)
  • Loading branch information
b-tarczynski authored Apr 19, 2024
commit 35e430e72425a0ac3c1a1b31f518453d7843ca88
13 changes: 13 additions & 0 deletions packages/frontend/src/blockchain/hooks/useExplorerAddressLink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Hex } from 'viem'
import { useChainId, useChains } from 'wagmi'

export const useExplorerAddressLink = (address: Hex): string | undefined => {
const chains = useChains()
const chainId = useChainId()
const currentChain = chains.find((chain) => chain.id === chainId)

if (!currentChain || !currentChain.blockExplorers?.default) {
return undefined
}
return `${currentChain.blockExplorers.default.url}/address/${address}`
}
13 changes: 1 addition & 12 deletions packages/frontend/src/components/bids/BidsListEntry.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AddressColumn, BidColumn, PlaceColumn } from '@/components/bids/BidsColumns'
import styled, { css } from 'styled-components'
import { useChainId, useChains } from 'wagmi'
import { BidWithPlace } from '@/types/bid'
import { Colors } from '@/styles/colors'
import { formatEther, Hex } from 'viem'
import { useExplorerAddressLink } from '@/blockchain/hooks/useExplorerAddressLink'

interface Props {
bid: BidWithPlace
@@ -29,17 +29,6 @@ export const BidsListEntry = ({ bid, isUser, view = 'full' }: Props) => {
)
}

const useExplorerAddressLink = (address: Hex): string | undefined => {
const chains = useChains()
const chainId = useChainId()
const currentChain = chains.find((chain) => chain.id === chainId)

if (!currentChain || !currentChain.blockExplorers?.default) {
return undefined
}
return `${currentChain.blockExplorers.default.url}/address/${address}`
}

const shortenEthAddress = (address: Hex) => `${address.substring(0, 6)}......${address.substring(address.length - 4)}`

const BidsEntryRow = styled.div<{ isUser?: boolean }>`
16 changes: 15 additions & 1 deletion packages/frontend/src/components/bids/allBids/AllBids.tsx
Original file line number Diff line number Diff line change
@@ -6,6 +6,9 @@ import { NothingFound } from '@/components/bids/allBids/NothingFound'
import { LoadingBids } from '@/components/bids/allBids/LoadingBids'
import { AllBidsList } from '@/components/bids/allBids/AllBidsList'
import { SearchInput } from '@/components/form/SearchInput'
import { useContractState } from '@/blockchain/hooks/useAuctionState'
import { isAuctionSettled } from '@/utils/isAuctionSettled'
import { SettledBidsList } from '@/components/bids/allBids/SettledBidsList'

export const AllBids = () => {
const [search, setSearch] = useState('')
@@ -21,6 +24,7 @@ export const AllBids = () => {
const AllBidsContent = ({ search }: { search: string }) => {
const { auctionWinnersCount, raffleWinnersCount, isLoading: areParamsLoading } = useReadAuctionParams()
const { bidList, isLoading: areBidsLoading } = useBids()
const { state } = useContractState()

if (areParamsLoading || areBidsLoading || !auctionWinnersCount || !raffleWinnersCount) {
return <LoadingBids />
@@ -31,7 +35,17 @@ const AllBidsContent = ({ search }: { search: string }) => {
}

return (
<AllBidsList search={search} auctionWinnersCount={auctionWinnersCount} raffleWinnersCount={raffleWinnersCount} />
<>
{isAuctionSettled(state) ? (
<SettledBidsList search={search} />
) : (
<AllBidsList
search={search}
auctionWinnersCount={auctionWinnersCount}
raffleWinnersCount={raffleWinnersCount}
/>
)}
</>
)
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import styled from 'styled-components'
import { Colors } from '@/styles/colors'
import { useExplorerAddressLink } from '@/blockchain/hooks/useExplorerAddressLink'
import { Hex } from 'viem'

interface Props {
bidderAddress: Hex
}

export const GoldenTicketWinner = ({ bidderAddress }: Props) => {
const explorerLink = useExplorerAddressLink(bidderAddress)

return (
<Container>
<ReverseDoot>🎉</ReverseDoot>
<Section>
<HeaderText>THE GOLDEN TICKET WINNER IS:</HeaderText>
<AddressLink href={explorerLink} target="_blank" rel="noopener noreferrer">
{bidderAddress}
</AddressLink>
</Section>
<Doot>🎉</Doot>
</Container>
)
}

const Container = styled.div`
display: flex;
justify-content: space-evenly;
align-items: center;
width: 100%;
height: 90px;
background-color: ${Colors.GreenLight};
`

const Section = styled.div`
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
height: 100%;
`

const Doot = styled.div`
display: flex;
justify-content: center;
align-items: center;
font-size: 40px;
`

const ReverseDoot = styled(Doot)`
transform: matrix(-1, 0, 0, 1, 0, 0);
`

const HeaderText = styled.h3`
font-size: 20px;
line-height: 150%;
`

const AddressLink = styled.a`
font-family: 'Space Mono', 'Roboto Mono', monospace;
font-style: normal;
color: ${Colors.Blue};
text-decoration: none;
`
107 changes: 107 additions & 0 deletions packages/frontend/src/components/bids/allBids/SettledBidsList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { useMemo } from 'react'
import { Bid, bidToBidWithPlace } from '@/types/bid'
import { useBids } from '@/providers/BidsProvider'
import { useAuctionWinners } from '@/blockchain/hooks/useAuctionWinners'
import { GoldenTicketWinner } from '@/components/bids/allBids/GoldenTicketWinner'
import { NothingFound } from '@/components/bids/allBids/NothingFound'
import { BidsListHeaders } from '@/components/bids/BidsListHeaders'
import { BidsSubList } from '@/components/bids/allBids/BidsSubList'
import { bidMatchesSearch } from '@/components/bids/allBids/bidMatchesSearch'

interface Bids {
auction: Bid[]
raffle: Bid[]
others: Bid[]
goldenTicket?: Bid
}

interface SettledBidsListProps {
search: string
}

export const SettledBidsList = ({ search }: SettledBidsListProps) => {
const { bidList } = useBids()
const matchesSearch = bidMatchesSearch(search)
const { auctionWinners, raffleWinners } = useAuctionWinners()

const settledBids = useMemo(
() => divideBids(bidList, auctionWinners, raffleWinners),
[bidList, auctionWinners, raffleWinners],
)

const filteredBids = useMemo(() => filterBids(settledBids, matchesSearch), [settledBids, matchesSearch])

return (
<>
{search && isEmpty(filteredBids) ? (
<NothingFound search={search} />
) : (
<>
{filteredBids.goldenTicket && <GoldenTicketWinner bidderAddress={filteredBids.goldenTicket.address} />}
<BidsListHeaders />
{filteredBids.auction.length !== 0 && (
<BidsSubList bids={filteredBids.auction} placeOffset={0} title="AUCTION" />
)}
{filteredBids.raffle.length !== 0 && (
<BidsSubList bids={filteredBids.raffle} placeOffset={filteredBids.auction.length} title="RAFFLE" />
)}
{filteredBids.others.length !== 0 && (
<BidsSubList
bids={filteredBids.others}
placeOffset={filteredBids.raffle.length + filteredBids.auction.length}
title="OTHERS"
/>
)}
</>
)}
</>
)
}

function divideBids(
bids: Bid[],
auctionWinners: readonly bigint[] | undefined,
raffleWinners: readonly bigint[] | undefined,
): Bids {
const settledBids: Bids = {
auction: [],
raffle: [],
others: [],
}

if (!auctionWinners || !raffleWinners) {
return settledBids
}

bids.forEach((bid, index) => {
const bidderID = bid.bidderId
const bidWithPlace = bidToBidWithPlace(bid, index)
if (auctionWinners.find((winnerId) => bid.bidderId === winnerId)) {
settledBids.auction.push(bidWithPlace)
return
}
if (bidderID === raffleWinners[0]) {
settledBids.goldenTicket = bidWithPlace
return
}
if (raffleWinners.find((winnerId) => bid.bidderId === winnerId)) {
settledBids.raffle.push(bidWithPlace)
return
}
settledBids.others.push(bidWithPlace)
})
return settledBids
}

function filterBids(bids: Bids, matchesSearch: (bid: Bid) => boolean) {
return {
auction: bids.auction.filter(matchesSearch),
raffle: bids.raffle.filter(matchesSearch),
others: bids.others.filter(matchesSearch),
goldenTicket: bids.goldenTicket && matchesSearch(bids.goldenTicket) ? bids.goldenTicket : undefined,
}
}

function isEmpty(bids: Bids) {
return bids.auction.length === 0 && bids.raffle.length === 0 && bids.others.length === 0 && !bids.goldenTicket
}