diff --git a/app/globals.css b/app/globals.css index d71b8c9..f4040d4 100644 --- a/app/globals.css +++ b/app/globals.css @@ -123,4 +123,4 @@ body { @apply bg-background text-foreground; } -} \ No newline at end of file +} diff --git a/bun.lock b/bun.lock index 01fb79e..74d0f3c 100644 --- a/bun.lock +++ b/bun.lock @@ -6,6 +6,7 @@ "name": "frontend", "dependencies": { "@base-ui/react": "^1.0.0", + "@iconify/react": "^6.0.2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^0.562.0", @@ -147,6 +148,10 @@ "@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.3", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="], + "@iconify/react": ["@iconify/react@6.0.2", "", { "dependencies": { "@iconify/types": "^2.0.0" }, "peerDependencies": { "react": ">=16" } }, "sha512-SMmC2sactfpJD427WJEDN6PMyznTFMhByK9yLW0gOTtnjzzbsi/Ke/XqsumsavFPwNiXs8jSiYeZTmLCLwO+Fg=="], + + "@iconify/types": ["@iconify/types@2.0.0", "", {}, "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg=="], + "@img/colour": ["@img/colour@1.0.0", "", {}, "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw=="], "@img/sharp-darwin-arm64": ["@img/sharp-darwin-arm64@0.34.5", "", { "optionalDependencies": { "@img/sharp-libvips-darwin-arm64": "1.2.4" }, "os": "darwin", "cpu": "arm64" }, "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w=="], diff --git a/package.json b/package.json index d7328b9..11eab16 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@base-ui/react": "^1.0.0", + "@iconify/react": "^6.0.2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "lucide-react": "^0.562.0", diff --git a/shared/helper/backendFetch.ts b/shared/helper/backendFetch.ts index 6de7066..06d48c6 100644 --- a/shared/helper/backendFetch.ts +++ b/shared/helper/backendFetch.ts @@ -1,4 +1,4 @@ -interface BackendResponse { +export interface BackendResponse { success: boolean; message: string; data?: T; diff --git a/shared/libs/shadcn/ui/button.tsx b/shared/libs/shadcn/ui/button.tsx index 6c0c773..6d1298b 100644 --- a/shared/libs/shadcn/ui/button.tsx +++ b/shared/libs/shadcn/ui/button.tsx @@ -33,6 +33,9 @@ const buttonVariants = cva( "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg", "icon-lg": "size-9", }, + isDisabled: { + true: "bg-neutral-800 text-neutral-400 cursor-not-allowed text-xs", + }, }, defaultVariants: { variant: "default", @@ -46,10 +49,12 @@ function Button({ variant = "default", size = "default", asChild = false, + isDisabled = false, ...props }: React.ComponentProps<"button"> & VariantProps & { asChild?: boolean; + isDisabled?: boolean; }) { const Comp = asChild ? Slot.Root : "button"; @@ -58,7 +63,7 @@ function Button({ data-slot="button" data-variant={variant} data-size={size} - className={cn(buttonVariants({ variant, size, className }))} + className={cn(buttonVariants({ variant, size, isDisabled, className }))} {...props} /> ); diff --git a/shared/widgets/signin/actions/getAllThirdPartyAuth.ts b/shared/widgets/signin/actions/getAllThirdPartyAuth.ts new file mode 100644 index 0000000..065f3ea --- /dev/null +++ b/shared/widgets/signin/actions/getAllThirdPartyAuth.ts @@ -0,0 +1,14 @@ +"use server"; +import { backendFetch, BackendResponse } from "@/shared/helper/backendFetch"; + +export type GetALlThirdPartyAuthCallback = BackendResponse< + { + name: string; + icon: string; + req_endpoint: string; + }[] +>; + +export const getAllThirdPartyAuth = async () => { + return (await backendFetch("auth/providers")) as GetALlThirdPartyAuthCallback; +}; diff --git a/shared/widgets/signin/components/SignInCard.tsx b/shared/widgets/signin/components/SignInCard.tsx index 623ddf5..aed6644 100644 --- a/shared/widgets/signin/components/SignInCard.tsx +++ b/shared/widgets/signin/components/SignInCard.tsx @@ -10,8 +10,25 @@ import { import { Input } from "@/shared/libs/shadcn/ui/input"; import { Label } from "@/shared/libs/shadcn/ui/label"; import { Separator } from "@/shared/libs/shadcn/ui/separator"; +import { useEffect, useState } from "react"; +import { + getAllThirdPartyAuth, + GetALlThirdPartyAuthCallback, +} from "../actions/getAllThirdPartyAuth"; +import { Icon } from "@iconify/react"; const SignInCard = () => { + const [oAuthProviders, setOAuthProviders] = + useState(null); + + useEffect(() => { + (async () => { + const res = await getAllThirdPartyAuth(); + console.log(res); + setOAuthProviders(res); + })(); + }, []); + return ( @@ -26,6 +43,31 @@ const SignInCard = () => { +
+ +

or continue with

+ +
+
+ {oAuthProviders ? ( +
+ {oAuthProviders.data?.map((provider, index) => ( + + ))} +
+ ) : ( + + )} +