feat: 🐛
This commit is contained in:
1 parent
1dd2dffed8
commit
b3eceeb78d
7 files changed
+19
-18
No files matched your search
@@ -51,7 +51,7 @@ export function DeleteButton({ produtoId, produtoNome, listaId }: DeleteButtonPr
|
|||||||
<AlertDialogHeader>
|
<AlertDialogHeader>
|
||||||
<AlertDialogTitle>Confirmar exclusão</AlertDialogTitle>
|
<AlertDialogTitle>Confirmar exclusão</AlertDialogTitle>
|
||||||
<AlertDialogDescription>
|
<AlertDialogDescription>
|
||||||
Tem certeza que deseja excluir o produto "{produtoNome}"?
|
Tem certeza que deseja excluir o produto "{produtoNome}"?
|
||||||
Esta ação não pode ser desfeita.
|
Esta ação não pode ser desfeita.
|
||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export function IdInput() {
|
|||||||
} else {
|
} else {
|
||||||
setError('Erro ao acessar/criar lista')
|
setError('Erro ao acessar/criar lista')
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
setError('Erro ao processar solicitação')
|
setError('Erro ao processar solicitação')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export function ListHeader({ listaId }: ListHeaderProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch {
|
||||||
setError('Erro ao processar solicitação')
|
setError('Erro ao processar solicitação')
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { motion } from 'framer-motion'
|
import { motion } from 'framer-motion'
|
||||||
import { useTheme } from 'next-themes'
|
|
||||||
|
|
||||||
export function PageTitle() {
|
export function PageTitle() {
|
||||||
const { theme } = useTheme()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ interface ListaPageProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default async function ListaPage({ params }: ListaPageProps) {
|
export default async function ListaPage({ params }: ListaPageProps) {
|
||||||
const { success, exists } = await verificarLista(params.id);
|
const { success } = await verificarLista(params.id);
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
redirect('/');
|
redirect('/');
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
|
||||||
import { Check, ChevronRight, Circle } from "lucide-react"
|
import { ChevronRight } from "lucide-react"
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
|||||||
+13
-10
@@ -9,7 +9,7 @@ export function cn(...inputs: ClassValue[]) {
|
|||||||
const perfCache = new Map<string, number>()
|
const perfCache = new Map<string, number>()
|
||||||
|
|
||||||
// Debounce utility
|
// Debounce utility
|
||||||
export function debounce<T extends (...args: any[]) => any>(
|
export function debounce<T extends (...args: unknown[]) => unknown>(
|
||||||
func: T,
|
func: T,
|
||||||
wait: number
|
wait: number
|
||||||
): (...args: Parameters<T>) => void {
|
): (...args: Parameters<T>) => void {
|
||||||
@@ -22,21 +22,24 @@ export function debounce<T extends (...args: any[]) => any>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Memoização para cálculos pesados
|
// Memoização para cálculos pesados
|
||||||
export function memoize<T extends (...args: any[]) => any>(
|
export function memoize<TArgs extends unknown[], TResult>(
|
||||||
func: T,
|
func: (...args: TArgs) => TResult,
|
||||||
resolver?: (...args: Parameters<T>) => string
|
resolver?: (...args: TArgs) => string
|
||||||
): T {
|
): typeof func {
|
||||||
const cache = new Map<string, ReturnType<T>>()
|
const cache = new Map<string, TResult>()
|
||||||
|
|
||||||
return ((...args: Parameters<T>) => {
|
return ((...args: TArgs) => {
|
||||||
const key = resolver ? resolver(...args) : JSON.stringify(args)
|
const key = resolver ? resolver(...args) : JSON.stringify(args)
|
||||||
if (cache.has(key)) {
|
const cachedResult = cache.get(key)
|
||||||
return cache.get(key)
|
|
||||||
|
if (cachedResult !== undefined) {
|
||||||
|
return cachedResult
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = func(...args)
|
const result = func(...args)
|
||||||
cache.set(key, result)
|
cache.set(key, result)
|
||||||
return result
|
return result
|
||||||
}) as T
|
}) as typeof func
|
||||||
}
|
}
|
||||||
|
|
||||||
// Medição de performance
|
// Medição de performance
|
||||||
|
|||||||
Reference in new issue
Block a user