Switch to responsive card layout below 1400px for dashboard

Major improvements:
- Replace table with card-based layout below 1400px width
- Cards show ticket ID, title, category, assignee, status, and actions
- Priority indicated by left border color
- Fully responsive from 1400px down to mobile

Mobile improvements (768px and below):
- Cards stack vertically with touch-friendly sizing
- Action buttons are full-width with 44px touch targets
- Meta info displayed in a clean row format
- Removed old table-based mobile styles

Sidebar collapse improvements:
- Collapsed state now truly saves space (0 width, no gap)
- Expand button is compact vertical text

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 11:33:40 -05:00
parent 99a96544cf
commit 79706f790d
2 changed files with 275 additions and 95 deletions

View File

@@ -520,7 +520,7 @@ h1 {
/* ===== INTERMEDIATE RESPONSIVE BREAKPOINTS ===== */ /* ===== INTERMEDIATE RESPONSIVE BREAKPOINTS ===== */
/* Extra large desktop (1600px+) */ /* Extra large desktop (1600px+) - Full table view */
@media (min-width: 1600px) { @media (min-width: 1600px) {
.dashboard-layout { .dashboard-layout {
max-width: 1800px; max-width: 1800px;
@@ -536,8 +536,8 @@ h1 {
} }
} }
/* Large desktop (1200px - 1599px) - Hide some columns to fit */ /* Large desktop (1400px - 1599px) - Slightly compact table */
@media (min-width: 1200px) and (max-width: 1599px) { @media (min-width: 1400px) and (max-width: 1599px) {
.dashboard-layout { .dashboard-layout {
max-width: 100%; max-width: 100%;
padding: 0 0.5rem; padding: 0 0.5rem;
@@ -558,23 +558,136 @@ h1 {
th, td { th, td {
padding: 8px 10px; padding: 8px 10px;
} }
}
/* Hide less important columns on medium-large screens */ /* ===== RESPONSIVE CARD VIEW (below 1400px) ===== */
table th:nth-child(8), /* Switch from table to card layout for better usability */
table td:nth-child(8),
table th:nth-child(10), @media (max-width: 1399px) {
table td:nth-child(10) { /* Hide the table on smaller screens */
.table-wrapper table {
display: none; display: none;
} }
/* Show card view instead */
.table-wrapper {
display: block;
} }
/* Medium-large desktop (1000px - 1199px) - Hide more columns */ /* Card-based ticket list */
@media (min-width: 1000px) and (max-width: 1199px) { .table-wrapper::before {
.dashboard-layout { content: 'Tickets';
max-width: 100%; display: block;
padding: 0 0.5rem; font-family: var(--font-mono);
font-size: 1rem;
color: var(--terminal-amber);
text-shadow: var(--glow-amber);
padding: 0.75rem 1rem;
border-bottom: 2px solid var(--terminal-green);
background: var(--bg-primary);
} }
.ticket-cards {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 0.5rem;
}
.ticket-card-row {
display: grid;
grid-template-columns: auto 1fr auto auto;
gap: 1rem;
align-items: center;
padding: 0.75rem 1rem;
background: var(--bg-secondary);
border: 1px solid var(--terminal-green);
border-left: 4px solid var(--terminal-green);
transition: all 0.2s ease;
}
.ticket-card-row:hover {
background: rgba(0, 255, 65, 0.1);
box-shadow: var(--glow-green);
}
.ticket-card-row.priority-1 { border-left-color: var(--priority-1); }
.ticket-card-row.priority-2 { border-left-color: var(--priority-2); }
.ticket-card-row.priority-3 { border-left-color: var(--priority-3); }
.ticket-card-row.priority-4 { border-left-color: var(--priority-4); }
.ticket-card-row.priority-5 { border-left-color: var(--priority-5); }
.ticket-card-id {
font-family: var(--font-mono);
font-size: 0.85rem;
color: var(--terminal-cyan);
white-space: nowrap;
}
.ticket-card-id a {
color: inherit;
text-decoration: none;
}
.ticket-card-id a:hover {
color: var(--terminal-amber);
text-shadow: var(--glow-amber);
}
.ticket-card-main {
min-width: 0;
}
.ticket-card-title {
font-size: 0.95rem;
color: var(--terminal-green);
margin-bottom: 0.25rem;
word-wrap: break-word;
}
.ticket-card-meta {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
font-size: 0.75rem;
color: var(--text-muted);
}
.ticket-card-meta span {
display: inline-flex;
align-items: center;
gap: 0.25rem;
}
.ticket-card-status {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
font-family: var(--font-mono);
white-space: nowrap;
}
.ticket-card-actions {
display: flex;
gap: 0.25rem;
}
.ticket-card-actions button {
padding: 0.4rem;
min-width: 32px;
min-height: 32px;
background: transparent;
border: 1px solid var(--terminal-green);
color: var(--terminal-green);
cursor: pointer;
font-size: 0.9rem;
}
.ticket-card-actions button:hover {
background: var(--terminal-green);
color: var(--bg-primary);
}
/* Sidebar adjustments */
.dashboard-sidebar { .dashboard-sidebar {
width: 200px; width: 200px;
} }
@@ -582,69 +695,52 @@ h1 {
.stats-widgets .stats-row { .stats-widgets .stats-row {
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
} }
table {
font-size: 0.8rem;
} }
th, td { /* Tablet view (900px - 1399px) */
padding: 6px 8px; @media (min-width: 900px) and (max-width: 1399px) {
} .dashboard-layout {
/* Hide more columns on medium screens */
table th:nth-child(5),
table td:nth-child(5),
table th:nth-child(8),
table td:nth-child(8),
table th:nth-child(9),
table td:nth-child(9),
table th:nth-child(10),
table td:nth-child(10) {
display: none;
}
}
/* Medium desktop (900px - 999px) */
@media (min-width: 900px) and (max-width: 999px) {
.stats-widgets .stats-row {
grid-template-columns: repeat(3, 1fr);
}
.dashboard-toolbar {
flex-wrap: wrap;
gap: 1rem; gap: 1rem;
padding: 0 0.5rem;
} }
.toolbar-center { .ticket-card-row {
order: 3; grid-template-columns: auto 1fr auto auto;
width: 100%; }
justify-content: flex-start;
} }
/* Small tablet (600px - 899px) */
@media (min-width: 600px) and (max-width: 899px) {
.dashboard-sidebar { .dashboard-sidebar {
width: 180px; width: 180px;
} }
table { .stats-widgets .stats-row {
font-size: 0.8rem; grid-template-columns: repeat(2, 1fr);
} }
th, td { .ticket-card-row {
padding: 6px 8px; grid-template-columns: 1fr auto;
grid-template-rows: auto auto;
} }
/* Hide even more columns */ .ticket-card-id {
table th:nth-child(4), grid-column: 1;
table td:nth-child(4), grid-row: 1;
table th:nth-child(5), }
table td:nth-child(5),
table th:nth-child(8), .ticket-card-main {
table td:nth-child(8), grid-column: 1 / -1;
table th:nth-child(9), grid-row: 2;
table td:nth-child(9), }
table th:nth-child(10),
table td:nth-child(10) { .ticket-card-status {
display: none; grid-column: 2;
grid-row: 1;
}
.ticket-card-actions {
display: none; /* Hide on small tablets, access via tap */
} }
} }
@@ -1470,6 +1566,18 @@ button:active {
transform: translateY(-2px); transform: translateY(-2px);
} }
/* ===== RESPONSIVE TICKET CARDS - Hidden on desktop ===== */
.ticket-cards {
display: none;
}
.ticket-card-empty {
padding: 3rem;
text-align: center;
color: var(--terminal-green);
font-family: var(--font-mono);
}
/* ===== TABLE STYLES - TERMINAL EDITION ===== */ /* ===== TABLE STYLES - TERMINAL EDITION ===== */
table { table {
width: 100%; width: 100%;
@@ -5140,7 +5248,7 @@ table td:nth-child(4) {
display: none; /* Hide pagination in toolbar - show at bottom */ display: none; /* Hide pagination in toolbar - show at bottom */
} }
/* ===== TABLE WRAPPER ===== */ /* ===== TICKET CARDS - Mobile optimized ===== */
.ascii-frame-outer { .ascii-frame-outer {
margin: 0.5rem 0; margin: 0.5rem 0;
border-width: 2px; border-width: 2px;
@@ -5162,43 +5270,73 @@ table td:nth-child(4) {
.table-wrapper { .table-wrapper {
width: 100%; width: 100%;
overflow-x: visible;
} }
.table-wrapper table { /* Hide the ::before header on mobile - we use a simpler one */
min-width: auto; .table-wrapper::before {
display: none;
}
/* Mobile-optimized card layout */
.ticket-cards {
padding: 0.25rem;
gap: 0.25rem;
}
.ticket-card-row {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding: 0.75rem;
border-left-width: 4px;
}
.ticket-card-id {
font-size: 0.9rem;
font-weight: bold;
}
.ticket-card-id a {
display: inline-block;
padding: 0.25rem 0;
min-height: 44px;
line-height: 2;
}
.ticket-card-main {
width: 100%; width: 100%;
} }
table { .ticket-card-title {
font-size: 1rem;
line-height: 1.4;
margin-bottom: 0.5rem;
}
.ticket-card-meta {
font-size: 0.8rem;
gap: 0.75rem;
}
.ticket-card-status {
align-self: flex-start;
padding: 0.35rem 0.75rem;
font-size: 0.8rem; font-size: 0.8rem;
} }
table th, .ticket-card-actions {
table td { display: flex;
padding: 0.75rem 0.5rem; gap: 0.5rem;
white-space: normal; margin-top: 0.5rem;
word-wrap: break-word; padding-top: 0.5rem;
border-top: 1px solid rgba(0, 255, 65, 0.2);
} }
/* Make ticket ID and title columns wider */ .ticket-card-actions button {
table th:nth-child(1), flex: 1;
table td:nth-child(1) {
min-width: 100px;
}
table th:nth-child(3),
table td:nth-child(3) {
min-width: 200px;
white-space: normal;
}
/* Link touch targets */
table td a {
display: inline-block;
padding: 0.5rem 0;
min-height: 44px; min-height: 44px;
line-height: 1.5; padding: 0.5rem;
font-size: 1.1rem;
} }
/* ===== BULK ACTIONS ===== */ /* ===== BULK ACTIONS ===== */

View File

@@ -12,11 +12,11 @@ $nonce = SecurityHeadersMiddleware::getNonce();
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ticket Dashboard</title> <title>Ticket Dashboard</title>
<link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png"> <link rel="icon" type="image/png" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/images/favicon.png">
<link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260131b"> <link rel="stylesheet" href="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/css/dashboard.css?v=20260131c">
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/ascii-banner.js"></script> <script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/ascii-banner.js"></script>
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script> <script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/toast.js"></script>
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js?v=20260131b"></script> <script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/markdown.js?v=20260131c"></script>
<script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/dashboard.js?v=20260131b"></script> <script nonce="<?php echo $nonce; ?>" src="<?php echo $GLOBALS['config']['ASSETS_URL']; ?>/js/dashboard.js?v=20260131c"></script>
<script nonce="<?php echo $nonce; ?>"> <script nonce="<?php echo $nonce; ?>">
// CSRF Token for AJAX requests // CSRF Token for AJAX requests
window.CSRF_TOKEN = '<?php echo CsrfMiddleware::getToken(); ?>'; window.CSRF_TOKEN = '<?php echo CsrfMiddleware::getToken(); ?>';
@@ -489,6 +489,48 @@ $nonce = SecurityHeadersMiddleware::getNonce();
?> ?>
</tbody> </tbody>
</table> </table>
<!-- Responsive Card View (shown on smaller screens via CSS) -->
<div class="ticket-cards">
<?php
if (count($tickets) > 0) {
foreach($tickets as $row) {
$creator = $row['creator_display_name'] ?? $row['creator_username'] ?? 'System';
$assignedTo = $row['assigned_display_name'] ?? $row['assigned_username'] ?? 'Unassigned';
$statusClass = 'status-' . str_replace(' ', '-', $row['status']);
?>
<div class="ticket-card-row priority-<?php echo $row['priority']; ?>">
<div class="ticket-card-id">
<a href="/ticket/<?php echo $row['ticket_id']; ?>">#<?php echo $row['ticket_id']; ?></a>
</div>
<div class="ticket-card-main">
<div class="ticket-card-title"><?php echo htmlspecialchars($row['title']); ?></div>
<div class="ticket-card-meta">
<span>📁 <?php echo htmlspecialchars($row['category']); ?></span>
<span>👤 <?php echo htmlspecialchars($assignedTo); ?></span>
<span>📅 <?php echo date('M j', strtotime($row['updated_at'])); ?></span>
</div>
</div>
<div class="ticket-card-status <?php echo $statusClass; ?>">
<?php echo $row['status']; ?>
</div>
<div class="ticket-card-actions">
<button data-action="view-ticket" data-ticket-id="<?php echo $row['ticket_id']; ?>" title="View">👁</button>
<button data-action="quick-status" data-ticket-id="<?php echo $row['ticket_id']; ?>" data-status="<?php echo $row['status']; ?>" title="Status">🔄</button>
</div>
</div>
<?php
}
} else {
?>
<div class="ticket-card-empty">
<span>No tickets found</span>
</div>
<?php
}
?>
</div>
</div><!-- End table-wrapper --> </div><!-- End table-wrapper -->
</div> </div>
</div> </div>