diff --git a/apps/dashboard/src/actions/create-folder-action.ts b/apps/dashboard/src/actions/create-folder-action.ts index 961782416c..7193be32f9 100644 --- a/apps/dashboard/src/actions/create-folder-action.ts +++ b/apps/dashboard/src/actions/create-folder-action.ts @@ -11,14 +11,12 @@ export const createFolderAction = action(createFolderSchema, async (value) => { const supabase = createClient(); const user = await getUser(); - const { error } = await createFolder(supabase, { + await createFolder(supabase, { bucket: "vault", path: `${user.data.team_id}/${value.path}`, name: value.name, }); - console.log(error); - await revalidateTag(`vault_${user.data.team_id}`); return error; diff --git a/apps/dashboard/src/app/[locale]/@login/page.tsx b/apps/dashboard/src/app/[locale]/@login/page.tsx index b8b0fe4977..cf6e0482e2 100644 --- a/apps/dashboard/src/app/[locale]/@login/page.tsx +++ b/apps/dashboard/src/app/[locale]/@login/page.tsx @@ -2,6 +2,7 @@ import { AppleSignIn } from "@/components/apple-sign-in"; import { FigmaSignIn } from "@/components/figma-sign-in"; import { GithubSignIn } from "@/components/github-sign-in"; import { GoogleSignIn } from "@/components/google-sign-in"; +import { NotionSignIn } from "@/components/notion-sign-in"; import { SlackSignIn } from "@/components/slack-sign-in"; import { Cookies } from "@/utils/constants"; import { @@ -34,6 +35,7 @@ export default async function Login() { + ); break; @@ -46,6 +48,7 @@ export default async function Login() { + ); break; @@ -58,6 +61,7 @@ export default async function Login() { + ); break; @@ -70,6 +74,7 @@ export default async function Login() { + ); break; @@ -82,6 +87,20 @@ export default async function Login() { + + + ); + break; + + case "notion": + prefferedSignInOption = ; + moreSignInOptions = ( + <> + + + + + ); break; @@ -94,6 +113,7 @@ export default async function Login() { + ); } else { @@ -103,6 +123,7 @@ export default async function Login() { + ); } diff --git a/apps/dashboard/src/components/notion-sign-in.tsx b/apps/dashboard/src/components/notion-sign-in.tsx new file mode 100644 index 0000000000..bb3c1668f1 --- /dev/null +++ b/apps/dashboard/src/components/notion-sign-in.tsx @@ -0,0 +1,39 @@ +"use client"; + +import { createClient } from "@midday/supabase/client"; +import { Button } from "@midday/ui/button"; +import { Icons } from "@midday/ui/icons"; +import { useSearchParams } from "next/navigation"; + +export function NotionSignIn() { + const supabase = createClient(); + const searchParams = useSearchParams(); + const returnTo = searchParams.get("return_to"); + + const handleSignIn = async () => { + const redirectTo = new URL("/api/auth/callback", location.origin); + + if (returnTo) { + redirectTo.searchParams.append("return_to", returnTo); + } + + redirectTo.searchParams.append("provider", "notion"); + + await supabase.auth.signInWithOAuth({ + provider: "notion", + options: { + redirectTo: redirectTo.toString(), + }, + }); + }; + + return ( + + ); +} diff --git a/packages/ui/src/components/icons.tsx b/packages/ui/src/components/icons.tsx index 8552f734c9..1f7072c557 100644 --- a/packages/ui/src/components/icons.tsx +++ b/packages/ui/src/components/icons.tsx @@ -306,6 +306,7 @@ export const Icons = { viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg" + {...props} > ), + Notion: (props: any) => ( + + + + ), Github: (props: any) => (