Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sstraatemans committed Dec 6, 2024
2 parents a607b4d + 7360b1c commit 4b26463
Show file tree
Hide file tree
Showing 198 changed files with 5,609 additions and 1,857 deletions.
6 changes: 6 additions & 0 deletions .changeset/hungry-steaks-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@kadena/chainweb-node-client': minor
'@kadena/client': minor
---

Support for passing a request init object to client functions
5 changes: 5 additions & 0 deletions .changeset/nervous-turtles-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kadena/kode-ui': minor
---

add an extra styling variant to the table component
2 changes: 2 additions & 0 deletions .changeset/perfect-rings-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
5 changes: 5 additions & 0 deletions .changeset/polite-bats-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kadena/client': patch
---

Add a default value `null` for the proof
2 changes: 2 additions & 0 deletions .changeset/slow-apples-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 2 additions & 0 deletions .changeset/twenty-cherries-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
5 changes: 3 additions & 2 deletions packages/apps/dev-wallet/src/App/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
} from '@kadena/kode-ui/patterns';
import classNames from 'classnames';
import { FC, useMemo } from 'react';
import { Link, Outlet, useLocation, useNavigate } from 'react-router-dom';
import { Link, Outlet, useLocation } from 'react-router-dom';
import { usePatchedNavigate } from '../../utils/usePatchedNavigate';
import { SideBar } from './SideBar';
import {
isExpandedMainClass,
Expand All @@ -26,7 +27,7 @@ import {
export const Layout: FC = () => {
const { theme, setTheme } = useTheme();
const location = useLocation();
const navigate = useNavigate();
const navigate = usePatchedNavigate();
const { isExpanded } = useLayout();

const innerLocation = useMemo(
Expand Down
23 changes: 12 additions & 11 deletions packages/apps/dev-wallet/src/App/Layout/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
MonoApps,
MonoCheck,
MonoContacts,
MonoContrast,
Expand All @@ -12,6 +11,7 @@ import {
MonoSignature,
MonoSwapHoriz,
MonoTableRows,
MonoWallet,
MonoWarning,
} from '@kadena/kode-icons/system';

Expand Down Expand Up @@ -39,15 +39,16 @@ import {
useLayout,
} from '@kadena/kode-ui/patterns';
import { FC } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { Link } from 'react-router-dom';
import { usePatchedNavigate } from '../../utils/usePatchedNavigate';
import { BetaHeader } from '../BetaHeader';
import { KLogo } from './KLogo';

export const SideBar: FC = () => {
const { theme, setTheme } = useTheme();
const { isExpanded } = useLayout();
const { lockProfile, profileList, unlockProfile, profile } = useWallet();
const navigate = useNavigate();
const navigate = usePatchedNavigate();

const toggleTheme = (): void => {
const newTheme = theme === Themes.dark ? Themes.light : Themes.dark;
Expand Down Expand Up @@ -75,8 +76,8 @@ export const SideBar: FC = () => {
navigation={
<>
<SideBarItem
visual={<MonoApps />}
label="Dashboard"
visual={<MonoWallet />}
label="Your Assets"
component={Link}
href="/"
/>
Expand All @@ -89,17 +90,17 @@ export const SideBar: FC = () => {
/>

<SideBarItem
visual={<MonoSignature />}
label="Sig Builder"
visual={<MonoTableRows />}
label="Transactions"
component={Link}
href="/sig-builder"
href="/transactions"
/>

<SideBarItem
visual={<MonoTableRows />}
label="Transactions"
visual={<MonoSignature />}
label="Sig Builder"
component={Link}
href="/transactions"
href="/sig-builder"
/>

<SideBarItem
Expand Down
30 changes: 30 additions & 0 deletions packages/apps/dev-wallet/src/App/Layout/useRightAside.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useLayout } from '@kadena/kode-ui/patterns';
import { useEffect, useState } from 'react';

export function useRightAside() {
const [expanded, setExpanded] = useState(false);
const { isRightAsideExpanded, setIsRightAsideExpanded } = useLayout();

useEffect(() => {
if (!isRightAsideExpanded && expanded) {
setExpanded(false);
}
}, [isRightAsideExpanded, expanded]);

return [
expanded,
() => {
if (isRightAsideExpanded && !expanded) {
throw new Error('Right aside is already open with a different panel');
}
setIsRightAsideExpanded(true);
setExpanded(true);
},
() => {
if (expanded) {
setIsRightAsideExpanded(false);
setExpanded(false);
}
},
] as [isExpanded: boolean, expand: () => void, close: () => void];
}
8 changes: 4 additions & 4 deletions packages/apps/dev-wallet/src/App/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { FC, PropsWithChildren, useEffect, useState } from 'react';
import {
createBrowserRouter,
createMemoryRouter,
createRoutesFromElements,
Navigate,
Outlet,
Route,
RouterProvider,
createBrowserRouter,
createMemoryRouter,
createRoutesFromElements,
useLocation,
} from 'react-router-dom';

Expand Down Expand Up @@ -39,8 +39,8 @@ import { HomePage } from '../pages/home/home-page';
import { SelectProfile } from '../pages/select-profile/select-profile';
import { UnlockProfile } from '../pages/unlock-profile/unlock-profile';
import { getScriptType } from '../utils/window';
import { Layout } from './Layout/Layout';
import { LayoutMini } from './layout-mini';
import { Layout } from './Layout/Layout';

const Redirect: FC<
PropsWithChildren<{
Expand Down
3 changes: 3 additions & 0 deletions packages/apps/dev-wallet/src/App/session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ export const SessionProvider: FC<PropsWithChildren> = ({ children }) => {
const [loaded, setLoaded] = useState(false);
useLayoutEffect(() => {
const events = ['visibilitychange', 'touchstart', 'keydown', 'click'];
let removeListener = () => {};
const run = async () => {
await Session.load();
removeListener = Session.ListenToExternalChanges();
// console.log('Session is loaded', Session.get('profileId'));
events.forEach((event) => {
document.addEventListener(event, Session.renew);
Expand All @@ -39,6 +41,7 @@ export const SessionProvider: FC<PropsWithChildren> = ({ children }) => {
events.forEach((event) => {
document.removeEventListener(event, Session.renew);
});
removeListener();
};
}, []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export const AccountBalanceDistribution: FC<IProps> = ({
network: activeNetwork!,
redistribution,
mapKeys,
creationTime: Math.round(Date.now() / 1000),
});

onRedistribution(groupId);
Expand Down
Loading

0 comments on commit 4b26463

Please sign in to comment.