style / tools optis & new tools calculator
All checks were successful
Deploy Sokko G / deploy (push) Successful in 6s

This commit is contained in:
Shinuwa 2026-07-23 21:06:05 +02:00
parent 6b84607b25
commit 0db35a0d2c
23 changed files with 1106 additions and 24 deletions

View file

@ -0,0 +1,43 @@
import { useState } from "react";
import { Icon } from "../../components/Icon.jsx";
async function copyText(value) {
try {
await navigator.clipboard.writeText(value);
return true;
} catch {
return false;
}
}
export function formatChecklistImportItems(labels) {
return labels
.map((label) => String(label || "").trim())
.filter(Boolean)
.map((label) => `${label}:1`)
.join("\n");
}
export function CopyChecklistItemsButton({ labels, title = "Copier pour checklist" }) {
const [copied, setCopied] = useState(false);
const text = formatChecklistImportItems(labels);
async function copyItems() {
if (!text || !await copyText(text)) return;
setCopied(true);
window.setTimeout(() => setCopied(false), 1400);
}
return (
<button
className="filter-reset-button results-copy-button"
type="button"
onClick={copyItems}
disabled={!text}
aria-label={title}
title={copied ? "Copié" : title}
>
<Icon name="copy" />
</button>
);
}