mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-09-14 11:19:42 +00:00
Fix disk setup and documentation for Turnkey VMs (#141)
This commit is contained in:
parent
4c46e9495d
commit
957f7e8ba2
9 changed files with 82 additions and 44 deletions
|
@ -26,14 +26,14 @@ export default function ScriptAccordion({
|
|||
undefined,
|
||||
);
|
||||
const linkRefs = useRef<{ [key: string]: HTMLAnchorElement | null }>({});
|
||||
|
||||
|
||||
const handleAccordionChange = (value: string | undefined) => {
|
||||
setExpandedItem(value);
|
||||
};
|
||||
|
||||
const handleSelected = useCallback(
|
||||
(title: string) => {
|
||||
setSelectedScript(title);
|
||||
(slug: string) => {
|
||||
setSelectedScript(slug);
|
||||
},
|
||||
[setSelectedScript],
|
||||
);
|
||||
|
@ -41,7 +41,7 @@ export default function ScriptAccordion({
|
|||
useEffect(() => {
|
||||
if (selectedScript) {
|
||||
const category = items.find((category) =>
|
||||
category.scripts.some((script) => script.name === selectedScript),
|
||||
category.scripts.some((script) => script.slug === selectedScript),
|
||||
);
|
||||
if (category) {
|
||||
setExpandedItem(category.name);
|
||||
|
@ -89,17 +89,17 @@ export default function ScriptAccordion({
|
|||
<Link
|
||||
href={{
|
||||
pathname: "/scripts",
|
||||
query: { id: script.name },
|
||||
query: { id: script.slug },
|
||||
}}
|
||||
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 ${
|
||||
selectedScript === script.name
|
||||
selectedScript === script.slug
|
||||
? "rounded-lg bg-accent font-semibold dark:bg-accent/30 dark:text-white"
|
||||
: ""
|
||||
}`}
|
||||
onClick={() => handleSelected(script.name)}
|
||||
onClick={() => handleSelected(script.slug)}
|
||||
ref={(el) => {
|
||||
linkRefs.current[script.name] = el;
|
||||
linkRefs.current[script.slug] = el;
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
|
|
|
@ -85,7 +85,7 @@ export function LatestScripts({ items }: { items: Category[] }) {
|
|||
<div className="min-w flex w-full flex-row flex-wrap gap-4">
|
||||
{latestScripts.slice(startIndex, endIndex).map((script) => (
|
||||
<Card
|
||||
key={script.name}
|
||||
key={script.slug}
|
||||
className="min-w-[250px] flex-1 flex-grow bg-accent/30"
|
||||
>
|
||||
<CardHeader>
|
||||
|
@ -121,7 +121,7 @@ export function LatestScripts({ items }: { items: Category[] }) {
|
|||
<Link
|
||||
href={{
|
||||
pathname: "/scripts",
|
||||
query: { id: script.name },
|
||||
query: { id: script.slug },
|
||||
}}
|
||||
>
|
||||
View Script
|
||||
|
@ -153,7 +153,7 @@ export function MostViewedScripts({ items }: { items: Category[] }) {
|
|||
<div className="min-w flex w-full flex-row flex-wrap gap-4">
|
||||
{mostViewedScripts.map((script) => (
|
||||
<Card
|
||||
key={script.name}
|
||||
key={script.slug}
|
||||
className="min-w-[250px] flex-1 flex-grow bg-accent/30"
|
||||
>
|
||||
<CardHeader>
|
||||
|
@ -189,7 +189,7 @@ export function MostViewedScripts({ items }: { items: Category[] }) {
|
|||
<Link
|
||||
href={{
|
||||
pathname: "/scripts",
|
||||
query: { id: script.name },
|
||||
query: { id: script.slug },
|
||||
}}
|
||||
prefetch={false}
|
||||
>
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
export const dynamic = "force-static";
|
||||
|
||||
import ScriptItem from "@/app/scripts/_components/ScriptItem";
|
||||
import { fetchCategories } from "@/lib/data";
|
||||
import { Category, Script } from "@/lib/types";
|
||||
import { Loader2 } from "lucide-react";
|
||||
import { Suspense, useEffect, useState } from "react";
|
||||
import Sidebar from "./_components/Sidebar";
|
||||
import { useQueryState } from "nuqs";
|
||||
import { Suspense, useEffect, useState } from "react";
|
||||
import {
|
||||
LatestScripts,
|
||||
MostViewedScripts,
|
||||
} from "./_components/ScriptInfoBlocks";
|
||||
import { fetchCategories } from "@/lib/data";
|
||||
import Sidebar from "./_components/Sidebar";
|
||||
|
||||
function ScriptContent() {
|
||||
const [selectedScript, setSelectedScript] = useQueryState("id");
|
||||
|
@ -24,7 +24,7 @@ function ScriptContent() {
|
|||
const script = links
|
||||
.map((category) => category.scripts)
|
||||
.flat()
|
||||
.find((script) => script.name === selectedScript);
|
||||
.find((script) => script.slug === selectedScript);
|
||||
setItem(script);
|
||||
}
|
||||
}, [selectedScript, links]);
|
||||
|
@ -76,4 +76,4 @@ export default function Page() {
|
|||
<ScriptContent />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue