Skip to content

Commit

Permalink
Disconnected state (#100)
Browse files Browse the repository at this point in the history
* Disconnected state

* Don't show past votes if wallet isn't connected
  • Loading branch information
gpxl-dev authored Oct 5, 2023
1 parent 976812d commit 80db2bd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
12 changes: 10 additions & 2 deletions src/features/activate-migration/ActivatePointsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { motion } from "framer-motion";
import { useEffect } from "react";
import { twJoin, twMerge } from "tailwind-merge";
import { useAccount } from "wagmi";
import { Checkbox } from "../common/Checkbox";
import { CheckMark } from "../common/icons/CheckMark";
import { formatNumber } from "../common/utils/formatNumber";
Expand All @@ -14,6 +15,8 @@ export const ActivatePointsCard = ({}: {}) => {
treeId: ACTIVATE_TREE_ID,
});

const { isConnected: isWalletConnected } = useAccount();

const IS_ENABLED = import.meta.env.VITE_ENABLE_ACTIVATE_MIGRATION === "true";

const { data: activateMigrationClaim } = useActivatePointsClaim({
Expand Down Expand Up @@ -116,7 +119,12 @@ export const ActivatePointsCard = ({}: {}) => {
{/* Checkbox and title. */}
<div className="flex items-center">
{/* Checkbox */}
<div className="align-center -mt-1 mr-5 items-center ">
<div
className={twJoin(
"align-center -mt-1 mr-5 items-center",
!isWalletConnected && "hidden",
)}
>
<Checkbox disabled />
</div>
{/* Title */}
Expand All @@ -130,7 +138,7 @@ export const ActivatePointsCard = ({}: {}) => {
className={twJoin([
"rounded-full px-4 py-1 text-xs font-bold uppercase leading-6",
"flex flex-row items-center gap-2 ring-1 ring-gray-800",
"text-gray-500",
"text-gray-500 text-center",
])}
>
Coming soon
Expand Down
4 changes: 2 additions & 2 deletions src/features/chain-connection/WalletConnection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const WalletConnection = () => {
)}
<span
className={twJoin(
isConnected ? "font-medium" : "font-bold px-1",
"whitespace-nowrap normal-case",
isConnected ? "font-medium normal-case" : "font-bold px-1",
"whitespace-nowrap",
)}
>
{isConnected ? displayAddress : "Connect"}
Expand Down
11 changes: 9 additions & 2 deletions src/features/votes/PastEpochCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,22 @@ export const PastEpochCard = ({

const { isConnected: isWalletConnected } = useAccount();

if (!isWalletConnected) return null;

const proposalGroupTitle = getEpochName(proposalGroup[0]);

const trigger = (
<div className="flex w-full items-center justify-between pr-4 font-semibold">
{/* Checkbox and title. */}
<div className="flex items-center">
{/* Checkbox */}
<div className="align-center -mt-1 mr-5 items-center ">
<div
className={twJoin(
"align-center -mt-1 mr-5 items-center",
!isWalletConnected && "hidden",
)}
>
<Checkbox
className={twJoin(!isWalletConnected && "invisible")}
disabled={
!root || // disabled if there's no root
hasUserClaimed || // or if the user has already claimed
Expand Down Expand Up @@ -177,6 +183,7 @@ export const PastEpochCard = ({
"rounded-full px-4 py-1 text-xs font-bold uppercase leading-6",
"flex flex-row items-center gap-2 ring-1 ring-gray-800",
(hasUserClaimed || !votedOnAllProposals) && "text-gray-500",
!isWalletConnected && "hidden",
])}
>
{hasUserClaimed && (
Expand Down

0 comments on commit 80db2bd

Please sign in to comment.