refactor(dashboard,styles): improve layout and styling; update database

- Enhanced item actions layout in dashboard for better alignment and usability.
- Updated CSS styles for queue items, buttons, and filter groups to improve responsiveness and aesthetics.
- Modified database to reflect recent changes in the application.
This commit is contained in:
2025-09-27 14:06:31 +08:00
parent adffc18a2f
commit fd7d3a9635
5 changed files with 65 additions and 17 deletions

Binary file not shown.

View File

@@ -535,11 +535,11 @@ const cycleStatus = async (reportId) => {
<span className="time-ago">{dayjs(r.createdAt).fromNow()}</span> <span className="time-ago">{dayjs(r.createdAt).fromNow()}</span>
</div> </div>
</div> </div>
<div className="item-actions" style={{display:'flex',flexDirection:'column',gap:8,alignItems:'flex-end'}}> <div className="item-actions" style={{display:'flex',flexDirection:'row',gap:8,alignItems:'center',justifyContent:'flex-end',minWidth:'120px'}}>
<select value={r.status} onChange={(e)=> updateTicketStatus(r.id, e.target.value)}> <select value={r.status} onChange={(e)=> updateTicketStatus(r.id, e.target.value)} style={{fontSize:'12px',padding:'4px 8px'}}>
{availableStatuses.map(s => <option key={s} value={s}>{t(`status.${s}`) || s}</option>)} {availableStatuses.map(s => <option key={s} value={s}>{t(`status.${s}`) || s}</option>)}
</select> </select>
<button className="btn ghost" onClick={()=> { setSelected(r); }}>{t('btn.view') || 'View'}</button> <button className="btn ghost" onClick={()=> { setSelected(r); }} style={{fontSize:'12px',padding:'4px 12px',whiteSpace:'nowrap'}}>{t('btn.view') || 'View'}</button>
</div> </div>
</div> </div>
))} ))}
@@ -585,7 +585,7 @@ const cycleStatus = async (reportId) => {
<div className="drawer-body"> <div className="drawer-body">
<p style={{marginTop:8}}><strong>{t('drawer.details') || 'Details'}</strong></p> <p style={{marginTop:8}}><strong>{t('drawer.details') || 'Details'}</strong></p>
{selected.notes ? <p>{selected.notes}</p> : <p style={{opacity:0.7}}>{t('drawer.noNotes') || 'No additional notes'}</p>} {selected.notes ? <p>{selected.notes}</p> : <p style={{opacity:0.7}}>{t('drawer.noNotes') || 'No additional notes'}</p>}
<p><strong>{t('label.submittedBy') || 'Submitted by'}:</strong> {selected.userName || (t('label.guest') || 'Guest')}</p> <p><strong>{t('label.submittedBy') || 'Submitted by'}:</strong> {selected.userName && !selected.userName.startsWith('Guest-') ? selected.userName : (t('label.anonymous') || 'Anonymous User')}</p>
<p><strong>{t('label.place') || 'Place'}:</strong> {selected.address ? selected.address : `${selected.location.lat.toFixed(5)}, ${selected.location.lng.toFixed(5)}`}</p> <p><strong>{t('label.place') || 'Place'}:</strong> {selected.address ? selected.address : `${selected.location.lat.toFixed(5)}, ${selected.location.lng.toFixed(5)}`}</p>
<p><strong>{t('label.location') || 'Location'}:</strong> {selected.location.lat.toFixed(5)}, {selected.location.lng.toFixed(5)}</p> <p><strong>{t('label.location') || 'Location'}:</strong> {selected.location.lat.toFixed(5)}, {selected.location.lng.toFixed(5)}</p>
<p><strong>{t('label.createdAt') || 'Created'}:</strong> {dayjs(selected.createdAt).format('YYYY-MM-DD HH:mm')}</p> <p><strong>{t('label.createdAt') || 'Created'}:</strong> {dayjs(selected.createdAt).format('YYYY-MM-DD HH:mm')}</p>

View File

@@ -13,6 +13,9 @@
"label.language": "Language", "label.language": "Language",
"label.location": "Location", "label.location": "Location",
"label.createdAt": "Created At", "label.createdAt": "Created At",
"label.submittedBy": "Submitted by",
"label.place": "Place",
"label.anonymous": "Anonymous User",
"filter.category": "Category", "filter.category": "Category",
"filter.severity": "Severity", "filter.severity": "Severity",
"filter.status": "Status", "filter.status": "Status",

View File

@@ -13,6 +13,9 @@
"label.language": "Bahasa", "label.language": "Bahasa",
"label.location": "Lokasi", "label.location": "Lokasi",
"label.createdAt": "Dicipta Pada", "label.createdAt": "Dicipta Pada",
"label.submittedBy": "Dihantar oleh",
"label.place": "Tempat",
"label.anonymous": "Pengguna Tanpa Nama",
"filter.category": "Kategori", "filter.category": "Kategori",
"filter.severity": "Keparahan", "filter.severity": "Keparahan",
"filter.status": "Status", "filter.status": "Status",

View File

@@ -82,7 +82,7 @@ body{
/* main area */ /* main area */
.main{ .main{
display:grid; display:grid;
grid-template-columns:300px 1fr 340px; grid-template-columns:300px 1fr 400px;
gap:12px; gap:12px;
align-items:stretch; align-items:stretch;
flex:1; flex:1;
@@ -114,6 +114,7 @@ body{
background:#fafbfc; background:#fafbfc;
border-radius:8px; border-radius:8px;
border:1px solid #e5e7eb; border:1px solid #e5e7eb;
overflow:hidden;
} }
.filter-group:last-child{margin-bottom:0;} .filter-group:last-child{margin-bottom:0;}
.checkbox-row{ .checkbox-row{
@@ -240,11 +241,11 @@ button.chip[aria-pressed="true"]{
.map-panel.no-reports .map-empty{display:flex} .map-panel.no-reports .map-empty{display:flex}
/* queue list */ /* queue list */
.queue-list{display:flex;flex-direction:column;gap:8px;overflow:auto;padding-right:6px} .queue-list{display:flex;flex-direction:column;gap:8px;overflow:auto;padding-right:6px;max-height:calc(100vh - 200px)}
.queue-item{display:flex;align-items:center;gap:12px;padding:8px;border-radius:8px;border:1px solid #eef2f7;background:linear-gradient(180deg,#fff,#fbfdff)} .queue-item{display:flex;align-items:center;gap:12px;padding:8px;border-radius:8px;border:1px solid #eef2f7;background:linear-gradient(180deg,#fff,#fbfdff);min-height:48px}
.thumb{width:56px;height:56px;border-radius:6px;background:linear-gradient(180deg,#eef2ff,#fff);display:flex;align-items:center;justify-content:center;color:#0f172a;font-weight:700} .thumb{width:56px;height:56px;border-radius:6px;background:linear-gradient(180deg,#eef2ff,#fff);display:flex;align-items:center;justify-content:center;color:#0f172a;font-weight:700;flex-shrink:0}
.item-main{flex:1;min-width:0} .item-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
.item-title{font-weight:600;text-overflow:ellipsis;overflow:hidden;white-space:nowrap} .item-title{font-weight:600;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-size:14px}
.item-title.clickable{ .item-title.clickable{
cursor:pointer; cursor:pointer;
transition:all 0.2s ease; transition:all 0.2s ease;
@@ -258,8 +259,18 @@ button.chip[aria-pressed="true"]{
transform:translateY(-1px); transform:translateY(-1px);
box-shadow:0 2px 8px rgba(14,165,164,0.15); box-shadow:0 2px 8px rgba(14,165,164,0.15);
} }
.item-meta{display:flex;gap:8px;align-items:center;margin-top:6px;font-size:12px;color:var(--muted)} .item-meta{display:flex;gap:8px;align-items:center;margin-top:2px;font-size:12px;color:var(--muted);flex-wrap:wrap}
.item-actions{display:flex;align-items:center} .item-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
/* Ensure proper spacing in queue items */
.queue-item > * {
flex-shrink: 0;
}
.queue-item .item-main {
flex-shrink: 1;
min-width: 0;
}
/* drawer */ /* drawer */
.drawer{ .drawer{
@@ -309,12 +320,14 @@ button.chip[aria-pressed="true"]{
.filter-group .date-inputs { .filter-group .date-inputs {
display:flex; display:flex;
gap:12px; gap:8px;
margin-top:8px; margin-top:8px;
align-items:flex-end;
} }
.filter-group .date-input-group { .filter-group .date-input-group {
flex:1; flex:1;
min-width:0;
display:flex; display:flex;
flex-direction:column; flex-direction:column;
} }
@@ -323,16 +336,19 @@ button.chip[aria-pressed="true"]{
font-size:12px; font-size:12px;
font-weight:500; font-weight:500;
color:#6b7280; color:#6b7280;
margin-bottom:6px; margin-bottom:4px;
white-space:nowrap;
} }
.filter-group .date-input-group input[type="date"] { .filter-group .date-input-group input[type="date"] {
padding:8px 12px; padding:6px 8px;
border:1px solid #d1d5db; border:1px solid #d1d5db;
border-radius:6px; border-radius:6px;
font-size:14px; font-size:14px;
background:white; background:white;
transition:border-color 0.2s ease, box-shadow 0.2s ease; transition:border-color 0.2s ease, box-shadow 0.2s ease;
width:100%;
box-sizing:border-box;
} }
.filter-group .date-input-group input[type="date"]:focus { .filter-group .date-input-group input[type="date"]:focus {
@@ -344,11 +360,17 @@ button.chip[aria-pressed="true"]{
/* button group styling */ /* button group styling */
.filter-group .button-group { .filter-group .button-group {
display:flex; display:flex;
gap:10px; gap:8px;
margin-top:16px; margin-top:16px;
justify-content:flex-end; justify-content:flex-end;
} }
.filter-group .button-group .btn {
padding:8px 16px;
font-size:13px;
min-width:60px;
}
/* small screens */ /* small screens */
@media (max-width:900px){ @media (max-width:900px){
.main{grid-template-columns:1fr;grid-auto-rows:auto} .main{grid-template-columns:1fr;grid-auto-rows:auto}
@@ -360,11 +382,31 @@ button.chip[aria-pressed="true"]{
.panel{padding:16px} .panel{padding:16px}
.filter-group .date-inputs { .filter-group .date-inputs {
flex-direction:column; flex-direction:column;
gap:8px; gap:12px;
}
.filter-group .date-input-group {
min-width:auto;
} }
.filter-group .button-group { .filter-group .button-group {
flex-direction:column; flex-direction:column;
gap:8px;
} }
.queue-item .item-actions {
flex-direction:column;
align-items:stretch;
gap:6px;
min-width:auto;
}
.queue-item .item-actions select,
.queue-item .item-actions button {
width:100%;
text-align:center;
}
}
/* medium screens - adjust for better button layout */
@media (max-width:1200px) and (min-width:901px){
.main{grid-template-columns:280px 1fr 360px}
} }
/* footer styling */ /* footer styling */