From 31b3a30178f3f2aad92cf12830e2fa2c11fa7c03 Mon Sep 17 00:00:00 2001 From: Grzegorz Pokorski Date: Mon, 27 Nov 2023 14:57:32 +0100 Subject: [PATCH 1/4] fix: user menu logout button --- src/ui/components/nav/components/UserMenu/UserMenu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/components/nav/components/UserMenu/UserMenu.tsx b/src/ui/components/nav/components/UserMenu/UserMenu.tsx index 13c630ddf..bedf29563 100644 --- a/src/ui/components/nav/components/UserMenu/UserMenu.tsx +++ b/src/ui/components/nav/components/UserMenu/UserMenu.tsx @@ -49,12 +49,12 @@ export function UserMenu({ user }: Props) {
{({ active }) => ( -
+ + + -
); } diff --git a/src/ui/components/LoginForm/components/LoginButton.tsx b/src/ui/components/LoginForm/components/LoginButton.tsx new file mode 100644 index 000000000..4538e3ad1 --- /dev/null +++ b/src/ui/components/LoginForm/components/LoginButton.tsx @@ -0,0 +1,16 @@ +"use client"; + +import { useFormStatus } from "react-dom"; + +export const LoginButton = () => { + const { pending } = useFormStatus(); + return ( + + ); +}; From feeb9be38e0f2f7dc9cd2c57ca19991033374143 Mon Sep 17 00:00:00 2001 From: Grzegorz Pokorski Date: Mon, 27 Nov 2023 18:51:40 +0100 Subject: [PATCH 3/4] fix: remove unnecessary 'use server' directive --- src/app/actions.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/actions.ts b/src/app/actions.ts index 9e2c37f12..2df9254cf 100644 --- a/src/app/actions.ts +++ b/src/app/actions.ts @@ -3,6 +3,5 @@ import { saleorAuthClient } from "@/app/config"; export async function logout() { - "use server"; saleorAuthClient.signOut(); } From e74b5963ef2af0178f16db645f47ffac385873a6 Mon Sep 17 00:00:00 2001 From: Grzegorz Pokorski Date: Tue, 28 Nov 2023 19:05:45 +0100 Subject: [PATCH 4/4] refactor: refactor components structure in the project --- src/app/[channel]/(main)/login/page.tsx | 4 ++-- src/app/[channel]/(main)/orders/page.tsx | 2 +- .../LoginForm/components => atoms}/LoginButton.tsx | 2 +- src/ui/components/{LoginForm => }/LoginForm.tsx | 2 +- tsconfig.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename src/ui/{components/LoginForm/components => atoms}/LoginButton.tsx (67%) rename src/ui/components/{LoginForm => }/LoginForm.tsx (95%) diff --git a/src/app/[channel]/(main)/login/page.tsx b/src/app/[channel]/(main)/login/page.tsx index 10d4ed83f..f7bddd8f4 100644 --- a/src/app/[channel]/(main)/login/page.tsx +++ b/src/app/[channel]/(main)/login/page.tsx @@ -1,6 +1,6 @@ import { Suspense } from "react"; -import { Loader } from "@/ui/atoms/Loader"; -import { LoginForm } from "@/ui/components/LoginForm/LoginForm"; +import { LoginForm } from "@ui/components/LoginForm"; +import { Loader } from "@ui/atoms/Loader"; export default function LoginPage() { return ( diff --git a/src/app/[channel]/(main)/orders/page.tsx b/src/app/[channel]/(main)/orders/page.tsx index 8d73acdaf..09e21b47a 100644 --- a/src/app/[channel]/(main)/orders/page.tsx +++ b/src/app/[channel]/(main)/orders/page.tsx @@ -1,6 +1,6 @@ +import { LoginForm } from "@ui/components/LoginForm"; import { CurrentUserOrderListDocument } from "@/gql/graphql"; import { executeGraphQL } from "@/lib/graphql"; -import { LoginForm } from "@/ui/components/LoginForm/LoginForm"; import { OrderListItem } from "@/ui/components/OrderListItem"; export default async function OrderPage() { diff --git a/src/ui/components/LoginForm/components/LoginButton.tsx b/src/ui/atoms/LoginButton.tsx similarity index 67% rename from src/ui/components/LoginForm/components/LoginButton.tsx rename to src/ui/atoms/LoginButton.tsx index 4538e3ad1..2bffb37e5 100644 --- a/src/ui/components/LoginForm/components/LoginButton.tsx +++ b/src/ui/atoms/LoginButton.tsx @@ -6,7 +6,7 @@ export const LoginButton = () => { const { pending } = useFormStatus(); return (