Skip to content

Commit

Permalink
refactor: move common components to components/common
Browse files Browse the repository at this point in the history
  • Loading branch information
yawn-c111 committed Dec 2, 2024
1 parent e9ca1d9 commit 41b7cdc
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion pkgs/frontend/app/components/UserIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FaCircleUser } from "react-icons/fa6";
import { CommonIcon } from "./CommonIcon";
import { CommonIcon } from "./common/CommonIcon";

interface UserIconProps {
userImageUrl: string | undefined;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/frontend/app/components/WorkspaceIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FaPeopleGroup } from "react-icons/fa6";
import { CommonIcon } from "./CommonIcon";
import { CommonIcon } from "./common/CommonIcon";

interface WorkspaceIconProps {
workspaceImageUrl?: string;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pkgs/frontend/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Box } from "@chakra-ui/react";
import type { MetaFunction } from "@remix-run/node";
import { CommonButton } from "~/components/CommonButton";
import { CommonButton } from "~/components/common/CommonButton";
import { useBigBang } from "hooks/useBigBang";

export const meta: MetaFunction = () => {
Expand Down
50 changes: 25 additions & 25 deletions pkgs/frontend/app/routes/login.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import { usePrivy, useWallets } from "@privy-io/react-auth";
import { FC, useCallback } from "react";
import CommonButton from "~/components/CommonButton";
import CommonButton from "~/components/common/CommonButton";

const Login: FC = () => {
const { connectOrCreateWallet, user, logout } = usePrivy();
const { wallets } = useWallets();
const { connectOrCreateWallet, user, logout } = usePrivy();
const { wallets } = useWallets();

const disconnectWallets = useCallback(async () => {
await Promise.all(wallets.map((wallet) => wallet.disconnect()));
}, [wallets]);
const disconnectWallets = useCallback(async () => {
await Promise.all(wallets.map((wallet) => wallet.disconnect()));
}, [wallets]);

return (
<>
<CommonButton onClick={connectOrCreateWallet} bgColor="red.300">
login
</CommonButton>
return (
<>
<CommonButton onClick={connectOrCreateWallet} bgColor="red.300">
login
</CommonButton>

{wallets.length > 0 && (
<CommonButton onClick={disconnectWallets} bgColor="red.300">
disconnect
</CommonButton>
)}
{user ? (
<CommonButton onClick={logout} bgColor="red.300">
logout
</CommonButton>
) : (
<></>
)}
</>
);
{wallets.length > 0 && (
<CommonButton onClick={disconnectWallets} bgColor="red.300">
disconnect
</CommonButton>
)}
{user ? (
<CommonButton onClick={logout} bgColor="red.300">
logout
</CommonButton>
) : (
<></>
)}
</>
);
};

export default Login;

0 comments on commit 41b7cdc

Please sign in to comment.