Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat: making manage teams screens responsive

Andreje78f23ce379c
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/team.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/team.tsx
index bc0de5e41..cfb640acc 100644
--- a/apps/web/src/routes/dashboard/workspace/$workspaceId/team.tsx
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/team.tsx
@@ -1,3 +1,4 @@
+import { Button } from "@/components/ui/button";
import { cn } from "@/lib/cn";
import {
Link,
@@ -5,70 +6,155 @@ import {
createFileRoute,
useRouterState,
} from "@tanstack/react-router";
+import { AnimatePresence, motion } from "framer-motion";
import { Shield, UserPlus, Users } from "lucide-react";
+import { Menu } from "lucide-react";
+import { useState } from "react";
export const Route = createFileRoute("/dashboard/workspace/$workspaceId/team")({
component: RouteComponent,
});
function RouteComponent() {
+ const [isMobileNavOpen, setIsMobileNavOpen] = useState(false);
const pathname = useRouterState({ select: (s) => s.location.pathname });
const { workspaceId } = Route.useParams();
return (
- <div className="flex-1 flex h-screen">
- <aside className="w-64 border-r border-zinc-200 dark:border-zinc-800 p-6">
- <h2 className="text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-4">
- Team
- </h2>
- <nav className="space-y-1">
- <Link
- className={`flex items-center px-3 py-2 rounded-lg text-sm ${
- pathname.includes("/members")
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800"
- }`}
- to="/dashboard/workspace/$workspaceId/team/members"
- params={{
- workspaceId,
- }}
- >
- <Users className="w-4 h-4 mr-3" />
- Members
- </Link>
+ <div className="flex-1 flex flex-col md:flex-row h-[calc(100vh-65px)]">
+ <motion.div
+ className="md:hidden border-b border-zinc-200 dark:border-zinc-800 p-4"
+ initial={{ opacity: 0, y: -10 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ duration: 0.2 }}
+ >
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={() => setIsMobileNavOpen(!isMobileNavOpen)}
+ className="flex items-center gap-2 group"
+ >
+ <Menu className="w-4 h-4 transition-transform duration-200 ease-in-out group-hover:rotate-90" />
+ <span>{isMobileNavOpen ? "Close Menu" : "Menu"}</span>
+ </Button>
+ </motion.div>
- <Link
- className={`flex items-center px-3 py-2 rounded-lg text-sm ${
- pathname.includes("/invitations")
- ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
- : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800"
- }`}
- to="/dashboard/workspace/$workspaceId/team/invitations"
- params={{
- workspaceId,
+ <AnimatePresence mode="wait">
+ {(isMobileNavOpen || window.innerWidth >= 768) && (
+ <motion.aside
+ initial={{
+ x: -50,
+ opacity: 0,
+ }}
+ animate={{
+ x: 0,
+ opacity: 1,
+ }}
+ exit={{
+ x: -50,
+ opacity: 0,
+ }}
+ transition={{
+ duration: 0.2,
+ ease: "easeOut",
}}
- >
- <UserPlus className="w-4 h-4 mr-3" />
- Invitations
- </Link>
-
- <div
className={cn(
- "flex items-center px-3 py-2 rounded-lg text-sm opacity-50 cursor-not-allowed",
- "text-zinc-400 dark:text-zinc-600",
+ "border-b md:border-b-0 md:border-r border-zinc-200 dark:border-zinc-800",
+ "md:w-64 bg-white dark:bg-zinc-950",
+ "md:block", // Always show on desktop
+ isMobileNavOpen ? "block" : "hidden", // Toggle on mobile
)}
>
- <Shield className="w-4 h-4 mr-3" />
- <span className="flex items-center gap-2">
- Roles
- <span className="text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400">
- Soon
- </span>
- </span>
- </div>
- </nav>
- </aside>
- <Outlet />
+ <div className="p-4 md:p-6">
+ <motion.h2
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ delay: 0.1 }}
+ className="text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-4"
+ >
+ Team
+ </motion.h2>
+ <nav className="space-y-1">
+ <motion.div
+ initial={{ opacity: 0, y: 10 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ delay: 0.2 }}
+ >
+ <Link
+ className={cn(
+ "flex items-center px-3 py-2 rounded-lg text-sm transition-all duration-200 ease-in-out",
+ pathname.includes("/members")
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800",
+ )}
+ to="/dashboard/workspace/$workspaceId/team/members"
+ params={{
+ workspaceId,
+ }}
+ onClick={() => setIsMobileNavOpen(false)}
+ >
+ <Users className="w-4 h-4 mr-3" />
+ Members
+ </Link>
+ </motion.div>
+
+ <motion.div
+ initial={{ opacity: 0, y: 10 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ delay: 0.3 }}
+ >
+ <Link
+ className={cn(
+ "flex items-center px-3 py-2 rounded-lg text-sm transition-all duration-200 ease-in-out",
+ pathname.includes("/invitations")
+ ? "bg-indigo-50 text-indigo-600 dark:bg-indigo-500/10 dark:text-indigo-400"
+ : "text-zinc-700 hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-zinc-800",
+ )}
+ to="/dashboard/workspace/$workspaceId/team/invitations"
+ params={{
+ workspaceId,
+ }}
+ onClick={() => setIsMobileNavOpen(false)}
+ >
+ <UserPlus className="w-4 h-4 mr-3" />
+ Invitations
+ </Link>
+ </motion.div>
+
+ <motion.div
+ initial={{ opacity: 0, y: 10 }}
+ animate={{ opacity: 1, y: 0 }}
+ transition={{ delay: 0.4 }}
+ >
+ <div
+ className={cn(
+ "flex items-center px-3 py-2 rounded-lg text-sm opacity-50 cursor-not-allowed transition-all duration-200 ease-in-out",
+ "text-zinc-400 dark:text-zinc-600",
+ )}
+ >
+ <Shield className="w-4 h-4 mr-3" />
+ <span className="flex items-center gap-2">
+ Roles
+ <span className="text-[10px] font-medium px-1.5 py-0.5 rounded-full bg-zinc-100 dark:bg-zinc-800 text-zinc-500 dark:text-zinc-400">
+ Soon
+ </span>
+ </span>
+ </div>
+ </motion.div>
+ </nav>
+ </div>
+ </motion.aside>
+ )}
+ </AnimatePresence>
+
+ <motion.div
+ className="flex-1 overflow-auto"
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ duration: 0.3 }}
+ >
+ <Outlet />
+ </motion.div>
</div>
);
}
diff --git a/apps/web/src/routes/dashboard/workspace/$workspaceId/team/invitations.tsx b/apps/web/src/routes/dashboard/workspace/$workspaceId/team/invitations.tsx
index 5ba332eb6..022663165 100644
--- a/apps/web/src/routes/dashboard/workspace/$workspaceId/team/invitations.tsx
+++ b/apps/web/src/routes/dashboard/workspace/$workspaceId/team/invitations.tsx
@@ -19,14 +19,14 @@ function RouteComponent() {
useState(false);
return (
- <div className="flex-1 p-6">
- <div className="flex items-center justify-between mb-6">
- <h1 className="text-2xl font-semibold text-zinc-900 dark:text-zinc-100">
+ <div className="flex-1 p-4 md:p-6">
+ <div className="flex flex-col md:flex-row md:items-center justify-between gap-4 mb-6">
+ <h1 className="text-xl md:text-2xl font-semibold text-zinc-900 dark:text-zinc-100">
Team Invitations
</h1>
<Button
onClick={() => setIsInviteTeamMemberModalOpen(true)}
- className="bg-indigo-600 text-white hover:bg-indigo-500 dark:bg-indigo-500 dark:hover:bg-indigo-400"
+ className="bg-indigo-600 text-white hover:bg-indigo-500 dark:bg-indigo-500 dark:hover:bg-indigo-400 w-full md:w-auto"
>
<UserPlus className="w-4 h-4 mr-2" />
New Invitation
@@ -35,7 +35,45 @@ function RouteComponent() {
<div className="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-200 dark:border-zinc-800 overflow-hidden">
<div className="overflow-x-auto">
- <table className="w-full">
+ <div className="md:hidden">
+ {users?.map((invitation) => (
+ <div
+ key={invitation.id}
+ className="p-4 border-b border-zinc-200 dark:border-zinc-800 last:border-0"
+ >
+ <div className="flex items-center gap-3 mb-3">
+ <Avatar className="h-8 w-8">
+ <AvatarFallback className="bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400 uppercase">
+ {invitation.email[0]}
+ </AvatarFallback>
+ </Avatar>
+ <div>
+ <div className="text-sm font-medium text-zinc-900 dark:text-zinc-100">
+ {invitation.email}
+ </div>
+ <div className="text-xs text-zinc-500 dark:text-zinc-400">
+ Invited{" "}
+ {new Date(invitation.invitedAt).toLocaleDateString(
+ "en-US",
+ {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ },
+ )}
+ </div>
+ </div>
+ </div>
+ <div className="flex items-center justify-between">
+ <span className="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-indigo-50 text-indigo-700 dark:bg-indigo-500/10 dark:text-indigo-400">
+ Admin
+ </span>
+ </div>
+ </div>
+ ))}
+ </div>
+
+ <table className="w-full hidden md:table">
<thead>
<tr className="border-b border-zinc-200 dark:border-zinc-800">
<th className="text-left py-3 px-4 text-sm font-medium text-zinc-500 dark:text-zinc-400">
@@ -44,7 +82,6 @@ function RouteComponent() {
<th className="text-left py-3 px-4 text-sm font-medium text-zinc-500 dark:text-zinc-400">
Role
</th>
-
<th className="text-left py-3 px-4 text-sm font-medium text-zinc-500 dark:text-zinc-400">
Sent
</th>
@@ -73,7 +110,6 @@ function RouteComponent() {
Admin
</span>
</td>
-
<td className="py-3 px-4 text-sm text-zinc-500 dark:text-zinc-400">
{new Date(invitation.invitedAt).toLocaleDateString(
"en-US",
@@ -98,6 +134,7 @@ function RouteComponent() {
</div>
)}
</div>
+
<InviteTeamMemberModal
open={isInviteTeamMemberModalOpen}
onClose={() => setIsInviteTeamMemberModalOpen(false)}