feat: remove clear Sheets IDs button from creation UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-24 20:03:42 +02:00
parent 6ca2509ca6
commit cc0d57bf2b
+4 -31
View File
@@ -16,8 +16,6 @@ export default function CreationPage() {
const [selectedTab, setSelectedTab] = useState<string | null>(null)
const [loading, setLoading] = useState(false)
const [error, setError] = useState<string | null>(null)
const [clearingIds, setClearingIds] = useState(false)
const [clearResult, setClearResult] = useState<string | null>(null)
const [byTab, setByTab] = useState<Record<string, PendingProduct[]>>({})
const [total, setTotal] = useState(0)
const [specificColumns, setSpecificColumns] = useState<string[]>([])
@@ -48,7 +46,6 @@ export default function CreationPage() {
setDetectedCollectionId('')
setCollectionOverride('')
setCollectionSearch('')
setClearResult(null)
}
const analyse = async () => {
@@ -140,23 +137,6 @@ export default function CreationPage() {
]
const currentIdx = STEPS.findIndex(s => s.id === step)
const clearSheetIds = async () => {
if (!selectedTab) return
if (!confirm(`Effacer tous les IDs Shopify dans l'onglet "${selectedTab}" ? Les produits Shopify ne seront PAS supprimés.`)) return
setClearingIds(true)
setClearResult(null)
try {
const res = await fetch(`/api/creation/clear-ids?tab=${encodeURIComponent(selectedTab)}`, { method: 'POST' })
const data = await res.json()
if (!res.ok) throw new Error(data.error)
setClearResult(`${data.cleared} ID${data.cleared > 1 ? 's' : ''} effacé${data.cleared > 1 ? 's' : ''} dans le Sheets`)
} catch (e) {
setError(e instanceof Error ? e.message : 'Erreur')
} finally {
setClearingIds(false)
}
}
const reset = () => {
abortRef.current?.abort()
abortRef.current = null
@@ -213,17 +193,10 @@ export default function CreationPage() {
<p className="text-gray-300 text-sm">
Détecte les lignes de <strong className="text-white">{selectedTab}</strong> <code className="text-indigo-300">Publié=1</code> et <code className="text-indigo-300">ID vide</code>.
</p>
<div className="flex gap-3 flex-wrap items-center">
<button onClick={analyse} disabled={loading}
className="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 text-white rounded-lg text-sm font-medium transition-colors">
{loading ? 'Analyse en cours…' : 'Analyser le Sheets'}
</button>
<button onClick={clearSheetIds} disabled={clearingIds}
className="px-4 py-2 bg-amber-700 hover:bg-amber-600 disabled:opacity-50 text-white rounded-lg text-sm font-medium transition-colors">
{clearingIds ? 'Nettoyage…' : '🗑 Vider les IDs Shopify du Sheets'}
</button>
</div>
{clearResult && <p className="text-green-400 text-xs">{clearResult}</p>}
<button onClick={analyse} disabled={loading}
className="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 text-white rounded-lg text-sm font-medium transition-colors">
{loading ? 'Analyse en cours…' : 'Analyser le Sheets'}
</button>
</div>
)}