match unread and read status

This commit is contained in:
Arjun 2026-05-13 14:46:13 +05:30
parent 64976a9f5f
commit ec4c7405e2
4 changed files with 30 additions and 3 deletions

View file

@ -166,8 +166,8 @@
padding: 0 12px;
border: none;
border-bottom: 1px solid #f1f3f4;
background: #fff;
color: #202124;
background: #f6f8fc;
color: #5f6368;
text-align: left;
cursor: pointer;
font-family: inherit;
@ -179,6 +179,16 @@
background: #f2f6fc;
}
.gmail-row-unread {
background: #fff;
color: #202124;
}
.gmail-row-unread:hover,
.gmail-row-unread.gmail-row-selected {
background: #f2f6fc;
}
.gmail-row-check {
width: 14px;
height: 14px;
@ -195,6 +205,12 @@
.gmail-row-content strong,
.gmail-row-date {
font-size: 13px;
font-weight: 400;
}
.gmail-row-unread .gmail-row-sender,
.gmail-row-unread .gmail-row-content strong,
.gmail-row-unread .gmail-row-date {
font-weight: 700;
}
@ -216,6 +232,10 @@
.gmail-row-content strong {
flex-shrink: 0;
color: inherit;
}
.gmail-row-unread .gmail-row-content strong {
color: #202124;
}

View file

@ -430,11 +430,12 @@ export function EmailView() {
{filteredThreads.map((thread) => {
const latest = latestMessage(thread)
const isSelected = thread.threadId === selectedThread.threadId
const isUnread = thread.unread === true
return (
<button
key={thread.threadId}
type="button"
className={cn('gmail-row', isSelected && 'gmail-row-selected')}
className={cn('gmail-row', isSelected && 'gmail-row-selected', isUnread && 'gmail-row-unread')}
onClick={() => setSelectedThreadId(thread.threadId)}
>
<span className="gmail-row-check" />

View file

@ -31,6 +31,7 @@ export interface GmailThreadSnapshot {
date?: string;
latest_email?: string;
past_summary?: string;
unread?: boolean;
messages: Array<{
id?: string;
from?: string;
@ -40,6 +41,7 @@ export interface GmailThreadSnapshot {
subject?: string;
body?: string;
bodyHtml?: string;
unread?: boolean;
}>;
}
@ -239,6 +241,7 @@ export async function fetchThreadSnapshot(threadId: string): Promise<GmailThread
subject: headerValue(headers, 'Subject') || '(No Subject)',
body,
bodyHtml,
unread: msg.labelIds?.includes('UNREAD') ?? false,
};
}));
@ -262,6 +265,7 @@ export async function fetchThreadSnapshot(threadId: string): Promise<GmailThread
date: latest.date,
latest_email: latest.body,
past_summary: earlierSummary || undefined,
unread: parsed.some((m) => m.unread),
messages: parsed,
};
}

View file

@ -111,6 +111,7 @@ export const GmailThreadMessageSchema = z.object({
subject: z.string().optional(),
body: z.string().optional(),
bodyHtml: z.string().optional(),
unread: z.boolean().optional(),
});
export type GmailThreadMessage = z.infer<typeof GmailThreadMessageSchema>;
@ -118,6 +119,7 @@ export type GmailThreadMessage = z.infer<typeof GmailThreadMessageSchema>;
export const GmailThreadSchema = EmailBlockSchema.extend({
threadId: z.string(),
threadUrl: z.string().url(),
unread: z.boolean().optional(),
messages: z.array(GmailThreadMessageSchema),
});