Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add nudge bottom banner for non logged in users #3259

Merged
merged 5 commits into from
May 1, 2024
Merged
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
21 changes: 20 additions & 1 deletion components/Workspaces/WorkspaceLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { useLocalStorage } from "react-use";
import { LuArrowRightToLine } from "react-icons/lu";
import { useOutsideClick } from "rooks";
import { useRef } from "react";
import { useRef, useState } from "react";
import clsx from "clsx";
import Link from "next/link";
import { IoClose } from "react-icons/io5";
import TopNav from "components/organisms/TopNav/top-nav";
import { AppSideBar } from "components/shared/AppSidebar/AppSidebar";
import { useMediaQuery } from "lib/hooks/useMediaQuery";
import useSupabaseAuth from "lib/hooks/useSupabaseAuth";
import ClientOnly from "components/atoms/ClientOnly/client-only";

interface WorkspaceLayoutProps {
Expand All @@ -20,6 +23,9 @@ export const WorkspaceLayout = ({ workspaceId, banner, children, footer }: Works
const [showingSidebar, setShowingSidebar] = useLocalStorage("showingSidebar", isLargeScreen);
const hideSidebar = () => setShowingSidebar(false);
const sidebarRef = useRef<HTMLSpanElement | null>(null);
const { user } = useSupabaseAuth();
const [showingSignupNudge, setShowingSignupNudge] = useState(true);

useOutsideClick(
sidebarRef,
(event) => {
Expand Down Expand Up @@ -77,6 +83,19 @@ export const WorkspaceLayout = ({ workspaceId, banner, children, footer }: Works
<div className="border-t flex">{footer}</div>
</div>
) : null}
{!user && showingSignupNudge ? (
<div className="sticky w-full min-w-screen bottom-0 bg-light-slate-2 border-t h-16 pr-3 grid place-content-center grid-flow-col gap-4 px-4 md:hidden">
<span>
<Link href="/start" className="text-sauced-orange hover:underline">
Sign up
</Link>{" "}
to start tracking your projects!
</span>
<button onClick={() => setShowingSignupNudge(false)}>
<IoClose className="w-4 h-4" />
</button>
</div>
) : null}
</>
);
};
Loading