@@ -15,7 +15,8 @@ import {
1515 TableRow ,
1616} from "@/shared/ui/table" ;
1717import { cn } from "@/shared/lib/utils" ;
18- import type { Job , JobsMeta } from "@/domains/jobs/domain/job.types" ;
18+ import type { Job } from "@/domains/jobs/domain/job.types" ;
19+ import type { JobsPaginationMeta } from "@/domains/jobs/application/useJobsData" ;
1920import { useState } from "react" ;
2021import {
2122 FiCheckSquare ,
@@ -25,12 +26,12 @@ import {
2526} from "react-icons/fi" ;
2627
2728interface JobsTableCardProps {
28- meta : JobsMeta ;
29+ meta : JobsPaginationMeta ;
2930 filteredJobs : Job [ ] ;
3031 paginatedJobs : Job [ ] ;
3132 loading : boolean ;
3233 error : string ;
33- formatDate : ( timestamp : JobsMeta [ "modifiedAt" ] ) => string ;
34+ formatDate : ( ) => string ;
3435 currentPage : number ;
3536 totalPages : number ;
3637 pageSize : number ;
@@ -80,8 +81,8 @@ function getPaginationItems(
8081
8182function getJobId ( job : Job , index : number ) {
8283 return (
83- job . link ?. trim ( ) ||
84- [ job . titulo , job . empresa , job . local , String ( index ) ]
84+ job . url ?. trim ( ) ||
85+ [ job . title , job . company , job . location , String ( index ) ]
8586 . filter ( Boolean )
8687 . join ( "|" )
8788 ) ;
@@ -130,7 +131,6 @@ export function JobsTableCard({
130131 paginatedJobs,
131132 loading,
132133 error,
133- formatDate,
134134 currentPage,
135135 totalPages,
136136 pageSize,
@@ -139,7 +139,7 @@ export function JobsTableCard({
139139} : JobsTableCardProps ) {
140140 const [ spamMarks , setSpamMarks ] = useState < Record < string , boolean > > ( { } ) ;
141141 const [ readMarks , setReadMarks ] = useState < Record < string , boolean > > ( { } ) ;
142- const resultsLabel = getResultsLabel ( filteredJobs . length ) ;
142+ const resultsLabel = getResultsLabel ( meta . total ) ;
143143 const paginationItems = getPaginationItems ( currentPage , totalPages ) ;
144144
145145 return (
@@ -177,28 +177,28 @@ export function JobsTableCard({
177177 < TableBody >
178178 { paginatedJobs . map ( ( job , index ) => {
179179 const jobId = getJobId ( job , index ) ;
180- const keywords = getKeywordTags ( job . palavra ) ;
180+ const keywords = getKeywordTags ( job . keyword ) ;
181181 const isSpamMarked = Boolean ( spamMarks [ jobId ] ) ;
182182 const isReadMarked = Boolean ( readMarks [ jobId ] ) ;
183183
184184 return (
185185 < TableRow key = { jobId } >
186186 < TableCell className = "font-medium" >
187- { job . link ? (
187+ { job . url ? (
188188 < a
189- href = { job . link }
189+ href = { job . url }
190190 target = "_blank"
191191 rel = "noreferrer"
192192 className = "text-primary underline-offset-4 hover:underline dark:text-[#14AE5C]"
193193 >
194- { job . titulo || "Abrir vaga" }
194+ { job . title || "Abrir vaga" }
195195 </ a >
196196 ) : (
197- job . titulo || "-"
197+ job . title || "-"
198198 ) }
199199 </ TableCell >
200- < TableCell > { job . empresa || "-" } </ TableCell >
201- < TableCell > { job . local || "-" } </ TableCell >
200+ < TableCell > { job . company || "-" } </ TableCell >
201+ < TableCell > { job . location || "-" } </ TableCell >
202202 < TableCell >
203203 { keywords . length > 0 ? (
204204 < div className = "flex flex-wrap gap-1 text-sm text-foreground/85" >
@@ -220,7 +220,7 @@ export function JobsTableCard({
220220 </ TableCell >
221221 < TableCell className = "text-center align-middle" >
222222 < StatusToggleButton
223- label = { `Marcar vaga como spam para ${ job . titulo || "vaga" } ` }
223+ label = { `Marcar vaga como spam para ${ job . title || "vaga" } ` }
224224 pressed = { isSpamMarked }
225225 activeClassName = "text-[#0c6b35]"
226226 onClick = { ( ) =>
@@ -233,7 +233,7 @@ export function JobsTableCard({
233233 </ TableCell >
234234 < TableCell className = "text-center align-middle" >
235235 < StatusToggleButton
236- label = { `Marcar vaga como lida para ${ job . titulo || "vaga" } ` }
236+ label = { `Marcar vaga como lida para ${ job . title || "vaga" } ` }
237237 pressed = { isReadMarked }
238238 activeClassName = "text-[#0c6b35]"
239239 onClick = { ( ) =>
@@ -277,7 +277,6 @@ export function JobsTableCard({
277277 < div className = "mt-4 border-t border-border/60 pt-4" >
278278 < p className = "text-sm text-muted-foreground" >
279279 < span className = "font-medium text-foreground" > { resultsLabel } </ span >
280- < span > (Atualizado em { formatDate ( meta . modifiedAt ) } )</ span >
281280 </ p >
282281
283282 < div className = "mt-3 flex flex-col gap-3 md:flex-row md:items-center md:justify-between" >
@@ -360,7 +359,7 @@ export function JobsTableCard({
360359 onClick = { ( ) =>
361360 onPageChange ( Math . min ( totalPages , currentPage + 1 ) )
362361 }
363- disabled = { currentPage === totalPages }
362+ disabled = { currentPage === totalPages || totalPages === 0 }
364363 className = "flex h-9 min-w-9 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40"
365364 >
366365 < FiChevronRight className = "h-4 w-4" />
@@ -371,4 +370,4 @@ export function JobsTableCard({
371370 </ CardContent >
372371 </ Card >
373372 ) ;
374- }
373+ }
0 commit comments