Skip to content

Commit

Permalink
fix(next): layout bullshit
Browse files Browse the repository at this point in the history
  • Loading branch information
JappyMondo committed Oct 19, 2024
1 parent ed33d01 commit 12e9865
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/app/error/animated-error-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default function AnimatedErrorContent({
animate={{ opacity: 1 }}
transition={{ delay: 0.6, duration: 0.5 }}
>
Don't worry, our team of highly caffeinated developers is on it!
Don't worry, our team of highly caffeinated developers is on it!
</motion.p>
{stackTrace && (
<motion.div
Expand Down
5 changes: 5 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from "react";

export default function RootLayout(props: React.PropsWithChildren) {
return props.children;
}
20 changes: 17 additions & 3 deletions src/components/nav-menu/nav-desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export function NavDesktop(props: NavProps) {
const linkClassName =
"text-sm font-medium text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-50 px-3 py-2 rounded-md";

const activeClassname =
"text-gray-900 dark:text-gray-50 bg-gray-100 dark:bg-gray-800/30";
const inActiveClassname =
"text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-50";

return (
<nav className="hidden lg:flex gap-4 sm:gap-6">
{props.isAuthenticated &&
Expand All @@ -20,15 +25,24 @@ export function NavDesktop(props: NavProps) {
href={tab.pathname}
className={cn(
linkClassName,
tab.isActive
? "text-gray-900 dark:text-gray-50 bg-gray-100 dark:bg-gray-800/30"
: "text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-50"
tab.isActive ? activeClassname : inActiveClassname
)}
prefetch={false}
>
{tab.label}
</Link>
))}

<Link
className={cn(
linkClassName,
props.isAuthenticated ? inActiveClassname : activeClassname
)}
href={props.isAuthenticated ? "/auth/logout" : "/auth/login"}
>
{props.isAuthenticated && "Log out"}
{!props.isAuthenticated && "Log in"}
</Link>
</nav>
);
}
44 changes: 29 additions & 15 deletions src/components/nav-menu/nav-mobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ import { useNavTabs } from "../../hooks/use-nav-tabs";
import { cn } from "@/lib/utils";
import { NavProps } from "./nav-props";
import { Button } from "../ui/button.extended";
import { LogInIcon } from "lucide-react";
import { LogInIcon, LogOutIcon } from "lucide-react";

export function NavMobile(props: NavProps) {
const { tabs } = useNavTabs();
const { tabs } = useNavTabs(props.isAuthenticated);

const linkClassName =
"flex-1 flex flex-col items-center gap-1 text-sm font-medium transition-colors bg-gray-100 dark:bg-gray-800 py-2";
const activeClassName =
"bg-gray-200 text-gray-900 dark:bg-gray-800 dark:text-gray-50";
const inActiveClassname =
"text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-50";

return (
<nav className="bg-white border-t dark:bg-gray-950 dark:border-gray-800 lg:hidden sticky bottom-0 z-10">
Expand All @@ -19,26 +26,33 @@ export function NavMobile(props: NavProps) {
key={tab.pathname}
href={tab.pathname}
className={cn(
"flex-1 flex flex-col items-center gap-1 text-sm font-medium transition-colors bg-gray-100 dark:bg-gray-800 py-2",
tab.isActive
? "bg-gray-200 text-gray-900 dark:bg-gray-800 dark:text-gray-50"
: "text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-50"
linkClassName,
tab.isActive ? activeClassName : inActiveClassname
)}
prefetch={false}
>
<tab.icon className="w-5 h-5" />
{tab.label}
</Link>
))}
{!props.isAuthenticated && (
<Link
className="flex-1 flex flex-col items-center gap-1 text-sm font-medium transition-colors bg-gray-200 text-gray-900 dark:bg-gray-800 dark:text-gray-50 py-2"
href="/auth/login"
>
<LogInIcon className="w-5 h-5" />
Log in
</Link>
)}
<Link
className={cn(
linkClassName,
props.isAuthenticated ? inActiveClassname : activeClassName
)}
href={props.isAuthenticated ? "/auth/logout" : "/auth/login"}
>
{props.isAuthenticated && (
<>
<LogOutIcon className="w-5 h-5" /> Log out
</>
)}
{!props.isAuthenticated && (
<>
<LogInIcon className="w-5 h-5" /> Log in
</>
)}
</Link>
</div>
</nav>
);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/file-upload.action.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use server";

import { getSupabaseServerClient } from "@/lib/supabase.server";
import { AuthSessionMissingError } from "@supabase/supabase-js";
import { nanoid } from "nanoid";

interface UploadImageProps {
Expand All @@ -24,7 +25,7 @@ export async function uploadFileAction({

if (!user) {
return {
error: "NOT_AUTHENTICATED",
error: new AuthSessionMissingError(),
};
}

Expand Down

0 comments on commit 12e9865

Please sign in to comment.