feat: folder view — clicking sidebar items shows filtered email list
- New FolderView page at /app/folder/:slug renders a paginated email table - Sidebar links now route to their respective folder views - Extended SearchRequestDto with IsInInbox, IsStarred, IsTrashed, GmailLabel, Category, MinSizeBytes - SearchService applies the new filters; GmailLabel does a label-id lookup (SENT/DRAFT/SPAM) - Frontend folderToRequest() maps every slug to the correct search payload - Email rows show sender, subject+snippet, attachment icon, size, date; bold for unread - Pagination controls for large folders Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using InboxIntel.Application.Abstractions;
|
||||
using InboxIntel.Application.Common;
|
||||
using InboxIntel.Application.DTOs;
|
||||
using InboxIntel.Domain.Enums;
|
||||
using InboxIntel.Infrastructure.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@@ -32,6 +33,27 @@ public class SearchService : ISearchService
|
||||
q = q.Where(e => e.IsUnread == unread);
|
||||
if (r.HasAttachments is { } att)
|
||||
q = q.Where(e => e.HasAttachments == att);
|
||||
if (r.IsInInbox is { } inbox)
|
||||
q = q.Where(e => e.IsInInbox == inbox);
|
||||
if (r.IsStarred is { } starred)
|
||||
q = q.Where(e => e.IsStarred == starred);
|
||||
if (r.IsTrashed is { } trashed)
|
||||
q = q.Where(e => e.IsTrashed == trashed);
|
||||
if (r.MinSizeBytes is { } minSize)
|
||||
q = q.Where(e => e.SizeEstimateBytes >= minSize);
|
||||
if (!string.IsNullOrWhiteSpace(r.Category) && Enum.TryParse<EmailCategory>(r.Category, true, out var cat))
|
||||
q = q.Where(e => e.Category == cat);
|
||||
if (!string.IsNullOrWhiteSpace(r.GmailLabel))
|
||||
{
|
||||
var labelId = await _db.Labels
|
||||
.Where(l => l.UserId == userId && l.GmailLabelId == r.GmailLabel.ToUpperInvariant())
|
||||
.Select(l => (Guid?)l.Id)
|
||||
.FirstOrDefaultAsync(ct);
|
||||
if (labelId.HasValue)
|
||||
q = q.Where(e => e.EmailLabels.Any(el => el.LabelId == labelId.Value));
|
||||
else
|
||||
return new PagedResult<EmailSummaryDto> { Items = [], Page = r.Page, PageSize = r.PageSize, TotalCount = 0 };
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(r.Query))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user