feat: add gmail review actions

This commit is contained in:
2026-04-01 21:54:05 +02:00
parent 161ecb4b94
commit b87e673d38
6 changed files with 53 additions and 45 deletions
-4
View File
@@ -310,7 +310,3 @@ export default function App() {
</ToastProvider>
);
}
mProvider>
</ToastProvider>
);
}
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo, useState } from "react";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import { useNavigate } from "react-router-dom";
import {
Box,
@@ -45,7 +45,7 @@ export default function CorrespondenceInboxPage() {
const [direction, setDirection] = useState<string>("all");
const [linkState, setLinkState] = useState<string>("all");
const load = async () => {
const load = useCallback(async () => {
setLoading(true);
try {
const res = await api.get<CorrespondenceInboxItem[]>("/correspondence", {
@@ -61,11 +61,11 @@ export default function CorrespondenceInboxPage() {
} finally {
setLoading(false);
}
};
}, [direction, linkState, query, toast]);
useEffect(() => {
void load();
}, []);
}, [load]);
const filteredSummary = useMemo(() => {
const linked = items.filter((item) => item.externalThreadId).length;
-22
View File
@@ -167,28 +167,6 @@ function initialsFrom(values: Array<string | undefined>) {
return (joined[0][0] + joined[1][0]).toUpperCase();
}
function replaceCvSection(source: string, sectionName: string, sectionDraft: string) {
const trimmedSource = source.trim();
const trimmedDraft = sectionDraft.trim();
if (!trimmedDraft) return source;
if (!trimmedSource) return `${sectionName}\n${trimmedDraft}`;
const headingPattern = /^([A-Z][A-Za-z &/]+):?\s*$/gm;
const matches = Array.from(trimmedSource.matchAll(headingPattern));
const normalizedTarget = sectionName.trim().toLowerCase();
const targetIndex = matches.findIndex((match) => match[1].trim().toLowerCase() === normalizedTarget);
if (targetIndex === -1) {
return `${trimmedSource}\n\n${sectionName}\n${trimmedDraft}`.trim();
}
const start = matches[targetIndex].index ?? 0;
const end = targetIndex + 1 < matches.length ? (matches[targetIndex + 1].index ?? trimmedSource.length) : trimmedSource.length;
const before = trimmedSource.slice(0, start).trimEnd();
const after = trimmedSource.slice(end).trimStart();
return [before, `${sectionName}\n${trimmedDraft}`, after].filter(Boolean).join("\n\n").trim();
}
function confidenceTone(confidence?: number) {
if (typeof confidence !== "number") return { label: "Review", color: "default" as const };
if (confidence >= 0.8) return { label: `High ${Math.round(confidence * 100)}%`, color: "success" as const };