Skip to content

Commit e205e05

Browse files
authored
docs(changeset): faster loading schema for webmail (#81)
1 parent 9b56ecc commit e205e05

18 files changed

Lines changed: 5509 additions & 929 deletions

File tree

.changeset/young-dryers-occur.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@kurrier/schema": patch
3+
"@kurrier/worker": patch
4+
"@kurrier/db": patch
5+
"@kurrier/web": patch
6+
"@kurrier/repo": patch
7+
---
8+
9+
faster loading schema for webmail

.github/workflows/release-images.yml

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -94,105 +94,3 @@ jobs:
9494
generate_release_notes: true
9595
env:
9696
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97-
98-
99-
100-
#name: release-images
101-
#
102-
#on:
103-
# # Run as soon as the tag workflow finishes
104-
# workflow_run:
105-
# workflows: ["tag-repo-version"]
106-
# types: [completed]
107-
#
108-
#jobs:
109-
# build-and-push:
110-
# # Only run if the tag workflow succeeded
111-
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
112-
# runs-on: ubuntu-latest
113-
# permissions:
114-
# contents: read
115-
# packages: write
116-
#
117-
# env:
118-
# # The commit that tag-repo-version ran on (the tag points at this)
119-
# SOURCE_SHA: ${{ github.event.workflow_run.head_sha }}
120-
#
121-
# strategy:
122-
# matrix:
123-
# service: [web, worker]
124-
#
125-
# steps:
126-
# - name: Checkout (full history for tags)
127-
# uses: actions/checkout@v4
128-
# with:
129-
# fetch-depth: 0
130-
#
131-
# - name: Fetch tags
132-
# run: git fetch --tags --force
133-
#
134-
# - name: Resolve the tag that points at the workflow SHA
135-
# id: tag
136-
# shell: bash
137-
# run: |
138-
# set -euo pipefail
139-
# echo "SOURCE_SHA=${SOURCE_SHA}"
140-
# # Find tags that point at exactly this SHA; pick semver-ish vX.Y.Z
141-
# TAG=$(git tag --points-at "${SOURCE_SHA}" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n1 || true)
142-
# if [ -z "${TAG}" ]; then
143-
# echo "No vX.Y.Z tag found pointing at ${SOURCE_SHA}"
144-
# echo "Known tags for debugging:"
145-
# git tag --points-at "${SOURCE_SHA}" || true
146-
# exit 1
147-
# fi
148-
# echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
149-
# echo "Resolved tag: ${TAG}"
150-
#
151-
# - name: Check out the exact tagged revision
152-
# run: git checkout ${{ steps.tag.outputs.tag }}
153-
#
154-
# - name: Set up QEMU
155-
# uses: docker/setup-qemu-action@v3
156-
#
157-
# - name: Set up Buildx
158-
# uses: docker/setup-buildx-action@v3
159-
#
160-
# - name: Log in to GHCR
161-
# uses: docker/login-action@v3
162-
# with:
163-
# registry: ghcr.io
164-
# username: ${{ github.actor }}
165-
# password: ${{ secrets.GITHUB_TOKEN }}
166-
#
167-
# - name: Build & push ${{ matrix.service }}
168-
# uses: docker/build-push-action@v6
169-
# with:
170-
# context: .
171-
# file: apps/${{ matrix.service }}/Dockerfile
172-
# push: true
173-
# platforms: linux/amd64,linux/arm64
174-
# # Tag with the resolved vX.Y.Z + "latest"
175-
# tags: |
176-
# ghcr.io/${{ github.repository_owner }}/kurrier-${{ matrix.service }}:${{ steps.tag.outputs.tag }}
177-
# ghcr.io/${{ github.repository_owner }}/kurrier-${{ matrix.service }}:latest
178-
# build-args: |
179-
# NODE_ENV=production
180-
# provenance: true
181-
# sbom: true
182-
#
183-
# github-release:
184-
# needs: build-and-push
185-
# runs-on: ubuntu-latest
186-
# permissions:
187-
# contents: write
188-
# steps:
189-
# - name: Create GitHub Release
190-
# uses: softprops/action-gh-release@v2
191-
# with:
192-
# tag_name: ${{ github.ref_name }}
193-
# name: ${{ github.ref_name }}
194-
## tag_name: v${{ steps.v.outputs.ver }}
195-
## name: v${{ steps.v.outputs.ver }}
196-
# generate_release_notes: true
197-
# env:
198-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

apps/web/app/api/v1/ses/route.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

apps/web/app/mail/(mail)/[identityPublicId]/[mailboxSlug]/messages/[threadId]/page.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
import React from "react";
22
import {
3-
fetchMailbox,
4-
fetchMailboxThreads,
5-
fetchThreadDetail,
3+
fetchWebMailThreadDetail,
64
} from "@/lib/actions/mailbox";
75
import ThreadItem from "@/components/mailbox/default/thread-item";
86
import { Divider } from "@mantine/core";
9-
import { db, threads } from "@db";
10-
import { eq } from "drizzle-orm";
117

128
async function Page({
139
params,
1410
}: {
1511
params: { identityPublicId: string; mailboxSlug: string; threadId: string };
1612
}) {
17-
const { threadId, mailboxSlug, identityPublicId } = await params;
18-
const { activeMailbox } = await fetchMailbox(identityPublicId, mailboxSlug);
19-
const activeThread = await fetchThreadDetail(activeMailbox.id, threadId);
20-
console.log("activeThread", activeThread);
13+
const { threadId } = await params;
14+
const activeThread = await fetchWebMailThreadDetail(threadId);
2115

2216
return (
2317
<>

apps/web/app/mail/(mail)/[identityPublicId]/[mailboxSlug]/page.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { fetchMailbox, fetchMailboxThreads } from "@/lib/actions/mailbox";
1+
import {fetchMailbox, fetchMailboxThreads, fetchWebMailList} from "@/lib/actions/mailbox";
22
import { getPublicEnv } from "@schema";
33
import ThreadList from "@/components/mailbox/default/thread-list";
44
import MailPagination from "@/components/mailbox/default/mail-pagination";
5+
import WebmailList from "@/components/mailbox/default/webmail-list";
56

67
async function Page({
78
params,
@@ -16,18 +17,23 @@ async function Page({
1617
identityPublicId,
1718
mailboxSlug,
1819
);
19-
const { threads } = await fetchMailboxThreads(activeMailbox.id, Number(page));
2020
const publicConfig = getPublicEnv();
21+
const mailList = await fetchWebMailList(identityPublicId, String(mailboxSlug), Number(page))
2122

2223
return (
2324
<>
2425
<div className="flex flex-1 flex-col gap-4 p-4 mb-12">
25-
<ThreadList
26-
threads={threads}
27-
publicConfig={publicConfig}
28-
activeMailbox={activeMailbox}
29-
identityPublicId={identityPublicId}
30-
/>
26+
{/*<ThreadList*/}
27+
{/* threads={threads}*/}
28+
{/* publicConfig={publicConfig}*/}
29+
{/* activeMailbox={activeMailbox}*/}
30+
{/* identityPublicId={identityPublicId}*/}
31+
{/*/>*/}
32+
33+
<WebmailList threads={mailList}
34+
publicConfig={publicConfig}
35+
activeMailbox={activeMailbox}
36+
identityPublicId={identityPublicId} />
3137

3238
<MailPagination
3339
count={count}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
"use client";
2+
import * as React from "react";
3+
import { MailboxEntity } from "@db";
4+
import { useEffect } from "react";
5+
import { PublicConfig } from "@schema";
6+
import {
7+
deltaFetch, FetchWebMailResult
8+
} from "@/lib/actions/mailbox";
9+
import MailListHeader from "@/components/mailbox/default/mail-list-header";
10+
import WebmailListItem from "@/components/mailbox/webmail-list-item";
11+
12+
13+
type WebListProps = {
14+
threads: FetchWebMailResult;
15+
publicConfig: PublicConfig;
16+
activeMailbox: MailboxEntity;
17+
identityPublicId: string;
18+
};
19+
20+
export default function WebmailList({ threads, publicConfig, activeMailbox, identityPublicId}: WebListProps) {
21+
22+
23+
useEffect(() => {
24+
deltaFetch({identityId: activeMailbox.identityId})
25+
}, []);
26+
27+
28+
return (
29+
<>
30+
{threads.length === 0 ? (
31+
<div className="p-4 text-center text-base text-muted-foreground">
32+
No messages in{" "}
33+
<span className={"lowercase"}>{activeMailbox.name}</span>
34+
</div>
35+
) : (
36+
<div className="rounded-xl border bg-background/50 p-1">
37+
<MailListHeader />
38+
39+
<ul role="list" className="divide-y">
40+
{threads.map((threadItem) => (
41+
<WebmailListItem key={threadItem.id} threadItem={threadItem} activeMailbox={activeMailbox} identityPublicId={identityPublicId} />
42+
))}
43+
</ul>
44+
</div>
45+
)}
46+
</>
47+
);
48+
}

0 commit comments

Comments
 (0)