- Création lib/platformCommissions.ts : configuration centralisée des commissions - Articles : 800 sats (700 auteur, 100 plateforme) - Avis : 70 sats (49 lecteur, 21 plateforme) - Sponsoring : 0.046 BTC (0.042 auteur, 0.004 plateforme) - Validation des montants à chaque étape : - Publication : vérification du montant avant publication - Paiement : vérification du montant avant acceptation - Erreurs explicites si montant incorrect - Tracking des commissions sur Nostr : - Tags author_amount et platform_commission dans événements - Interface ContentDeliveryTracking étendue - Traçabilité complète pour audit - Logs structurés avec informations de commission - Documentation complète du système Les commissions sont maintenant systématiques, validées et traçables.
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { useState, useEffect } from 'react'
|
|
import { SearchIcon } from './SearchIcon'
|
|
import { ClearButton } from './ClearButton'
|
|
|
|
interface SearchBarProps {
|
|
value: string
|
|
onChange: (value: string) => void
|
|
placeholder?: string
|
|
}
|
|
|
|
export function SearchBar({ value, onChange, placeholder = 'Search articles...' }: SearchBarProps) {
|
|
const [localValue, setLocalValue] = useState(value)
|
|
|
|
useEffect(() => {
|
|
setLocalValue(value)
|
|
}, [value])
|
|
|
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
const newValue = e.target.value
|
|
setLocalValue(newValue)
|
|
onChange(newValue)
|
|
}
|
|
|
|
const handleClear = () => {
|
|
setLocalValue('')
|
|
onChange('')
|
|
}
|
|
|
|
return (
|
|
<div className="relative">
|
|
<div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<SearchIcon />
|
|
</div>
|
|
<input
|
|
type="text"
|
|
value={localValue}
|
|
onChange={handleChange}
|
|
placeholder={placeholder}
|
|
className="block w-full pl-10 pr-10 py-2 border border-neon-cyan/30 rounded-lg focus:ring-2 focus:ring-neon-cyan focus:border-neon-cyan bg-cyber-dark text-cyber-accent placeholder-cyber-accent/50 hover:border-neon-cyan/50 transition-colors"
|
|
/>
|
|
{localValue && <ClearButton onClick={handleClear} />}
|
|
</div>
|
|
)
|
|
}
|