General Journal: inline badge+name, robust column widths
- Moved account type badge into the Description/Account cell, inline with the account name. Badge and name are now in the same column as the transaction description, creating natural visual alignment. - Widened balance column to 120px, added whiteSpace: nowrap + overflow: hidden on all numeric columns to prevent layout breakage with large numbers. - Trimmed Tx# column to 55px. Made-with: Cursor
This commit is contained in:
@@ -91,12 +91,12 @@ export default function GeneralJournalTab() {
|
||||
<TableContainer component={Paper} elevation={2}>
|
||||
<Table size="small" sx={{ tableLayout: 'fixed', '& td, & th': { py: 0.4, fontSize: 13 } }}>
|
||||
<colgroup>
|
||||
<col style={{ width: 60 }} />
|
||||
<col style={{ width: 55 }} />
|
||||
<col style={{ width: 130 }} />
|
||||
<col />
|
||||
<col style={{ width: 100 }} />
|
||||
<col style={{ width: 100 }} />
|
||||
<col style={{ width: 110 }} />
|
||||
<col style={{ width: 105 }} />
|
||||
<col style={{ width: 105 }} />
|
||||
<col style={{ width: 120 }} />
|
||||
</colgroup>
|
||||
<TableHead>
|
||||
<TableRow sx={{ bgcolor: 'primary.main' }}>
|
||||
@@ -143,25 +143,26 @@ export default function GeneralJournalTab() {
|
||||
...tx.rows.map(row => (
|
||||
<TableRow key={`row-${row.rowId}`} hover>
|
||||
<TableCell />
|
||||
<TableCell sx={{ textAlign: 'right', pr: '4px !important' }}>
|
||||
<Chip
|
||||
label={row.accountType}
|
||||
size="small"
|
||||
variant="outlined"
|
||||
sx={{ fontSize: 10, height: 18, minWidth: 48 }}
|
||||
color={
|
||||
row.accountType === 'Asset' ? 'success' :
|
||||
row.accountType === 'Debt' ? 'error' :
|
||||
row.accountType === 'Income' ? 'info' : 'warning'
|
||||
}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', pl: '4px !important' }}>
|
||||
<Tooltip title={row.accountName} placement="top-start">
|
||||
<Typography component="span" variant="body2" sx={{ fontSize: 13, color: 'text.secondary' }}>
|
||||
{row.accountName}
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
<TableCell />
|
||||
<TableCell sx={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
|
||||
<Box sx={{ display: 'inline-flex', alignItems: 'center', gap: 0.75 }}>
|
||||
<Chip
|
||||
label={row.accountType}
|
||||
size="small"
|
||||
variant="outlined"
|
||||
sx={{ fontSize: 10, height: 18, minWidth: 48, flexShrink: 0 }}
|
||||
color={
|
||||
row.accountType === 'Asset' ? 'success' :
|
||||
row.accountType === 'Debt' ? 'error' :
|
||||
row.accountType === 'Income' ? 'info' : 'warning'
|
||||
}
|
||||
/>
|
||||
<Tooltip title={row.accountName} placement="top-start">
|
||||
<Typography component="span" variant="body2" sx={{ fontSize: 13, color: 'text.secondary' }}>
|
||||
{row.accountName}
|
||||
</Typography>
|
||||
</Tooltip>
|
||||
</Box>
|
||||
{row.foreignCurrencyCode && (
|
||||
<Chip label={`${row.foreignCurrencyCode} ${formatCents(Math.abs(row.foreignCurrencyAmountCents))}`}
|
||||
size="small" variant="outlined" sx={{ ml: 1, fontSize: 10, height: 18 }} />
|
||||
@@ -169,12 +170,14 @@ export default function GeneralJournalTab() {
|
||||
</TableCell>
|
||||
<TableCell align="right" sx={{
|
||||
fontFamily: '"Roboto Mono", monospace',
|
||||
whiteSpace: 'nowrap', overflow: 'hidden',
|
||||
color: row.debitCents > 0 ? 'text.primary' : 'text.disabled',
|
||||
}}>
|
||||
{row.debitCents > 0 ? formatCents(row.debitCents) : ''}
|
||||
</TableCell>
|
||||
<TableCell align="right" sx={{
|
||||
fontFamily: '"Roboto Mono", monospace',
|
||||
whiteSpace: 'nowrap', overflow: 'hidden',
|
||||
color: row.creditCents > 0 ? 'error.main' : 'text.disabled',
|
||||
}}>
|
||||
{row.creditCents > 0 ? formatCents(row.creditCents) : ''}
|
||||
@@ -182,6 +185,8 @@ export default function GeneralJournalTab() {
|
||||
<TableCell align="right" sx={{
|
||||
fontFamily: '"Roboto Mono", monospace',
|
||||
fontSize: 12,
|
||||
whiteSpace: 'nowrap',
|
||||
overflow: 'hidden',
|
||||
color: row.balanceCents < 0 ? 'error.main' : 'text.secondary',
|
||||
}}>
|
||||
{formatCents(row.balanceCents)}
|
||||
|
||||
Reference in New Issue
Block a user