Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Update layout and component styles for improved responsiveness

Bill Yangaee634b37227
diff --git a/client/src/app/[site]/components/Sidebar/Sidebar.tsx b/client/src/app/[site]/components/Sidebar/Sidebar.tsx
index 6a9c793d5..c203a2bfc 100644
--- a/client/src/app/[site]/components/Sidebar/Sidebar.tsx
+++ b/client/src/app/[site]/components/Sidebar/Sidebar.tsx
@@ -44,7 +44,7 @@ export function Sidebar() {
};
return (
- <div className="w-56 bg-neutral-900 border-r border-neutral-850 flex flex-col h-screen">
+ <div className="w-56 bg-neutral-900 border-r border-neutral-850 flex flex-col h-dvh">
<div className="flex flex-col p-3 border-b border-neutral-800">
<SiteSelector />
</div>
diff --git a/client/src/app/[site]/layout.tsx b/client/src/app/[site]/layout.tsx
index e9fa81078..1aff45da5 100644
--- a/client/src/app/[site]/layout.tsx
+++ b/client/src/app/[site]/layout.tsx
@@ -36,7 +36,7 @@ export default function SiteLayout({ children }: { children: React.ReactNode })
}
return (
- <div className="flex flex-row h-screen">
+ <div className="flex flex-row h-dvh">
<AppSidebar />
<div className="flex flex-1 overflow-hidden">
<div className="hidden md:flex">
diff --git a/client/src/app/[site]/map/page.tsx b/client/src/app/[site]/map/page.tsx
index 4d89487db..1c6f0aa6a 100644
--- a/client/src/app/[site]/map/page.tsx
+++ b/client/src/app/[site]/map/page.tsx
@@ -16,7 +16,7 @@ export default function MapPage() {
return (
<DisabledOverlay message="Map" featurePath="map">
- <div className="relative w-full h-screen">
+ <div className="relative w-full h-dvh">
<div className="p-2 md:p-4 relative z-50">
<SubHeader />
</div>
diff --git a/client/src/app/[site]/page.tsx b/client/src/app/[site]/page.tsx
index d0a6b087e..2be3265d1 100644
--- a/client/src/app/[site]/page.tsx
+++ b/client/src/app/[site]/page.tsx
@@ -4,7 +4,7 @@
// All redirects should be handled by the middleware
export default function SiteRedirect() {
return (
- <div className="min-h-screen flex items-center justify-center">
+ <div className="min-h-dvh flex items-center justify-center">
<div className="text-center">
<div className="inline-block w-12 h-12 border-4 border-blue-500 border-t-transparent rounded-full animate-spin"></div>
<p className="mt-4">Redirecting...</p>
diff --git a/client/src/app/admin/page.tsx b/client/src/app/admin/page.tsx
index 31bc06219..c081c56a5 100644
--- a/client/src/app/admin/page.tsx
+++ b/client/src/app/admin/page.tsx
@@ -7,41 +7,85 @@ import { Sites } from "./components/sites/Sites";
import { Users } from "./components/users/Users";
import { Organizations } from "./components/organizations/Organizations";
import { AdminLayout } from "./components/shared/AdminLayout";
+import { AppSidebar } from "../../components/AppSidebar";
+
+import { usePathname } from "next/navigation";
+import { useGetSite } from "../../api/admin/sites";
+import { Button } from "../../components/ui/button";
+import { Sheet, SheetContent, SheetHeader, SheetTitle, SheetTrigger } from "../../components/ui/sheet";
+
+import { Menu } from "lucide-react";
+import { VisuallyHidden } from "radix-ui";
+import { Favicon } from "../../components/Favicon";
+
+function MobileSidebar() {
+ const pathname = usePathname();
+ const { data: site } = useGetSite(Number(pathname.split("/")[1]));
+
+ return (
+ <div className="md:hidden flex items-center gap-2">
+ <Sheet>
+ <SheetTrigger asChild>
+ <Button size="icon" variant="outline">
+ <Menu />
+ </Button>
+ </SheetTrigger>
+ <VisuallyHidden.Root>
+ <SheetHeader>
+ <SheetTitle>Rybbit Sidebar</SheetTitle>
+ </SheetHeader>
+ </VisuallyHidden.Root>
+ <SheetContent side="left" className="p-0 w-[40px] flex gap-0" showClose={false}>
+ <AppSidebar />
+ </SheetContent>
+ </Sheet>
+ {site && <Favicon domain={site.domain} className="w-6 h-6" />}
+ </div>
+ );
+}
export default function AdminPage() {
const [activeTab, setActiveTab] = useState("organizations");
return (
- <StandardPage>
- <AdminLayout title="Admin Dashboard">
- <Tabs defaultValue="organizations" value={activeTab} onValueChange={setActiveTab}>
- <TabsList className="mb-4">
- <TabsTrigger value="organizations">Organizations</TabsTrigger>
- <TabsTrigger value="sites">Sites</TabsTrigger>
- <TabsTrigger value="users">Users</TabsTrigger>
- <TabsTrigger value="settings">Settings</TabsTrigger>
- </TabsList>
-
- <TabsContent value="users">
- <Users />
- </TabsContent>
-
- <TabsContent value="organizations">
- <Organizations />
- </TabsContent>
-
- <TabsContent value="sites">
- <Sites />
- </TabsContent>
-
- <TabsContent value="settings">
- <div className="p-4 border rounded-md">
- <h2 className="text-xl font-bold mb-4">Admin Settings</h2>
- <p className="text-muted-foreground">Settings panel coming soon...</p>
- </div>
- </TabsContent>
- </Tabs>
- </AdminLayout>
- </StandardPage>
+ <div className="flex h-full">
+ <div className="hidden md:block">
+ <AppSidebar />
+ </div>
+ <StandardPage showSidebar={false}>
+ <div className="mb-2">
+ <MobileSidebar />
+ </div>
+ <AdminLayout title="Admin Dashboard">
+ <Tabs defaultValue="organizations" value={activeTab} onValueChange={setActiveTab}>
+ <TabsList className="mb-4">
+ <TabsTrigger value="organizations">Organizations</TabsTrigger>
+ <TabsTrigger value="sites">Sites</TabsTrigger>
+ <TabsTrigger value="users">Users</TabsTrigger>
+ <TabsTrigger value="settings">Settings</TabsTrigger>
+ </TabsList>
+
+ <TabsContent value="users">
+ <Users />
+ </TabsContent>
+
+ <TabsContent value="organizations">
+ <Organizations />
+ </TabsContent>
+
+ <TabsContent value="sites">
+ <Sites />
+ </TabsContent>
+
+ <TabsContent value="settings">
+ <div className="p-4 border rounded-md">
+ <h2 className="text-xl font-bold mb-4">Admin Settings</h2>
+ <p className="text-muted-foreground">Settings panel coming soon...</p>
+ </div>
+ </TabsContent>
+ </Tabs>
+ </AdminLayout>
+ </StandardPage>
+ </div>
);
}
diff --git a/client/src/app/auth/subscription/success/page.tsx b/client/src/app/auth/subscription/success/page.tsx
index ce6f07990..042f6c613 100644
--- a/client/src/app/auth/subscription/success/page.tsx
+++ b/client/src/app/auth/subscription/success/page.tsx
@@ -22,7 +22,7 @@ export default function StripeSuccessPage() {
}, [router]);
return (
- <div className="min-h-screen flex flex-col items-center justify-center">
+ <div className="min-h-dvh flex flex-col items-center justify-center">
<div className="text-center">
<h1 className="text-2xl font-bold mb-4">Payment Successful!</h1>
<div className="mb-4">
@@ -31,9 +31,7 @@ export default function StripeSuccessPage() {
<p className="text-lg text-neutral-600 dark:text-neutral-400">
Your subscription has been processed successfully.
</p>
- <p className="text-neutral-600 dark:text-neutral-400 mt-2">
- Redirecting you to your subscription details...
- </p>
+ <p className="text-neutral-600 dark:text-neutral-400 mt-2">Redirecting you to your subscription details...</p>
</div>
</div>
);
diff --git a/client/src/app/invitation/page.tsx b/client/src/app/invitation/page.tsx
index 770b3094f..cde2155e7 100644
--- a/client/src/app/invitation/page.tsx
+++ b/client/src/app/invitation/page.tsx
@@ -8,18 +8,8 @@ import { ThreeDotLoader } from "../../components/Loaders";
import { TopBar } from "../../components/TopBar";
import { Alert, AlertDescription, AlertTitle } from "../../components/ui/alert";
import { Button } from "../../components/ui/button";
-import {
- Card,
- CardContent,
- CardHeader,
- CardTitle,
-} from "../../components/ui/card";
-import {
- Tabs,
- TabsContent,
- TabsList,
- TabsTrigger,
-} from "../../components/ui/tabs";
+import { Card, CardContent, CardHeader, CardTitle } from "../../components/ui/card";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../components/ui/tabs";
import { authClient } from "../../lib/auth";
import { Login } from "./components/login";
import { Signup } from "./components/signup";
@@ -33,19 +23,11 @@ function AuthComponent() {
<Card className="w-full max-w-md p-1">
<CardHeader>
<Image src="/rybbit.svg" alt="Rybbit" width={32} height={32} />
- <CardTitle className="text-2xl flex justify-center">
- Join {organization}
- </CardTitle>
- <p className="text-center text-sm text-muted-foreground mt-2">
- You've been invited by {inviterEmail}
- </p>
+ <CardTitle className="text-2xl flex justify-center">Join {organization}</CardTitle>
+ <p className="text-center text-sm text-muted-foreground mt-2">You've been invited by {inviterEmail}</p>
</CardHeader>
<CardContent>
- <Tabs
- defaultValue="login"
- value={activeTab}
- onValueChange={(v) => setActiveTab(v as "login" | "signup")}
- >
+ <Tabs defaultValue="login" value={activeTab} onValueChange={(v) => setActiveTab(v as "login" | "signup")}>
<TabsList className="grid w-full grid-cols-2 mb-6">
<TabsTrigger value="signup">Sign Up</TabsTrigger>
<TabsTrigger value="login">Login</TabsTrigger>
@@ -95,24 +77,16 @@ function AcceptInvitationInner() {
<Card className="w-full max-w-md">
<CardHeader>
<Image src="/rybbit.svg" alt="Rybbit" width={32} height={32} />
- <CardTitle className="text-2xl flex justify-center">
- Invitation
- </CardTitle>
+ <CardTitle className="text-2xl flex justify-center">Invitation</CardTitle>
</CardHeader>
<CardContent>
<div className="flex flex-col gap-4">
<p className="text-center">
- You have been invited to join{" "}
- <span className="font-bold">{organization}</span> by{" "}
+ You have been invited to join <span className="font-bold">{organization}</span> by{" "}
<span className="font-bold">{inviterEmail}</span>
</p>
- <Button
- onClick={acceptInvitation}
- disabled={isLoading}
- variant="success"
- className="w-full"
- >
+ <Button onClick={acceptInvitation} disabled={isLoading} variant="success" className="w-full">
{isLoading ? "Accepting..." : "Accept Invitation"}
</Button>
@@ -132,22 +106,12 @@ function AcceptInvitationInner() {
function InvitationContent() {
const { data: sessionData, isPending } = authClient.useSession();
- return (
- <>
- {isPending ? (
- <ThreeDotLoader />
- ) : !sessionData?.user ? (
- <AuthComponent />
- ) : (
- <AcceptInvitationInner />
- )}
- </>
- );
+ return <>{isPending ? <ThreeDotLoader /> : !sessionData?.user ? <AuthComponent /> : <AcceptInvitationInner />}</>;
}
export default function AcceptInvitation() {
return (
- <div className="flex flex-col min-h-screen">
+ <div className="flex flex-col min-h-dvh">
<TopBar />
<div className="flex justify-center items-center flex-grow p-4">
diff --git a/client/src/app/login/page.tsx b/client/src/app/login/page.tsx
index c14a6388b..8892165af 100644
--- a/client/src/app/login/page.tsx
+++ b/client/src/app/login/page.tsx
@@ -50,14 +50,12 @@ export default function Page() {
};
return (
- <div className="flex flex-col justify-between items-center h-screen w-full p-4">
+ <div className="flex flex-col justify-between items-center h-dvh w-full p-4">
<div></div>
<Card className="w-full max-w-sm p-1">
<CardHeader>
<Image src="/rybbit.svg" alt="Rybbit" width={32} height={32} />
- <CardTitle className="text-2xl flex justify-center">
- Sign in
- </CardTitle>
+ <CardTitle className="text-2xl flex justify-center">Sign in</CardTitle>
</CardHeader>
<CardContent>
<form onSubmit={handleSubmit}>
@@ -81,10 +79,7 @@ export default function Page() {
value={password}
onChange={(e) => setPassword(e.target.value)}
rightElement={
- <Link
- href="/reset-password"
- className="text-xs text-muted-foreground hover:text-primary"
- >
+ <Link href="/reset-password" className="text-xs text-muted-foreground hover:text-primary">
Forgot password?
</Link>
}
diff --git a/client/src/app/reset-password/page.tsx b/client/src/app/reset-password/page.tsx
index 9d7f16f8b..8ff12c55b 100644
--- a/client/src/app/reset-password/page.tsx
+++ b/client/src/app/reset-password/page.tsx
@@ -80,16 +80,12 @@ export default function ResetPasswordPage() {
};
return (
- <div className="flex justify-center items-center h-screen w-full p-4">
+ <div className="flex justify-center items-center h-dvh w-full p-4">
<Card className="w-full max-w-sm p-1">
<CardHeader>
<Image src="/rybbit.svg" alt="Rybbit" width={32} height={32} />
<CardTitle className="text-2xl flex justify-center">
- {resetSuccess
- ? "Password Reset Successful"
- : otpSent
- ? "Enter OTP Code"
- : "Reset Password"}
+ {resetSuccess ? "Password Reset Successful" : otpSent ? "Enter OTP Code" : "Reset Password"}
</CardTitle>
</CardHeader>
<CardContent>
@@ -100,23 +96,18 @@ export default function ResetPasswordPage() {
</div>
<div className="text-center space-y-2">
<h3 className="text-xl font-medium text-green-500">Success!</h3>
- <p className="text-muted-foreground">
- Your password has been reset successfully.
- </p>
+ <p className="text-muted-foreground">Your password has been reset successfully.</p>
</div>
<div className="w-full rounded-md bg-neutral-800/30 p-3 mt-4">
<div className="flex justify-center">
- <p className="text-sm text-muted-foreground">
- Redirecting to login page...
- </p>
+ <p className="text-sm text-muted-foreground">Redirecting to login page...</p>
</div>
</div>
</div>
) : otpSent ? (
<form onSubmit={handleResetPassword} className="space-y-4">
<p className="text-sm text-muted-foreground">
- We've sent a verification code to {email}. Please enter the code
- below along with your new password.
+ We've sent a verification code to {email}. Please enter the code below along with your new password.
</p>
<AuthInput
@@ -139,10 +130,7 @@ export default function ResetPasswordPage() {
onChange={(e) => setNewPassword(e.target.value)}
/>
- <AuthButton
- isLoading={isLoading}
- loadingText="Resetting password..."
- >
+ <AuthButton isLoading={isLoading} loadingText="Resetting password...">
Reset Password
</AuthButton>
@@ -161,8 +149,7 @@ export default function ResetPasswordPage() {
) : (
<form onSubmit={handleRequestOTP} className="space-y-4">
<p className="text-sm text-muted-foreground">
- Enter your email address and we'll send you a verification code
- to reset your password.
+ Enter your email address and we'll send you a verification code to reset your password.
</p>
<AuthInput
diff --git a/client/src/app/signup/page.tsx b/client/src/app/signup/page.tsx
index 0f1aea9e4..3f5a1fde1 100644
--- a/client/src/app/signup/page.tsx
+++ b/client/src/app/signup/page.tsx
@@ -326,7 +326,7 @@ export default function SignupPage() {
if (configs?.disableSignup) {
return (
- <div className="flex justify-center items-center h-screen w-full">
+ <div className="flex justify-center items-center h-dvh w-full">
<Card className="w-full max-w-sm p-1">
<CardHeader>
<Image src="/rybbit.svg" alt="Rybbit" width={32} height={32} />
@@ -349,7 +349,7 @@ export default function SignupPage() {
}
return (
- <div className="flex justify-center items-center h-screen w-full p-4 ">
+ <div className="flex justify-center items-center h-dvh w-full p-4 ">
<div className="flex flex-col items-center bg-background relative">
{/* Suspense boundary for the URL parameter handler */}
<Suspense fallback={null}>
diff --git a/client/src/components/AppSidebar.tsx b/client/src/components/AppSidebar.tsx
index ad01cad1b..777ca6732 100644
--- a/client/src/components/AppSidebar.tsx
+++ b/client/src/components/AppSidebar.tsx
@@ -1,20 +1,22 @@
"use client";
-import { BarChart, SquareActivity, User } from "lucide-react";
+import { BarChart, ShieldUser, User } from "lucide-react";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useState } from "react";
+import { useAdminPermission } from "../app/admin/hooks/useAdminPermission";
import { cn } from "../lib/utils";
export function AppSidebar() {
const pathname = usePathname();
+ const { isAdmin } = useAdminPermission();
const [isExpanded, setIsExpanded] = useState(false);
return (
<div
className={cn(
- "flex flex-col items-start justify-between h-screen p-2 py-3 bg-neutral-900 border-r border-neutral-850 gap-3 transition-all duration-1s00",
+ "flex flex-col items-start justify-between h-dvh p-2 py-3 bg-neutral-900 border-r border-neutral-850 gap-3 transition-all duration-1s00",
isExpanded ? "w-44" : "w-[45px]"
)}
onMouseEnter={() => setIsExpanded(true)}
@@ -38,6 +40,15 @@ export function AppSidebar() {
active={pathname.startsWith("/uptime")}
expanded={isExpanded}
/> */}
+ {isAdmin && (
+ <SidebarLink
+ href="/admin"
+ icon={<ShieldUser className="w-5 h-5" />}
+ label="Admin"
+ active={pathname.startsWith("/admin")}
+ expanded={isExpanded}
+ />
+ )}
</div>
<SidebarLink
href="/settings/account"
diff --git a/client/src/components/StandardPage.tsx b/client/src/components/StandardPage.tsx
index 2d60a6b31..517844094 100644
--- a/client/src/components/StandardPage.tsx
+++ b/client/src/components/StandardPage.tsx
@@ -4,7 +4,7 @@ export function StandardPage({ children, showSidebar = true }: { children: React
return (
<div className="h-full flex w-full">
{showSidebar && <AppSidebar />}
- <main className="flex flex-col items-center px-4 py-4 w-full h-screen overflow-y-auto">
+ <main className="flex flex-col items-center px-4 py-4 w-full h-dvh overflow-y-auto">
<div className="w-full max-w-6xl">{children}</div>
</main>
</div>