Skip to content

Commit

Permalink
Merge pull request #118 from DyadStablecoin/chore/mobileoptimization
Browse files Browse the repository at this point in the history
Mobile optimization
  • Loading branch information
shafu0x authored Feb 1, 2023
2 parents df46472 + e6adc7f commit 591037d
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/components/Leaderboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export default function Leaderboard() {
}

return (
<div className="flex items-center justify-center flex-col">
<div className="md:w-[80rem]">
<div className="flex flex-col items-center justify-center">
<div className="w-full md:w-[80rem] md:p-0 p-2">
<Loading isLoading={isLoading} />
<Header refetch={refetch} />
<div className="flex justify-between">
<div className="flex items-center justify-between">
<Filter setOption={setOption} resetRange={resetRange} />
<Search
owner={owner}
Expand Down
10 changes: 3 additions & 7 deletions src/components/LeaderboardRowMore.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export default function LeaderboardRowMore({ nft, setTxHash }) {
return (
<>
<Menu>
<MenuButton as={Button} style={{ backgroundColor: "black" }}>
<MenuButton as={Button} style={{ backgroundColor: "black", zIndex: 0 }}>
<MoreOutlined rotate={90} />
</MenuButton>
<MenuList style={{ backgroundColor: "black" }}>
<MenuList style={{ backgroundColor: "black", zIndex: 1 }}>
<MenuItem style={MENU_ITEM_STYLE} onClick={onOpenMoveDeposit}>
<div className={`flex items-center justify-center gap-4`}>
<MailOutlined />
Expand Down Expand Up @@ -69,11 +69,7 @@ export default function LeaderboardRowMore({ nft, setTxHash }) {
<Liquidate nft={nft} onClose={onCloseLiquidate} setTxHash={setTxHash} />
</Popup>
<Popup isOpen={isOpenMoveDeposit} onClose={onCloseMoveDeposit}>
<Move
nft={nft}
onClose={onCloseMoveDeposit}
setTxHash={setTxHash}
/>
<Move nft={nft} onClose={onCloseMoveDeposit} setTxHash={setTxHash} />
</Popup>
<Popup isOpen={isOpenSnipe} onClose={onCloseSnipe}>
<Snipe nft={nft} onClose={onCloseSnipe} setTxHash={setTxHash} />
Expand Down
8 changes: 7 additions & 1 deletion src/components/LeaderboardTableHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ export default function LeaderboardTableHeader({ sortBy, setSortBy }) {
<th>rank</th>
<SortableHeader header="xp" sortBy={sortBy} setSortBy={setSortBy} />
<th>value</th>
<SortableHeader header="deposit" sortBy={sortBy} setSortBy={setSortBy} />
<SortableHeader
header="deposit"
sortBy={sortBy}
setSortBy={setSortBy}
extraClasses={"hidden md:table-cell"}
/>
<SortableHeader
header="withdrawn"
sortBy={sortBy}
setSortBy={setSortBy}
extraClasses={"hidden md:table-cell"}
/>
<th className="hidden md:table-cell">Deposit Ratio</th>
<th>Address</th>
Expand Down
6 changes: 4 additions & 2 deletions src/components/LeaderboardTableHeaderSortable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ import {
CaretUpOutlined,
SwapOutlined,
} from "@ant-design/icons";
import cn from "classnames";

export default function LeaderboardTableHeaderSortable({
header,
sortBy,
setSortBy,
extraClasses,
}) {
return (
<th>
<div className="flex items-center justify-center gap-1">
<th className={cn(extraClasses ? extraClasses : "")}>
<div className={"flex items-center justify-center gap-1"}>
<div>{header}</div>
<SwapOutlined
rotate={90}
Expand Down
2 changes: 1 addition & 1 deletion src/components/LeaderboardTableRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function LeaderboardTableRow({
<>
{nft && (
<tr
className="leaderboard-row"
className="transition-all leaderboard-row hover:scale-[1.01] text-sm md:text-base"
style={{
border: `1px solid ${
status === STATUS.LIQUIDATABLE ? COLORS.Red : "#3A403C"
Expand Down
58 changes: 36 additions & 22 deletions src/components/NFT.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,28 +159,42 @@ export default function NFT({ tokenId }) {
${status === STATUS.LIQUIDATABLE && "shadow-lg shadow-[#800101]"}`}
>
<LoadingInplace isLoading={isLoadingTx || isFetching} />
<div className="flex gap-4 justify-between w-full">
<div className="md:w-[8rem]">
<div className="w-[107px]">
<img src={image} alt="" />
<div className="flex flex-col justify-between w-full gap-4 md:flex-row">
<div className="flex flex-row gap-4 md:w-full">
<div className="md:w-[8rem]">
<div className="w-[107px]">
<img src={image} alt="" />
</div>
</div>
<div className="w-full">
<NftStats nft={nft} />
{nft.isActive && (
<div className="mt-2">
<Button
borderColor="#463D81"
bgColor="#0F0D1B"
onClick={onOpenSync}
isDisabled={isFetching || isFetchingTx}
>
Sync
</Button>
</div>
)}
</div>
</div>
<div className="w-full">
<NftStats nft={nft} />
{nft.isActive && (
<div className="mt-2">
<Button
borderColor="#463D81"
bgColor="#0F0D1B"
onClick={onOpenSync}
isDisabled={isFetching || isFetchingTx}
>
Sync
</Button>
<div className="flex flex-row w-full gap-8 md:w-min">
<Performance nft={nft} />
<div className="block w-full md:w-[0px] md:hidden">
<Label>Deposit Ratio</Label>
<div className="mt-3">
<ProgressBar
percent={parseInt(
(nft.deposit / (nft.deposit + nft.withdrawn)) * 100
)}
/>
</div>
)}
</div>
</div>
<Performance nft={nft} />
</div>
<div className="hidden md:block md:w-full">
<Label>Deposit Ratio</Label>
Expand All @@ -192,12 +206,12 @@ export default function NFT({ tokenId }) {
/>
</div>
</div>
<div className="flex gap-4 mt-4 md:mt-0">
<div className="flex justify-between gap-4 mt-4 md:justify-start md:mt-0">
<div className="flex flex-col gap-2">
<div className="flex flex-col gap-2 ">
<Label>Minted DYAD</Label>
<div className="md:flex">
<div className="md:mr-2 mb-2 md:mb-0">
<div className="mb-2 md:mr-2 md:mb-0">
{round((nft.deposit + nft.withdrawn) / 10 ** 18, 2)}
</div>
<Button
Expand All @@ -223,7 +237,7 @@ export default function NFT({ tokenId }) {
<Label>Deposited DYAD</Label>
<div className="flex flex-col gap-2">
<div className="md:flex md:gap-2">
<div className="md:mr-2 mb-2 md:mb-0">
<div className="mb-2 md:mr-2 md:mb-0">
{Math.round((nft.deposit / 10 ** 18) * 100) / 100}
</div>
<div className="flex gap-2">
Expand All @@ -249,7 +263,7 @@ export default function NFT({ tokenId }) {
</div>
</div>
{isClaimable && nft.isActive && (
<div className="flex gap-2 animate-claimPulse">
<div className="flex animate-claimPulse">
<Button
onClick={onOpenClaim}
isDisabled={
Expand Down
2 changes: 1 addition & 1 deletion src/components/NFTs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function NFTs() {
return (
<>
{tokenIds.length > 0 ? (
<div>
<div className="w-full p-6 md:p-0 md:w-max">
<div className="mb-2">Your dNFTs</div>
<div className="flex flex-col gap-4">
{tokenIds.map((tokenId) => {
Expand Down

1 comment on commit 591037d

@vercel
Copy link

@vercel vercel bot commented on 591037d Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.