Skip to content

Commit

Permalink
fix(tangle-dapp): Enable button only when there's an account
Browse files Browse the repository at this point in the history
  • Loading branch information
yurixander committed Oct 31, 2024
1 parent e739db7 commit ca6fcb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions apps/tangle-dapp/app/liquid-staking/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import LsMyProtocolsTable from '../../containers/LsMyProtocolsTable';
import { LsProtocolsTable } from '../../containers/LsPoolsTable';
import useNetworkStore from '../../context/useNetworkStore';
import { useLsStore } from '../../data/liquidStaking/useLsStore';
import useIsAccountConnected from '../../hooks/useIsAccountConnected';
import useNetworkSwitcher from '../../hooks/useNetworkSwitcher';
import useSearchParamState from '../../hooks/useSearchParamState';
import getLsTangleNetwork from '../../utils/liquidStaking/getLsTangleNetwork';
Expand Down Expand Up @@ -61,6 +62,7 @@ const LiquidStakingPage: FC = () => {
isStaking: isStakingInStore,
} = useLsStore();

const isAccountConnected = useIsAccountConnected();
const { network } = useNetworkStore();
const { switchNetwork } = useNetworkSwitcher();
const [isCreatePoolModalOpen, setIsCreatePoolModalOpen] = useState(false);
Expand Down Expand Up @@ -205,6 +207,7 @@ const LiquidStakingPage: FC = () => {
onClick={() => setIsCreatePoolModalOpen(true)}
variant="utility"
size="sm"
isDisabled={!isAccountConnected}
rightIcon={
<AddLineIcon className="fill-current dark:fill-current" />
}
Expand Down
3 changes: 1 addition & 2 deletions apps/tangle-dapp/containers/LsMyProtocolsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ const LsMyProtocolsTable: FC = () => {
const substrateAddress = useSubstrateAddress();
const [sorting, setSorting] = useState<SortingState>([]);
const { lsNetworkId } = useLsStore();
const lsPools = useLsPools();

const lsNetwork = getLsNetwork(lsNetworkId);

Expand All @@ -170,8 +171,6 @@ const LsMyProtocolsTable: FC = () => {
[],
);

const lsPools = useLsPools();

const myPools: LsMyPoolRow[] = useMemo(() => {
if (substrateAddress === null || !(lsPools instanceof Map)) {
return [];
Expand Down

0 comments on commit ca6fcb7

Please sign in to comment.