Skip to content

Commit 10b2ddf

Browse files
authored
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
1 parent 0988ee1 commit 10b2ddf

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

frontend/src/app/scripts/_components/ScriptAccordion.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useCallback, useEffect, useRef } from "react";
22

3+
import { formattedBadge } from "@/components/CommandMenu";
34
import {
45
Accordion,
56
AccordionContent,
@@ -8,12 +9,9 @@ import {
89
} from "@/components/ui/accordion";
910
import { Category } from "@/lib/types";
1011
import { cn } from "@/lib/utils";
11-
import { Star } from "lucide-react";
1212
import Image from "next/image";
1313
import Link from "next/link";
1414
import { useState } from "react";
15-
import { Badge } from "../../../components/ui/badge";
16-
import { formattedBadge } from "@/components/CommandMenu";
1715

1816
export default function ScriptAccordion({
1917
items,
@@ -57,6 +55,7 @@ export default function ScriptAccordion({
5755
value={expandedItem}
5856
onValueChange={handleAccordionChange}
5957
collapsible
58+
className="overflow-y-scroll max-h-[calc(100vh-210px)] overflow-x-hidden pb-4"
6059
>
6160
{items.map((category) => (
6261
<AccordionItem
@@ -79,9 +78,7 @@ export default function ScriptAccordion({
7978
</div>{" "}
8079
</AccordionTrigger>
8180
<AccordionContent
82-
data-state={
83-
expandedItem === category.name ? "open" : "closed"
84-
}
81+
data-state={expandedItem === category.name ? "open" : "closed"}
8582
className="pt-0"
8683
>
8784
{category.scripts
@@ -92,7 +89,7 @@ export default function ScriptAccordion({
9289
<Link
9390
href={{
9491
pathname: "/scripts",
95-
query: { id: script.name},
92+
query: { id: script.name },
9693
}}
9794
prefetch={false}
9895
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 ${

frontend/src/app/scripts/_components/ScriptItems/InstallCommand.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import CodeCopyButton from "@/components/ui/code-copy-button";
22
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
33
import { basePath } from "@/config/siteConfig";
44
import { Script } from "@/lib/types";
5+
import { getDisplayValueFromType } from "../ScriptInfoBlocks";
56

67
const getInstallCommand = (scriptPath?: string) => {
78
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 }) {
2122
<p className="text-sm mt-2">
2223
{isAlpine ? (
2324
<>
24-
As an alternative option, you can use Alpine Linux and the {item.name}{" "}
25-
package to create a {item.name} {item.type} container with faster
26-
creation time and minimal system resource usage. You are also
27-
obliged to adhere to updates provided by the package maintainer.
25+
As an alternative option, you can use Alpine Linux and the{" "}
26+
{item.name} package to create a {item.name}{" "}
27+
{getDisplayValueFromType(item.type)} container with faster creation
28+
time and minimal system resource usage. You are also obliged to
29+
adhere to updates provided by the package maintainer.
2830
</>
2931
) : item.type ? (
3032
<>
31-
To create a new Proxmox VE {item.name} {item.type}, run the command
32-
below in the Proxmox VE Shell.
33+
To create a new Proxmox VE {item.name}{" "}
34+
{getDisplayValueFromType(item.type)}, run the command below in the
35+
Proxmox VE Shell.
3336
</>
3437
) : (
35-
<>To use the {item.name} script, run the command below in the shell.</>
38+
<>
39+
To use the {item.name} script, run the command below in the shell.
40+
</>
3641
)}
3742
</p>
3843
{isAlpine && (
3944
<p className="mt-2 text-sm">
40-
To create a new Proxmox VE Alpine-{item.name} {item.type}, run the command
41-
below in the Proxmox VE Shell
45+
To create a new Proxmox VE Alpine-{item.name}{" "}
46+
{getDisplayValueFromType(item.type)}, run the command below in the
47+
Proxmox VE Shell
4248
</p>
4349
)}
4450
</>

frontend/src/styles/globals.css

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@
119119
}
120120
}
121121

122-
123-
124122
@layer base {
125123
* {
126124
@apply border-border;
@@ -134,7 +132,15 @@
134132
}
135133

136134
::-webkit-scrollbar {
137-
display: none;
135+
width: 9px;
136+
}
137+
::-webkit-scrollbar-track {
138+
background: transparent;
139+
}
140+
::-webkit-scrollbar-thumb {
141+
background-color: rgba(155, 155, 155, 0.25);
142+
border-radius: 20px;
143+
border: transparent;
138144
}
139145

140146
.glass {

0 commit comments

Comments
 (0)