diff --git a/apps/web/src/components/RightRail.tsx b/apps/web/src/components/RightRail.tsx
index 6cdc1436..17bdc37e 100644
--- a/apps/web/src/components/RightRail.tsx
+++ b/apps/web/src/components/RightRail.tsx
@@ -93,12 +93,12 @@ function RailContent({ kind, payload }: { kind: string; payload: unknown }) {
);
}
if (kind === "attachments" && Array.isArray(payload)) {
+ const attachments = payload.filter(isAttachmentView);
return (
- {payload.map((item, index) => {
- const attachment = item as AttachmentView;
- return
;
- })}
+ {attachments.map((attachment, index) => (
+
+ ))}
);
}
@@ -143,9 +143,7 @@ interface RoutePickerPayload {
function isRoutePickerPayload(value: unknown): value is RoutePickerPayload {
return (
- isRecord(value) &&
- Array.isArray(value.messageIds) &&
- typeof value.fromQueueLabel === "string"
+ isRecord(value) && Array.isArray(value.messageIds) && typeof value.fromQueueLabel === "string"
);
}
@@ -598,6 +596,12 @@ function isRecord(value: unknown): value is Record {
return typeof value === "object" && value !== null;
}
+function isAttachmentView(value: unknown): value is AttachmentView {
+ return (
+ isRecord(value) && typeof value.filename === "string" && typeof value.mime_type === "string"
+ );
+}
+
function formatNumber(value: number): string {
return new Intl.NumberFormat(undefined, { maximumFractionDigits: 0 }).format(value);
}