mirror of
https://gitlab.w-hs.de/an14051/backerup-website.git
synced 2026-07-27 17:35:29 +00:00
feat: implement clipboard utility for copying text and update components to use it
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { LINKS } from "@/lib/links";
|
||||
import { copyText } from "@/lib/clipboard";
|
||||
|
||||
export interface TerminalLinks {
|
||||
dockerImage?: string;
|
||||
@@ -254,10 +255,10 @@ export default function TerminalTyper({ mode = "docker-run", links = {}, casaosM
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText(textToCopy).then(() => {
|
||||
copyText(textToCopy).then(() => {
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
});
|
||||
}).catch(() => {});
|
||||
};
|
||||
|
||||
const copyCasaOs = () => {
|
||||
@@ -265,10 +266,10 @@ export default function TerminalTyper({ mode = "docker-run", links = {}, casaosM
|
||||
const text = CASAOS_LINES.filter(line => line.type === "output")
|
||||
.map(line => line.text)
|
||||
.join("\n");
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
copyText(text).then(() => {
|
||||
setCopiedCasaOs(true);
|
||||
setTimeout(() => setCopiedCasaOs(false), 2000);
|
||||
});
|
||||
}).catch(() => {});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user