Skip to content

Commit

Permalink
fix console warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sstraatemans committed Nov 7, 2024
1 parent 823b256 commit 12fc3de
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export function ContactForm({
onDone: (contect: IContact) => void;
isOpen: boolean;
}) {
console.log({ input });

const prompt = usePrompt();
const { activeNetwork } = useWallet();
const [error, setError] = useState<string | null>(null);
Expand All @@ -56,8 +54,6 @@ export function ContactForm({
});

useEffect(() => {
console.log({ input });

if (!input) {
reset(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ import {
TextField,
} from '@kadena/kode-ui';
import { PactNumber } from '@kadena/pactjs';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import {
Fragment,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from 'react';
import { Controller, useForm } from 'react-hook-form';
import { DiscoverdAccounts } from '../../transfer/components/DiscoverdAccounts';
import { linkClass } from '../../transfer/style.css';
Expand Down Expand Up @@ -316,6 +323,7 @@ export function TransferForm({
render={({ field }) => (
<Select
// label="Token"
aria-label="Asset"
placeholder="Asset"
startVisual={<Label>Asset:</Label>}
size="sm"
Expand All @@ -335,6 +343,7 @@ export function TransferForm({
render={({ field }) => (
<Stack flex={1} flexDirection={'column'}>
<Select
aria-label="Address"
startVisual={<Label>Address:</Label>}
// label="Account"
placeholder="Select and address"
Expand Down Expand Up @@ -363,6 +372,7 @@ export function TransferForm({
control={control}
render={({ field }) => (
<Select
aria-label="Chain"
startVisual={<Label>Chain:</Label>}
// label="Chain"
size="sm"
Expand Down Expand Up @@ -437,7 +447,7 @@ export function TransferForm({
return ch !== senderChain;
});
return (
<>
<Fragment key={index}>
<Stack
gap="sm"
flexDirection={'column'}
Expand Down Expand Up @@ -515,6 +525,7 @@ export function TransferForm({
<Stack flexDirection={'column'}>
<Combobox
// label={index === 0 ? 'Account' : undefined}
aria-label="Receiver Address"
inputValue={field.value ?? ''}
placeholder="Select ot enter an address"
startVisual={<Label>Address:</Label>}
Expand Down Expand Up @@ -652,6 +663,7 @@ export function TransferForm({
}}
render={({ field }) => (
<TextField
aria-label="Amount"
onChange={(e) => {
const value = e.target.value;
field.onChange(value);
Expand All @@ -673,6 +685,7 @@ export function TransferForm({
control={control}
render={({ field }) => (
<Select
aria-label="Chain"
startVisual={<Label>Chain:</Label>}
// label={index === 0 ? 'Chain' : undefined}
placeholder="Select a chain"
Expand Down Expand Up @@ -830,7 +843,7 @@ export function TransferForm({
</button>
</Stack>
)}
</>
</Fragment>
);
})}
</>
Expand All @@ -854,6 +867,7 @@ export function TransferForm({
control={control}
render={({ field }) => (
<Select
aria-label="Gas Payer"
startVisual={<Label>Gas Payer:</Label>}
placeholder="Select the gas payer"
size="sm"
Expand Down Expand Up @@ -885,6 +899,7 @@ export function TransferForm({
control={control}
render={({ field }) => (
<TextField
aria-label="Gas Price"
startVisual={<Label>Gas Price:</Label>}
placeholder="Enter gas price"
value={field.value}
Expand All @@ -905,6 +920,7 @@ export function TransferForm({
control={control}
render={({ field }) => (
<TextField
aria-label="Enter gas limit"
placeholder="Enter gas limit"
startVisual={<Label>Gas Limit:</Label>}
value={field.value}
Expand All @@ -927,6 +943,7 @@ export function TransferForm({
control={control}
render={({ field }) => (
<TextField
aria-label="TTL"
startVisual={<Label>TTL:</Label>}
placeholder="Enter TTL (Timer to live)"
value={field.value}
Expand Down Expand Up @@ -957,6 +974,7 @@ export function TransferForm({
control={control}
render={({ field }) => (
<RadioGroup
aria-label="Sign Options"
direction={'column'}
defaultValue={'normalTransfer'}
value={field.value}
Expand Down
3 changes: 3 additions & 0 deletions packages/apps/dev-wallet/src/pages/transfer/transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ export function Transfer() {
render={({ field }) => (
<Select
label="From"
aria-label="From"
size="sm"
selectedKey={field.value}
onSelectionChange={(accountId) => {
Expand Down Expand Up @@ -440,6 +441,7 @@ export function Transfer() {
<Stack alignItems={'flex-end'} gap={'sm'}>
<TextField
type="number"
aria-label="Amount"
placeholder="Enter amount"
{...register('amount')}
/>
Expand All @@ -453,6 +455,7 @@ export function Transfer() {
name="transferAll"
render={({ field }) => (
<Checkbox
aria-label="Max Amount"
isSelected={field.value}
onChange={field.onChange}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ export const SideBarLayout: FC<ISideBarLayout> = ({
variant = 'default',
location,
}) => {
const { isExpanded, setLocation } = useLayout();
const {
isExpanded,
setLocation,
isRightAsideExpanded,
setIsRightAsideExpanded,
} = useLayout();

// set the active URL in your app.
//we dont know what route system is being used so the active URL will be given as a prop to the component
Expand All @@ -41,6 +46,11 @@ export const SideBarLayout: FC<ISideBarLayout> = ({
setLocation(location);
}, [location?.url, location?.hash]);

useEffect(() => {
if (!isRightAsideExpanded) return;
setIsRightAsideExpanded(false);
}, [location?.url]);

return (
<MediaContextProvider>
<Stack
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FC, PropsWithChildren } from 'react';
import React, { useEffect } from 'react';
import React from 'react';
import { createPortal } from 'react-dom';
import { useLayout } from '../LayoutProvider';
import { rightAsideClass } from './style.css';
Expand All @@ -9,17 +9,7 @@ export interface iRightAside extends PropsWithChildren {
}

export const RightAside: FC<iRightAside> = ({ children, isOpen }) => {
const {
rightAsideRef,
location,
setIsRightAsideExpanded,
isRightAsideExpanded,
} = useLayout();

useEffect(() => {
if (!isRightAsideExpanded) return;
setIsRightAsideExpanded(false);
}, [location?.url]);
const { rightAsideRef } = useLayout();

if (!isOpen || !rightAsideRef) return null;

Expand Down

0 comments on commit 12fc3de

Please sign in to comment.