feat(ui): hide spoiler banner, anonymize claims, optional guest name, list wishlists on home, drop esgotados toggle

This commit is contained in:
belisards
2026-05-03 16:53:48 -03:00
parent ce7731cebb
commit c959cc8829
6 changed files with 43 additions and 65 deletions

View File

@@ -19,7 +19,6 @@ function PublicWishlistContent() {
const params = useParams();
const [wishlist, setWishlist] = useState<Wishlist | null>(null);
const [items, setItems] = useState<Item[]>([]);
const [showClaimed, setShowClaimed] = useState(false);
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState('');
@@ -121,12 +120,10 @@ function PublicWishlistContent() {
}
};
const filteredItems = showClaimed
? items
: items.filter((item) => {
const my = myClaimFor(item);
return item.remainingQuantity > 0 || my || item.id === justClaimedItemId;
});
const filteredItems = items.filter((item) => {
const my = myClaimFor(item);
return item.remainingQuantity > 0 || my || item.id === justClaimedItemId;
});
const formatPrice = (price: number | null, currency: string) => {
if (!price) return null;
@@ -208,18 +205,7 @@ function PublicWishlistContent() {
)}
{/* Controls */}
<div className="mb-6 flex items-center justify-between">
<div className="flex items-center space-x-4">
<label className="flex items-center">
<input
type="checkbox"
checked={showClaimed}
onChange={(e) => setShowClaimed(e.target.checked)}
className="h-4 w-4 text-blue-600 border-gray-300 rounded"
/>
<span className="ml-2 text-sm text-gray-700 dark:text-gray-300">Mostrar itens esgotados</span>
</label>
</div>
<div className="mb-6 flex items-center justify-end">
<div className="text-sm text-gray-600 dark:text-gray-400">
{filteredItems.length} de {items.length} itens
</div>
@@ -229,7 +215,7 @@ function PublicWishlistContent() {
{filteredItems.length === 0 ? (
<div className="text-center py-12 bg-white dark:bg-gray-800 rounded-lg shadow">
<p className="text-gray-500 dark:text-gray-400">
{showClaimed ? 'Nenhum item nesta lista ainda' : 'Todos os itens já foram reservados!'}
Todos os itens foram reservados!
</p>
</div>
) : (
@@ -282,9 +268,9 @@ function PublicWishlistContent() {
return (
<li key={c.id} className="flex items-center justify-between gap-2">
<div>
<span className="font-medium">{c.guest.name}</span>
<span className="font-medium">{isMine ? 'Você' : 'Reservado'}</span>
<span className="text-gray-500"> · {c.quantity} un.</span>
{c.note && (
{c.note && isMine && (
<span className="block text-xs italic text-gray-500">
&quot;{c.note}&quot;
</span>