Skip to content

Commit

Permalink
Theme
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Dec 2, 2023
1 parent 1fe7709 commit 12e152b
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 16 deletions.
3 changes: 2 additions & 1 deletion apps/dashboard/src/app/api/auth/callback/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export async function GET(req: NextRequest) {
const cookieStore = cookies();
const requestUrl = new URL(req.url);
const code = requestUrl.searchParams.get("code");
const returnTo = requestUrl.searchParams.get("return_to");
const provider = requestUrl.searchParams.get("provider");

if (provider) {
Expand All @@ -22,5 +23,5 @@ export async function GET(req: NextRequest) {
await supabase.auth.exchangeCodeForSession(code);
}

return NextResponse.redirect(requestUrl.origin);
return NextResponse.redirect(`${requestUrl.origin}/${returnTo}`);
}
5 changes: 4 additions & 1 deletion apps/dashboard/src/components/google-sign-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
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 GoogleSignIn() {
const supabase = createClient();
const searchParams = useSearchParams();
const returnTo = searchParams.get("return_to");

const handleSignIn = async () => {
await supabase.auth.signInWithOAuth({
provider: "google",
options: {
redirectTo: `${location.origin}/api/auth/callback?provider=google`,
redirectTo: `${location.origin}/api/auth/callback?return_to=${returnTo}&provider=google`,
},
});
};
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/src/components/sign-out.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function SignOut() {
const handleSignOut = async () => {
setLoading(true);
signOutAction();
router.refresh();
router.replace("/");
};

return (
Expand Down
9 changes: 8 additions & 1 deletion apps/dashboard/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ export async function middleware(request: NextRequest) {
const { data } = await supabase.auth.getSession();

if (!data.session && request.nextUrl.pathname !== "/") {
return NextResponse.redirect(new URL("/", request.url));
const url = new URL("/", request.url);
const encodedSearchParams = encodeURIComponent(
`${request.nextUrl.pathname.substring(1)}${request.nextUrl.search}`
);

url.searchParams.append("return_to", encodedSearchParams);

return NextResponse.redirect(url);
}

if (
Expand Down
Binary file modified apps/website/public/overview-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 24 additions & 12 deletions apps/website/src/components/startpage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,40 +105,52 @@ export function StartPage() {
<div className="md:h-[730px] dark:md:h-[830px] flex">
<div className="grid md:grid-cols-6 grid-cols-3 gap-[32px] m-auto mt-12">
<div className="w-[100px] text-center leading-tight">
<div className="w-[100px] h-[65px] border border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<div className="w-[100px] h-[65px] border border-[#DCDAD2] dark:border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<Icons.OpenSource />
</div>
<span className="text-[#606060] text-sm">{t("open")}</span>
<span className="text-[#878787] dark:text-[#606060] text-sm">
{t("open")}
</span>
</div>
<div className="w-[100px] text-center leading-tight">
<div className="w-[100px] h-[65px] border border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<div className="w-[100px] h-[65px] border border-[#DCDAD2] dark:border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<Icons.ChartGantt />
</div>
<span className="text-[#606060] text-sm">{t("live")}</span>
<span className="text-[#878787] dark:text-[#606060] text-sm">
{t("live")}
</span>
</div>
<div className="w-[100px] text-center leading-tight">
<div className="w-[100px] h-[65px] border border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<div className="w-[100px] h-[65px] border border-[#DCDAD2] dark:border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<Icons.FileDocument />
</div>
<span className="text-[#606060] text-sm">{t("document")}</span>
<span className="text-[#878787] dark:text-[#606060] text-sm">
{t("document")}
</span>
</div>
<div className="w-[100px] text-center leading-tight">
<div className="w-[100px] h-[65px] border border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<div className="w-[100px] h-[65px] border border-[#DCDAD2] dark:border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<Icons.ReceiptText />
</div>
<span className="text-[#606060] text-sm">{t("reciept")}</span>
<span className="text-[#878787] dark:text-[#606060] text-sm">
{t("reciept")}
</span>
</div>
<div className="w-[100px] text-center leading-tight">
<div className="w-[100px] h-[65px] border border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<div className="w-[100px] h-[65px] border border-[#DCDAD2] dark:border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<Icons.TimeCog />
</div>
<span className="text-[#606060] text-sm">{t("time")}</span>
<span className="text-[#878787] dark:text-[#606060] text-sm">
{t("time")}
</span>
</div>
<div className="w-[100px] text-center leading-tight">
<div className="w-[100px] h-[65px] border border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<div className="w-[100px] h-[65px] border border-[#DCDAD2] dark:border-[#2C2C2C] rounded-lg mb-2 flex items-center justify-center">
<Icons.CreationOutline />
</div>
<span className="text-[#606060] text-sm">{t("ai")}</span>
<span className="text-[#878787] dark:text-[#606060] text-sm">
{t("ai")}
</span>
</div>
</div>

Expand Down

0 comments on commit 12e152b

Please sign in to comment.