fix: 5 bugs - tab height, collect pay modal, invoice picker in record payment, comment body field, dashboard tickets label

This commit is contained in:
Nemo
2026-03-24 11:44:14 +08:00
parent defacbcc77
commit f8c5402b02
5 changed files with 211 additions and 41 deletions

View File

@@ -143,8 +143,15 @@ export default function DashboardScreen() {
const allActiveTickets: any[] = ticketsQ.data ?? [];
const unpaidInvoices: any[] = invoicesQ.data ?? [];
const unassigned = allActiveTickets.filter((t: any) => !t.assignedToId).slice(0, 10);
const assignedToMe = allActiveTickets.filter((t: any) => t.assignedToId === user?.id).slice(0, 10);
const unassigned = allActiveTickets.filter((t: any) => !t.assignedToId);
const assignedToMe = allActiveTickets.filter((t: any) => t.assignedToId === user?.id);
// Merge: assigned-to-me first, then unassigned, deduped, max 10
const seen = new Set<string>();
const mergedTickets = [...assignedToMe, ...unassigned].filter((t: any) => {
if (seen.has(t.id)) return false;
seen.add(t.id);
return true;
}).slice(0, 10);
const byPrio = (a: any, b: any) => (a.priority === 'HIGH' ? -1 : 1) - (b.priority === 'HIGH' ? -1 : 1);
const refetchAll = () => { summaryQ.refetch(); ticketsQ.refetch(); invoicesQ.refetch(); };
@@ -195,13 +202,13 @@ export default function DashboardScreen() {
</View>
)}
{/* ── Unassigned Tickets ── */}
{/* ── Active Tickets ── */}
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 10 }}>
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<Text style={{ fontSize: 17, fontWeight: '800', color: '#0F172A' }}>Unassigned Tickets</Text>
{unassigned.length > 0 && (
<View style={{ backgroundColor: '#FEE2E2', borderRadius: 20, paddingHorizontal: 8, paddingVertical: 2, marginLeft: 8 }}>
<Text style={{ fontSize: 12, fontWeight: '700', color: '#DC2626' }}>{unassigned.length}</Text>
<Text style={{ fontSize: 17, fontWeight: '800', color: '#0F172A' }}>Tickets</Text>
{mergedTickets.length > 0 && (
<View style={{ backgroundColor: '#ECFEFF', borderRadius: 20, paddingHorizontal: 8, paddingVertical: 2, marginLeft: 8 }}>
<Text style={{ fontSize: 12, fontWeight: '700', color: '#0891B2' }}>{mergedTickets.length}</Text>
</View>
)}
</View>
@@ -210,30 +217,18 @@ export default function DashboardScreen() {
</TouchableOpacity>
</View>
{unassigned.length === 0 ? (
{mergedTickets.length === 0 ? (
<View style={{ backgroundColor: '#FFF', borderRadius: 14, padding: 20, alignItems: 'center', marginBottom: 20, borderWidth: 1, borderColor: '#F1F5F9' }}>
<Text style={{ fontSize: 15, color: '#94A3B8' }}>No unassigned tickets 🎉</Text>
<Text style={{ fontSize: 15, color: '#94A3B8' }}>No active tickets 🎉</Text>
</View>
) : (
<View style={{ marginBottom: 20 }}>
{[...unassigned].sort(byPrio).map((t: any) => (
{[...mergedTickets].sort(byPrio).map((t: any) => (
<TicketRow key={t.id} task={t} onPress={() => router.push(`/(app)/tasks/${t.id}`)} />
))}
</View>
)}
{/* ── Assigned to Me ── */}
{assignedToMe.length > 0 && (
<>
<Text style={{ fontSize: 17, fontWeight: '800', color: '#0F172A', marginBottom: 10 }}>Assigned to Me</Text>
<View style={{ marginBottom: 20 }}>
{[...assignedToMe].sort(byPrio).map((t: any) => (
<TicketRow key={t.id} task={t} onPress={() => router.push(`/(app)/tasks/${t.id}`)} />
))}
</View>
</>
)}
{/* ── Unpaid Invoices ── */}
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', marginBottom: 10 }}>
<Text style={{ fontSize: 17, fontWeight: '800', color: '#0F172A' }}>Unpaid Invoices</Text>