diff --git a/xian_favor/api.py b/xian_favor/api.py index fb11418..fd4a123 100644 --- a/xian_favor/api.py +++ b/xian_favor/api.py @@ -188,9 +188,14 @@ INDEX_TEMPLATE = ''' .sidebar a { color: #adb5bd; text-decoration: none; padding: 10px 20px; display: block; } .sidebar a:hover, .sidebar a.active { background: #495057; color: #fff; } .content { padding: 20px; } - .card { margin-bottom: 15px; transition: transform 0.2s; } + .card { margin-bottom: 8px; transition: transform 0.2s; } .card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); } + .card-body { padding: 10px 15px; } .tag { margin-right: 5px; } + .item-card { font-size: 14px; } + .item-card h6 { font-size: 14px; margin-bottom: 4px; } + .item-card p { margin-bottom: 4px; } + .item-card .text-muted.small { font-size: 12px; } .type-text { border-left: 4px solid #17a2b8; } .type-link { border-left: 4px solid #28a745; } .type-column { border-left: 4px solid #6f42c1; } @@ -534,34 +539,22 @@ function renderItems(items) { } container.innerHTML = items.map(item => ` -
+
-
-
-
- ${getTypeIcon(item.type)} ${item.title || truncate(item.content || item.url, 50)} +
+
+
+ ${getTypeIcon(item.type)} ${item.title || truncate(item.content || item.url, 30)}
-

- ${item.url ? `${item.url}
` : ''} - ${item.content ? truncate(item.content, 100) : ''} -

-
- ${item.tags.map(t => `${t}`).join('')} - ${item.type === 'todo' ? ` - ${getStatusLabel(item.status)} - ${getPriorityLabel(item.priority)} - ${item.due_date ? `๐Ÿ“… ${item.due_date}` : ''} - ` : ''} -
-
- - ${item.type === 'todo' && item.status !== 'completed' ? - `` : ''} - +
+ ${item.tags.slice(0, 3).map(t => `${t}`).join('')} + ${item.type === 'todo' ? `${getStatusLabelShort(item.status)}` : ''} + + ${item.type === 'todo' && item.status !== 'completed' ? `` : ''} +
-
${formatDate(item.created_at)}
`).join(''); @@ -768,6 +761,11 @@ function getStatusLabel(status) { return labels[status] || status; } +function getStatusLabelShort(status) { + const labels = { pending: 'โณ', in_progress: '๐Ÿ”„', completed: 'โœ…' }; + return labels[status] || status; +} + function getPriorityLabel(priority) { const labels = { low: '๐ŸŸข ไฝŽ', medium: '๐ŸŸก ไธญ', high: '๐ŸŸ  ้ซ˜', urgent: '๐Ÿ”ด ็ดงๆ€ฅ' }; return labels[priority] || priority;