Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions components/dashboard-components/AppSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ import WorkingSpaceSettings from "./WorkingSpaceSettings";
import { Avatar, AvatarFallback, AvatarImage } from "@radix-ui/react-avatar";
import { useAuthActions } from "@convex-dev/auth/react";
import { Button } from "@/components/ui/button";
import { useState, useEffect } from "react";
import { useState } from "react";
import Link from "next/link";
import SearchDialog from "./SearchDialog";
import LoadingAnimation from "../ui/LoadingAnimation";

export default function AppSidebar() {
const createWorkingSpace = useMutation(
api.mutations.workingSpaces.createWorkingSpace,
Expand All @@ -52,18 +51,6 @@ export default function AppSidebar() {
const [hoveredWorkingSpaceId, setHoveredWorkingSpaceId] = useState<
string | null
>(null);
const [isMobile, setIsMobile] = useState(false);

useEffect(() => {
const handleResize = () => {
setIsMobile(window.innerWidth < 768); // Adjust the width as needed
};

window.addEventListener("resize", handleResize);
handleResize(); // Call on mount to set initial state

return () => window.removeEventListener("resize", handleResize);
}, []);

const handleCreateWorkingSpace = () => {
createWorkingSpace({ name: "Untitled" });
Expand All @@ -85,9 +72,6 @@ export default function AppSidebar() {
}
};

// Conditionally render the sidebar based on screen size
if (isMobile) return null; // Remove from DOM on mobile view

return (
<Sidebar className=" border-brand_tertiary/20">
<SidebarContent className="bg-brand_fourthary text-brand_tertiary/90 transition-all duration-200 ease-in-out scrollbar-thin scrollbar-thumb-brand_fourthary scrollbar-track-brand_fourthary hover:scrollbar-thumb-brand_tertiary/20">
Expand Down
46 changes: 29 additions & 17 deletions components/dashboard-components/FloatingNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
} from "lucide-react";
import Link from "next/link";
import SearchDialog from "./SearchDialog";
import LoadingAnimation from "../ui/LoadingAnimation";
export default function FloatingNavbar() {
const User = useQuery(api.users.viewer);
const router = useRouter();
Expand Down Expand Up @@ -69,11 +70,11 @@ export default function FloatingNavbar() {
};

return (
<div className="fixed w-full bottom-0 right-0 h-14 bg-brand_fourthary/70 backdrop-blur border border-solid border-brand_tertiary/5 rounded-t-2xl block sm:hidden ">
<div className="fixed w-full bottom-0 right-0 h-16 bg-brand_fourthary/70 backdrop-blur border border-solid border-brand_tertiary/5 block sm:hidden ">
<div className=" w-full h-full flex justify-center items-center gap-5">
<Button
variant="Trigger"
className=" justify-center text-brand_tertiary/50 hover:text-brand_tertiary"
className="justify-center text-brand_tertiary/50 hover:text-brand_tertiary"
>
<Link href="/dashboard">
<Home size="24" />
Expand All @@ -82,7 +83,7 @@ export default function FloatingNavbar() {
<SearchDialog Variant="Trigger" WithTheTitle={false} IconSize="24" />
<Button
variant="Trigger"
className=" justify-center text-brand_tertiary/50 hover:text-brand_tertiary"
className="justify-center text-brand_tertiary/50 hover:text-brand_tertiary"
onClick={
searchParams === null ? handleCreateWorkingSpace : handleCreateTable
}
Expand All @@ -92,20 +93,31 @@ export default function FloatingNavbar() {
</Button>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="Trigger"
className=" justify-center text-brand_tertiary/50 hover:text-brand_tertiary"
>
<Avatar className="rounded-lg max-w-8 max-h-8 flex items-center justify-center border border-solid border-brand_tertiary/20">
<AvatarImage
src={User?.image}
alt={User ? User.name?.charAt(0) : "user not found".charAt(0)}
/>
<AvatarFallback>
{User ? User.name?.charAt(0) : "user not found".charAt(0)}
</AvatarFallback>
</Avatar>
</Button>
{Signoutloading === false ? (
<Button
variant="Trigger"
className=" justify-center text-brand_tertiary/50 hover:text-brand_tertiary"
>
<Avatar className="max-w-9 max-h-9 flex items-center justify-center">
<AvatarImage
src={User?.image}
className=" rounded-lg"
alt={User ? User.name?.charAt(0) : ""}
/>
<AvatarFallback>
{User ? User.name?.charAt(0) : <LoadingAnimation />}
</AvatarFallback>
</Avatar>
</Button>
) : (
<Button
variant="Trigger"
className=" justify-center text-brand_tertiary/50 hover:text-brand_tertiary"
disabled={Signoutloading}
>
<LoadingAnimation />
</Button>
)}
</DropdownMenuTrigger>
<DropdownMenuContent
side="top"
Expand Down