Small fixes

This commit is contained in:
2025-06-26 23:44:27 +02:00
parent 14f275f2b8
commit 50cc087bed
2 changed files with 45 additions and 43 deletions

View File

@@ -9,7 +9,7 @@ export default function NotFound() {
Link Not Found Link Not Found
</h2> </h2>
<p className="mt-2 text-gray-600 dark:text-gray-400"> <p className="mt-2 text-gray-600 dark:text-gray-400">
The link you're looking for doesn't exist or has expired. The link you&apos;re looking for doesn&apos;t exist or has expired.
</p> </p>
<Link <Link
href="/" href="/"

View File

@@ -238,15 +238,15 @@ export function UrlsDataTable({ data }: UrlsDataTableProps) {
const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({}) const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({})
const router = useRouter() const router = useRouter()
function handleCopy(string: string) { const handleCopy = React.useCallback((string: string) => {
navigator.clipboard.writeText(string).then(() => { navigator.clipboard.writeText(string).then(() => {
toast.success("URL copied to clipboard") toast.success("URL copied to clipboard")
}).catch(() => { }).catch(() => {
toast.error("Failed to copy URL") toast.error("Failed to copy URL")
}) })
} }, [])
async function handleDelete(id: string) { const handleDelete = React.useCallback(async (id: string) => {
const res = await deleteUrl(id) const res = await deleteUrl(id)
if (res.error) { if (res.error) {
@@ -255,8 +255,9 @@ export function UrlsDataTable({ data }: UrlsDataTableProps) {
toast.success("URL deleted successfully") toast.success("URL deleted successfully")
router.refresh() router.refresh()
} }
} }, [router])
const tableColumns = React.useMemo(() => {
const actionRow: ColumnDef<UrlRecord> = { const actionRow: ColumnDef<UrlRecord> = {
id: "actions", id: "actions",
enableHiding: false, enableHiding: false,
@@ -297,7 +298,8 @@ export function UrlsDataTable({ data }: UrlsDataTableProps) {
} }
} }
const tableColumns = React.useMemo(() => [...columns, actionRow], [actionRow]) return [...columns, actionRow]
}, [handleCopy, handleDelete])
const table = useReactTable({ const table = useReactTable({
data, data,