Skip to content

Commit

Permalink
🚨 Fix build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
doitian committed Feb 23, 2024
1 parent e8d216b commit 0faed5a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
3 changes: 3 additions & 0 deletions src/AddressPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export default function AddressPage({ address, deleteAddress, navigate }) {
navigate("#/");
}}
/>
<Button outline color="light" as="a" href="#/">
Go Back
</Button>
</div>
</section>
);
Expand Down
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Spinner } from "flowbite-react";
import { Suspense, useCallback, useTransition } from "react";
import { Suspense, useTransition } from "react";
import { useHash } from "react-use";
import AddressPage from "./AddressPage.js";
import IndexPage from "./IndexPage.js";
Expand All @@ -24,7 +24,7 @@ function Router() {
const [isPending, startTransition] = useTransition();
const [state, { addAddress, deleteAddress }] = usePersistReducer();

const navigate = useCallback((url) => startTransition(() => setPage(url)));
const navigate = (url) => startTransition(() => setPage(url));

const fallbackRoute = () => <NotFound {...{ page, navigate }} />;
const staticRoutes = {
Expand Down
8 changes: 6 additions & 2 deletions src/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ export default function Layout({ children, isPending }) {
style={{
opacity: isPending ? 0.7 : 1,
}}
className="font-serif text-xl leading-8 mb-8"
className="font-serif text-xl leading-8 mb-8 align-middle"
>
<a href="#/">CKB Multisig CoBuild PoC</a>
<p>
<a className="align-top" href="#/">
CKB Multisig CoBuild PoC
</a>
</p>
</header>
<main className="box-border">{children}</main>
</div>
Expand Down
14 changes: 5 additions & 9 deletions src/NewAddressPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Alert, Button, Label, TextInput } from "flowbite-react";
import { useCallback, useEffect } from "react";
import { useEffect } from "react";
import { HiMinus, HiPlus } from "react-icons/hi";
import { useImmerReducer } from "use-immer";
import { MultisigConfig } from "./schemas.js";
Expand Down Expand Up @@ -72,17 +72,13 @@ export default function NewAddressPage({ addAddress, navigate, template }) {
},
},
);
const incrementSigner = useCallback(() =>
dispatch({ type: "incrementSigner" }),
);
const decrementSigner = useCallback(() =>
dispatch({ type: "decrementSigner" }),
);
const submit = useCallback((e) => {
const incrementSigner = () => dispatch({ type: "incrementSigner" });
const decrementSigner = () => dispatch({ type: "decrementSigner" });
const submit = (e) => {
e.preventDefault();
const formData = new FormData(e.target);
dispatch({ type: "submit", payload: formData });
});
};

useEffect(() => {
if (state.done) {
Expand Down
10 changes: 6 additions & 4 deletions src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ const usePersistReducer = () => {
// `localStorage` as params to `useReducer`.
// this will return `[state, dispatch]`
const [state, dispatch] = useImmerReducer(reducerLocalStorage, savedState);
const addAddress = useCallback((address) =>
dispatch({ type: "addAddress", payload: address }),
const addAddress = useCallback(
(address) => dispatch({ type: "addAddress", payload: address }),
[dispatch],
);
const deleteAddress = useCallback((args) =>
dispatch({ type: "deleteAddress", payload: args }),
const deleteAddress = useCallback(
(args) => dispatch({ type: "deleteAddress", payload: args }),
[dispatch],
);
return [state, { addAddress, deleteAddress }];
};
Expand Down

0 comments on commit 0faed5a

Please sign in to comment.