import React from 'react' import { formatDateTime } from '../utils/date.js' import { Link } from 'react-router-dom' export function JobsTable({ jobs, isLoading }) { if (isLoading) { const skeletonRows = Array.from({ length: 8 }) return (
{skeletonRows.map((_, idx) => ( ))}
Title Company Location Salary Inserted
) } function formatSalary(salary) { if (!salary || (salary.min == null && salary.max == null)) return '—' const a = typeof salary.min === 'number' ? `€${salary.min.toLocaleString()}` : null const b = typeof salary.max === 'number' ? `€${salary.max.toLocaleString()}` : null if (a && b) return `${a} - ${b}` return a || b || '—' } return (
{jobs.map((j, idx) => ( ))}
Title Company Location Salary Inserted
{Boolean(j?.isTop5) && } {j?.title || '—'}
{j?.company || '—'} {j?.location || '—'} {formatSalary(j?.salary)} {j?.datetimeInserted ? formatDateTime(j.datetimeInserted) : '—'} {j?.id ? ( View ) : ( View )}
) }