docs(scanner): added in instructions on how to update the scanner
only test2 stage now commands for now.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { Link, useRouterState } from "@tanstack/react-router";
|
||||
import { ChevronRight } from "lucide-react";
|
||||
import { ChevronRight, ScrollText } from "lucide-react";
|
||||
import { getSettings } from "../../lib/queries/getSettings";
|
||||
import {
|
||||
Collapsible,
|
||||
CollapsibleContent,
|
||||
CollapsibleTrigger,
|
||||
} from "../ui/collapsible";
|
||||
|
||||
import {
|
||||
SidebarGroup,
|
||||
SidebarGroupContent,
|
||||
@@ -19,43 +20,55 @@ import {
|
||||
useSidebar,
|
||||
} from "../ui/sidebar";
|
||||
|
||||
const docs = [
|
||||
{
|
||||
title: "Notifications",
|
||||
url: "/intro",
|
||||
//icon,
|
||||
isActive: window.location.pathname.includes("notifications") ?? false,
|
||||
items: [
|
||||
{
|
||||
title: "Reprints",
|
||||
url: "/reprints",
|
||||
},
|
||||
{
|
||||
title: "New Blocking order",
|
||||
url: "/qualityBlocking",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Mobile",
|
||||
url: "/updateInstructions",
|
||||
isActive: false,
|
||||
items: [
|
||||
{
|
||||
title: "Settings",
|
||||
url: "/mobile-settings",
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
export default function DocBar() {
|
||||
const { setOpen } = useSidebar();
|
||||
const { data: settings, isLoading } = useSuspenseQuery(getSettings());
|
||||
const pathname = useRouterState({
|
||||
select: (s) => s.location.pathname,
|
||||
});
|
||||
|
||||
const isNotifications = pathname.includes("notifications");
|
||||
|
||||
const docs = [
|
||||
{
|
||||
title: "Notifications",
|
||||
url: "notifications/intro",
|
||||
//icon,
|
||||
isActive: true,
|
||||
items: [
|
||||
{
|
||||
title: "Reprints",
|
||||
icon: ScrollText,
|
||||
url: "notifications/reprints",
|
||||
},
|
||||
{
|
||||
title: "New Blocking order",
|
||||
icon: ScrollText,
|
||||
url: "notifications/qualityBlocking",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Mobile",
|
||||
url: "mobile/updateInstructions",
|
||||
isActive:
|
||||
!isLoading &&
|
||||
settings.filter((n: any) => n.name === "mobile")[0].active,
|
||||
items: [
|
||||
{
|
||||
title: "Update Instructions",
|
||||
icon: ScrollText,
|
||||
url: "mobile/updateInstructions",
|
||||
},
|
||||
// {
|
||||
// title: "Settings",
|
||||
// icon: ScrollText,
|
||||
// url: "mobile/mobile-settings",
|
||||
// },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<SidebarGroup>
|
||||
<SidebarGroupLabel>Docs</SidebarGroupLabel>
|
||||
@@ -72,42 +85,45 @@ export default function DocBar() {
|
||||
</SidebarMenu>
|
||||
<SidebarMenu>
|
||||
{docs.map((item) => (
|
||||
<Collapsible
|
||||
key={item.title}
|
||||
asChild
|
||||
defaultOpen={isNotifications}
|
||||
className="group/collapsible"
|
||||
>
|
||||
<SidebarMenuItem>
|
||||
<CollapsibleTrigger asChild>
|
||||
<SidebarMenuButton tooltip={item.title}>
|
||||
<Link
|
||||
to={"/docs/$"}
|
||||
params={{ _splat: `notifications${item.url}` }}
|
||||
>
|
||||
{item.title}
|
||||
</Link>
|
||||
<ChevronRight className="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" />
|
||||
</SidebarMenuButton>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<SidebarMenuSub>
|
||||
{item.items?.map((subItem) => (
|
||||
<SidebarMenuSubItem key={subItem.title}>
|
||||
<SidebarMenuSubButton asChild>
|
||||
<Link
|
||||
to={"/docs/$"}
|
||||
params={{ _splat: `notifications${subItem.url}` }}
|
||||
>
|
||||
{subItem.title}
|
||||
</Link>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
))}
|
||||
</SidebarMenuSub>
|
||||
</CollapsibleContent>
|
||||
</SidebarMenuItem>
|
||||
</Collapsible>
|
||||
<>
|
||||
{item.isActive && (
|
||||
<Collapsible
|
||||
key={item.title}
|
||||
asChild
|
||||
defaultOpen={isNotifications}
|
||||
className="group/collapsible"
|
||||
>
|
||||
<SidebarMenuItem>
|
||||
<CollapsibleTrigger asChild>
|
||||
<SidebarMenuButton tooltip={item.title}>
|
||||
<Link to={"/docs/$"} params={{ _splat: `${item.url}` }}>
|
||||
{item.title}
|
||||
</Link>
|
||||
<ChevronRight className="ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" />
|
||||
</SidebarMenuButton>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent>
|
||||
<SidebarMenuSub>
|
||||
{item.items?.map((subItem) => (
|
||||
<SidebarMenuSubItem key={subItem.title}>
|
||||
<SidebarMenuSubButton asChild>
|
||||
<Link
|
||||
to={"/docs/$"}
|
||||
params={{ _splat: `${subItem.url}` }}
|
||||
onClick={() => setOpen(false)}
|
||||
>
|
||||
<subItem.icon />
|
||||
<span>{subItem.title}</span>
|
||||
</Link>
|
||||
</SidebarMenuSubButton>
|
||||
</SidebarMenuSubItem>
|
||||
))}
|
||||
</SidebarMenuSub>
|
||||
</CollapsibleContent>
|
||||
</SidebarMenuItem>
|
||||
</Collapsible>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</SidebarMenu>
|
||||
</SidebarGroupContent>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Link } from "@tanstack/react-router";
|
||||
import { ScanText, ScrollText } from "lucide-react";
|
||||
import { ScanText } from "lucide-react";
|
||||
import {
|
||||
SidebarGroup,
|
||||
SidebarGroupContent,
|
||||
@@ -10,14 +10,14 @@ import {
|
||||
useSidebar,
|
||||
} from "../ui/sidebar";
|
||||
|
||||
export default function MobileBar({ session }: any) {
|
||||
export default function MobileBar() {
|
||||
const { setOpen } = useSidebar();
|
||||
const items = [
|
||||
{
|
||||
title: "Update Instructions",
|
||||
url: "/",
|
||||
icon: ScrollText,
|
||||
},
|
||||
// {
|
||||
// title: "Update Instructions",
|
||||
// url: "/",
|
||||
// icon: ScrollText,
|
||||
// },
|
||||
{
|
||||
title: "Scan Log",
|
||||
url: "/",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
Sidebar,
|
||||
SidebarContent,
|
||||
@@ -6,12 +7,14 @@ import {
|
||||
SidebarMenuItem,
|
||||
} from "@/components/ui/sidebar";
|
||||
import { useSession } from "@/lib/auth-client";
|
||||
import { getSettings } from "../../lib/queries/getSettings";
|
||||
import AdminSidebar from "./AdminBar";
|
||||
import DocBar from "./DocBar";
|
||||
import MobileBar from "./MobileBar";
|
||||
|
||||
export function AppSidebar() {
|
||||
const { data: session } = useSession();
|
||||
const { data: settings, isLoading } = useSuspenseQuery(getSettings());
|
||||
|
||||
return (
|
||||
<Sidebar
|
||||
@@ -24,7 +27,11 @@ export function AppSidebar() {
|
||||
<SidebarMenuItem>
|
||||
<SidebarContent>
|
||||
<DocBar />
|
||||
<MobileBar session={session} />
|
||||
{!isLoading &&
|
||||
settings.filter((n: any) => n.name === "mobile")[0].active && (
|
||||
<MobileBar />
|
||||
)}
|
||||
|
||||
{session &&
|
||||
(session.user.role === "admin" ||
|
||||
session.user.role === "systemAdmin" ||
|
||||
|
||||
Reference in New Issue
Block a user