feat(frontend): newest emails first, mailbox above the SES tools
CI / checks (pull_request) Failing after 12m24s
CI / checks (pull_request) Failing after 12m24s
This commit is contained in:
@@ -47,7 +47,7 @@ export class AwsSesAdapter implements CloudServiceAdapter {
|
||||
|
||||
async list(query: ResourceQuery = {}): Promise<CloudResource[]> {
|
||||
const messages = await this.fetchInbox()
|
||||
const resources = messages.map(messageToResource)
|
||||
const resources = messages.map(messageToResource).sort(newestFirst)
|
||||
return filterBySearch(resources, query.search)
|
||||
}
|
||||
|
||||
@@ -137,6 +137,10 @@ function findCode(body: string | null | undefined): string | null {
|
||||
return body?.match(CODE_PATTERN)?.[1] ?? null
|
||||
}
|
||||
|
||||
function newestFirst(a: CloudResource, b: CloudResource): number {
|
||||
return (b.createdAt ?? '').localeCompare(a.createdAt ?? '')
|
||||
}
|
||||
|
||||
function filterBySearch(resources: CloudResource[], search?: string): CloudResource[] {
|
||||
const normalized = search?.trim().toLowerCase()
|
||||
if (!normalized) return resources
|
||||
|
||||
Reference in New Issue
Block a user