import PropTypes from 'prop-types'; import { h, Fragment } from 'preact'; import { DateTime } from '../../shared/components/dateTime'; import { ListingDate } from './rowElements/listingDate'; import { Tags } from './rowElements/tags'; import { Location } from './rowElements/location'; import { ActionButtons } from './rowElements/actionButtons'; export const ListingRow = ({ listing }) => { const bumpedAt = listing.bumped_at ? listing.bumped_at.toString() : null; const isExpired = bumpedAt && !listing.published ? (Date.now() - new Date(bumpedAt).getTime()) / (1000 * 60 * 60 * 24) > 30 : false; const isDraft = bumpedAt ? !isExpired && !listing.published : true; const listingUrl = listing.published ? `${listing.category}/${listing.slug}` : `${listing.id}/edit`; const expiryDate = listing.expires_at ? listing.expires_at.toString() : ''; return (