mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-01-10 19:05:09 +00:00
Adding a scrollbar to the sidebar for better navigation. (#120)
* manually set basePath in `next.config.mjs` * Fix: add getDisplayValueFromType formatting in InstallCommand instead of displaying raw type * Refactor ScriptAccordion to improve layout and scroll handling
This commit is contained in:
parent
0988ee1601
commit
10b2ddf3e0
@ -1,5 +1,6 @@
|
|||||||
import { useCallback, useEffect, useRef } from "react";
|
import { useCallback, useEffect, useRef } from "react";
|
||||||
|
|
||||||
|
import { formattedBadge } from "@/components/CommandMenu";
|
||||||
import {
|
import {
|
||||||
Accordion,
|
Accordion,
|
||||||
AccordionContent,
|
AccordionContent,
|
||||||
@ -8,12 +9,9 @@ import {
|
|||||||
} from "@/components/ui/accordion";
|
} from "@/components/ui/accordion";
|
||||||
import { Category } from "@/lib/types";
|
import { Category } from "@/lib/types";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { Star } from "lucide-react";
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Badge } from "../../../components/ui/badge";
|
|
||||||
import { formattedBadge } from "@/components/CommandMenu";
|
|
||||||
|
|
||||||
export default function ScriptAccordion({
|
export default function ScriptAccordion({
|
||||||
items,
|
items,
|
||||||
@ -57,6 +55,7 @@ export default function ScriptAccordion({
|
|||||||
value={expandedItem}
|
value={expandedItem}
|
||||||
onValueChange={handleAccordionChange}
|
onValueChange={handleAccordionChange}
|
||||||
collapsible
|
collapsible
|
||||||
|
className="overflow-y-scroll max-h-[calc(100vh-210px)] overflow-x-hidden pb-4"
|
||||||
>
|
>
|
||||||
{items.map((category) => (
|
{items.map((category) => (
|
||||||
<AccordionItem
|
<AccordionItem
|
||||||
@ -79,9 +78,7 @@ export default function ScriptAccordion({
|
|||||||
</div>{" "}
|
</div>{" "}
|
||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
<AccordionContent
|
<AccordionContent
|
||||||
data-state={
|
data-state={expandedItem === category.name ? "open" : "closed"}
|
||||||
expandedItem === category.name ? "open" : "closed"
|
|
||||||
}
|
|
||||||
className="pt-0"
|
className="pt-0"
|
||||||
>
|
>
|
||||||
{category.scripts
|
{category.scripts
|
||||||
@ -92,7 +89,7 @@ export default function ScriptAccordion({
|
|||||||
<Link
|
<Link
|
||||||
href={{
|
href={{
|
||||||
pathname: "/scripts",
|
pathname: "/scripts",
|
||||||
query: { id: script.name},
|
query: { id: script.name },
|
||||||
}}
|
}}
|
||||||
prefetch={false}
|
prefetch={false}
|
||||||
className={`flex cursor-pointer items-center justify-between gap-1 px-1 py-1 text-muted-foreground hover:rounded-lg hover:bg-accent/60 hover:dark:bg-accent/20 ${
|
className={`flex cursor-pointer items-center justify-between gap-1 px-1 py-1 text-muted-foreground hover:rounded-lg hover:bg-accent/60 hover:dark:bg-accent/20 ${
|
||||||
|
@ -2,6 +2,7 @@ import CodeCopyButton from "@/components/ui/code-copy-button";
|
|||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { basePath } from "@/config/siteConfig";
|
import { basePath } from "@/config/siteConfig";
|
||||||
import { Script } from "@/lib/types";
|
import { Script } from "@/lib/types";
|
||||||
|
import { getDisplayValueFromType } from "../ScriptInfoBlocks";
|
||||||
|
|
||||||
const getInstallCommand = (scriptPath?: string) => {
|
const getInstallCommand = (scriptPath?: string) => {
|
||||||
return `bash -c "$(wget -qLO - https://github.com/community-scripts/${basePath}/raw/main/${scriptPath})"`;
|
return `bash -c "$(wget -qLO - https://github.com/community-scripts/${basePath}/raw/main/${scriptPath})"`;
|
||||||
@ -21,24 +22,29 @@ export default function InstallCommand({ item }: { item: Script }) {
|
|||||||
<p className="text-sm mt-2">
|
<p className="text-sm mt-2">
|
||||||
{isAlpine ? (
|
{isAlpine ? (
|
||||||
<>
|
<>
|
||||||
As an alternative option, you can use Alpine Linux and the {item.name}{" "}
|
As an alternative option, you can use Alpine Linux and the{" "}
|
||||||
package to create a {item.name} {item.type} container with faster
|
{item.name} package to create a {item.name}{" "}
|
||||||
creation time and minimal system resource usage. You are also
|
{getDisplayValueFromType(item.type)} container with faster creation
|
||||||
obliged to adhere to updates provided by the package maintainer.
|
time and minimal system resource usage. You are also obliged to
|
||||||
|
adhere to updates provided by the package maintainer.
|
||||||
</>
|
</>
|
||||||
) : item.type ? (
|
) : item.type ? (
|
||||||
<>
|
<>
|
||||||
To create a new Proxmox VE {item.name} {item.type}, run the command
|
To create a new Proxmox VE {item.name}{" "}
|
||||||
below in the Proxmox VE Shell.
|
{getDisplayValueFromType(item.type)}, run the command below in the
|
||||||
|
Proxmox VE Shell.
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>To use the {item.name} script, run the command below in the shell.</>
|
<>
|
||||||
|
To use the {item.name} script, run the command below in the shell.
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
{isAlpine && (
|
{isAlpine && (
|
||||||
<p className="mt-2 text-sm">
|
<p className="mt-2 text-sm">
|
||||||
To create a new Proxmox VE Alpine-{item.name} {item.type}, run the command
|
To create a new Proxmox VE Alpine-{item.name}{" "}
|
||||||
below in the Proxmox VE Shell
|
{getDisplayValueFromType(item.type)}, run the command below in the
|
||||||
|
Proxmox VE Shell
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
@ -119,8 +119,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
* {
|
* {
|
||||||
@apply border-border;
|
@apply border-border;
|
||||||
@ -134,7 +132,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
display: none;
|
width: 9px;
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background-color: rgba(155, 155, 155, 0.25);
|
||||||
|
border-radius: 20px;
|
||||||
|
border: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.glass {
|
.glass {
|
||||||
|
Loading…
Reference in New Issue
Block a user