Fix disk setup and documentation for Turnkey VMs (#141)

This commit is contained in:
Håvard Gjøby Thom
2024-11-08 22:27:01 +01:00
committed by GitHub
parent 4c46e9495d
commit 957f7e8ba2
9 changed files with 82 additions and 44 deletions

View File

@@ -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">

View File

@@ -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}
>