[WEB-5573] refactor: app rail enhancements (#8239)
* chore: app rail context added * chore: dock/undock app rail implementation * chore: refactor * chore: code refactor * chore: code refactor
This commit is contained in:
parent
fe867135c4
commit
1090b3e938
17 changed files with 162 additions and 22 deletions
|
|
@ -20,7 +20,7 @@ export function withDockItems<P extends WithDockItemsProps>(WrappedComponent: Re
|
|||
const dockItems: (AppSidebarItemData & { shouldRender: boolean })[] = [
|
||||
{
|
||||
label: "Projects",
|
||||
icon: <PlaneNewIcon className="size-4" />,
|
||||
icon: <PlaneNewIcon className="size-5" />,
|
||||
href: `/${workspaceSlug}/`,
|
||||
isActive: isProjectsPath && !isNotificationsPath,
|
||||
shouldRender: true,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ import { observer } from "mobx-react";
|
|||
// plane imports
|
||||
import { cn } from "@plane/utils";
|
||||
import { AppRailRoot } from "@/components/navigation";
|
||||
// plane web imports
|
||||
import { useAppRailVisibility } from "@/lib/app-rail";
|
||||
// local imports
|
||||
import { TopNavigationRoot } from "../navigations";
|
||||
|
||||
export const WorkspaceContentWrapper = observer(function WorkspaceContentWrapper({
|
||||
|
|
@ -11,14 +12,21 @@ export const WorkspaceContentWrapper = observer(function WorkspaceContentWrapper
|
|||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
// Use the context to determine if app rail should render
|
||||
const { shouldRenderAppRail } = useAppRailVisibility();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col relative size-full overflow-hidden bg-custom-background-90 transition-all ease-in-out duration-300">
|
||||
<TopNavigationRoot />
|
||||
<div className="relative flex size-full overflow-hidden">
|
||||
<AppRailRoot />
|
||||
{/* Conditionally render AppRailRoot based on context */}
|
||||
{shouldRenderAppRail && <AppRailRoot />}
|
||||
<div
|
||||
className={cn(
|
||||
"relative size-full pb-2 pr-2 flex-grow transition-all ease-in-out duration-300 overflow-hidden"
|
||||
"relative size-full pl-0 pb-2 pr-2 flex-grow transition-all ease-in-out duration-300 overflow-hidden",
|
||||
{
|
||||
"pl-2": shouldRenderAppRail,
|
||||
}
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
|
|
|||
1
apps/web/ce/hooks/app-rail/index.ts
Normal file
1
apps/web/ce/hooks/app-rail/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./provider";
|
||||
17
apps/web/ce/hooks/app-rail/provider.tsx
Normal file
17
apps/web/ce/hooks/app-rail/provider.tsx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { AppRailVisibilityProvider as CoreProvider } from "@/lib/app-rail";
|
||||
|
||||
interface AppRailVisibilityProviderProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* CE AppRailVisibilityProvider
|
||||
* Wraps core provider with isEnabled hardcoded to false
|
||||
*/
|
||||
export const AppRailVisibilityProvider = observer(({ children }: AppRailVisibilityProviderProps) => (
|
||||
<CoreProvider isEnabled={false}>{children}</CoreProvider>
|
||||
));
|
||||
Loading…
Add table
Add a link
Reference in a new issue