da50f3b5ea
- Design tokens (ds.ts, theme.ts, scoreTheme.ts): new warm palette (#152642 navy, #f9f8f6 warm white, #e8e7e4 borders, #b8975a gold accent), flat score tier badges replacing CSS gradients, Inter + DM Serif Display typography - Card components: white-background cards, DM Serif score numbers, max-2 badge chips with +N overflow tooltip, editorial score badge positioning - Layout shell: gold left-accent nav active state, 64px top bar, outlined workspace chip, DM Serif page titles - Shared atoms: GenericBadge (outlined/solid variants), ResultFilterBar (simplified chip styles), DecisionContextPanel (dot metrics, no left accent) - Global replacement (118 files): #1e3a5f→#152642, #e2e8f0→#e8e7e4, #f4f6f9→#f9f8f6 — all handled via Node.js for proper UTF-8 safety Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
153 lines
4.4 KiB
TypeScript
153 lines
4.4 KiB
TypeScript
import { Box, Typography } from '@mui/material'
|
|
import { Paperclip } from 'lucide-react'
|
|
import type { InquiryMessage } from '../../domain/inquiry'
|
|
import { formatInquiryDate, formatFileSize } from './inquiryUtils'
|
|
|
|
interface InquiryMessageBubbleProps {
|
|
message: InquiryMessage
|
|
}
|
|
|
|
export function InquiryMessageBubble({ message }: InquiryMessageBubbleProps) {
|
|
const isTenant = message.senderType === 'tenant'
|
|
const isSupply = message.senderType === 'supply_user'
|
|
const isSystemOrAi = message.senderType === 'system' || message.senderType === 'ai'
|
|
|
|
if (isSystemOrAi) {
|
|
return (
|
|
<Box sx={{ display: 'flex', justifyContent: 'center', my: 1 }}>
|
|
<Typography
|
|
variant="caption"
|
|
sx={{
|
|
color: '#64748b',
|
|
fontStyle: 'italic',
|
|
bgcolor: '#f1f5f9',
|
|
px: 2,
|
|
py: 0.5,
|
|
borderRadius: 4,
|
|
fontSize: '0.75rem',
|
|
}}
|
|
>
|
|
{message.senderName}: {message.body}
|
|
</Typography>
|
|
</Box>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Box sx={{ display: 'flex', justifyContent: isTenant ? 'flex-start' : 'flex-end', mb: 1.5 }}>
|
|
<Box
|
|
sx={{
|
|
maxWidth: '75%',
|
|
bgcolor: isTenant ? '#f1f5f9' : '#152642',
|
|
color: isTenant ? '#0f172a' : 'white',
|
|
px: 1.75,
|
|
py: 1.25,
|
|
borderRadius: 2,
|
|
boxShadow: '0 1px 2px rgba(15,23,42,0.06)',
|
|
}}
|
|
>
|
|
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 1.5, mb: 0.5 }}>
|
|
<Typography
|
|
variant="caption"
|
|
sx={{
|
|
fontWeight: 600,
|
|
fontSize: '0.75rem',
|
|
color: isTenant ? '#0f172a' : 'white',
|
|
}}
|
|
>
|
|
{message.senderName}
|
|
</Typography>
|
|
<Typography
|
|
variant="caption"
|
|
sx={{
|
|
fontSize: '0.7rem',
|
|
color: isTenant ? '#64748b' : 'rgba(255,255,255,0.7)',
|
|
}}
|
|
>
|
|
{formatInquiryDate(message.createdAt)}
|
|
</Typography>
|
|
</Box>
|
|
{message.subject && (
|
|
<Typography
|
|
variant="caption"
|
|
sx={{
|
|
display: 'block',
|
|
fontWeight: 600,
|
|
fontSize: '0.75rem',
|
|
color: isTenant ? '#334155' : 'rgba(255,255,255,0.85)',
|
|
mb: 0.5,
|
|
}}
|
|
>
|
|
{message.subject}
|
|
</Typography>
|
|
)}
|
|
<Typography
|
|
variant="body2"
|
|
sx={{
|
|
whiteSpace: 'pre-wrap',
|
|
fontSize: '0.85rem',
|
|
lineHeight: 1.5,
|
|
color: isTenant ? '#0f172a' : 'white',
|
|
}}
|
|
>
|
|
{message.body}
|
|
</Typography>
|
|
|
|
{message.attachments.length > 0 && (
|
|
<Box sx={{ mt: 1, display: 'flex', flexDirection: 'column', gap: 0.5 }}>
|
|
{message.attachments.map(att => (
|
|
<Box
|
|
key={att.id}
|
|
sx={{
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
gap: 0.75,
|
|
bgcolor: isTenant ? 'white' : 'rgba(255,255,255,0.12)',
|
|
border: '1px solid',
|
|
borderColor: isTenant ? '#cbd5e1' : 'rgba(255,255,255,0.25)',
|
|
px: 1,
|
|
py: 0.5,
|
|
borderRadius: 1,
|
|
fontSize: '0.75rem',
|
|
}}
|
|
>
|
|
<Paperclip size={12} />
|
|
<Typography variant="caption" sx={{ fontSize: '0.75rem', fontWeight: 500 }}>
|
|
{att.fileName}
|
|
</Typography>
|
|
{att.fileSize && (
|
|
<Typography
|
|
variant="caption"
|
|
sx={{
|
|
fontSize: '0.7rem',
|
|
color: isTenant ? '#64748b' : 'rgba(255,255,255,0.65)',
|
|
ml: 'auto',
|
|
}}
|
|
>
|
|
{formatFileSize(att.fileSize)}
|
|
</Typography>
|
|
)}
|
|
</Box>
|
|
))}
|
|
</Box>
|
|
)}
|
|
|
|
{isSupply && (
|
|
<Typography
|
|
variant="caption"
|
|
sx={{
|
|
display: 'block',
|
|
fontSize: '0.65rem',
|
|
color: 'rgba(255,255,255,0.6)',
|
|
mt: 0.75,
|
|
textAlign: 'right',
|
|
}}
|
|
>
|
|
Wincasa AG
|
|
</Typography>
|
|
)}
|
|
</Box>
|
|
</Box>
|
|
)
|
|
}
|