fin du refactp

This commit is contained in:
Tom Boullay
2026-04-14 14:27:50 +02:00
parent e9ae6ffc41
commit f9e15d5e1f
18 changed files with 826 additions and 476 deletions
+36
View File
@@ -0,0 +1,36 @@
'use client'
import { useState, useCallback } from 'react'
export function useSecret() {
const [secret, setSecret] = useState('')
const [secretError, setSecretError] = useState<string | null>(null)
const [secretVisible, setSecretVisible] = useState(false)
const isSecretEmpty = !secret.trim()
const handleSecretChange = useCallback((value: string) => {
setSecret(value)
if (secretError) setSecretError(null)
}, [secretError])
const toggleSecretVisible = useCallback(() => {
setSecretVisible((v) => !v)
}, [])
const clearSecretError = useCallback(() => {
setSecretError(null)
}, [])
return {
secret,
secretError,
secretVisible,
isSecretEmpty,
setSecret,
setSecretError,
handleSecretChange,
toggleSecretVisible,
clearSecretError,
}
}