Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 4x 4x 4x | // A flat's tenancy status on its card on the flats list (Design canvas:
// Asunnot ยท vuokrasuhteen tila): Let, Notice given or Vacant, with the
// tenant's name (openspec: properties, "Listing flats").
import Box from '@mui/material/Box'
import Stack from '@mui/material/Stack'
import Typography from '@mui/material/Typography'
import { formatDayMonth } from '#/lib/format'
import { m } from '#/paraglide/messages.js'
import { colors } from '#/theme/tokens'
import type { CardTenancyStatus } from './tenancies.server'
export function FlatStatusChip(props: { status: CardTenancyStatus }) {
const { status } = props
const [bg, text] =
status.kind === 'let'
? [colors.greenTint, m.tenancy_card_let()]
: status.kind === 'notice_given'
? [
colors.yellowTint,
m.tenancy_status_notice_given({ date: formatDayMonth(status.on) }),
]
: [
colors.lavenderTint,
status.nextStart === null
? m.tenancy_card_vacant()
: m.tenancy_card_starts({
date: formatDayMonth(status.nextStart),
}),
]
return (
<Stack
direction="row"
sx={{ alignItems: 'center', gap: 1, flexWrap: 'wrap' }}
>
<Box
component="span"
sx={{
bgcolor: bg,
borderRadius: 999,
px: 1.25,
py: 0.25,
fontSize: 12,
fontWeight: 900,
}}
>
{text}
</Box>
{status.kind === 'vacant' ? null : (
<Typography
variant="caption"
component="span"
color="text.secondary"
sx={{ fontWeight: 800 }}
>
{status.tenantName}
</Typography>
)}
</Stack>
)
}
|