diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index d23fea6..0994e2d 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -44,6 +44,7 @@ export function App() { () => (config && needsSignIn ? signInUrl(config) : null), [config, needsSignIn], ); + const resultState = running ? "loading" : error ? "error" : result?.status === "ok" ? "success" : result ? "error" : "idle"; async function runTriage(event) { event.preventDefault(); @@ -58,6 +59,9 @@ export function App() { max_messages: Number(maxMessages), }); setResult(data); + if (data?.status && data.status !== "ok") { + setError(data.summary || "The inbox could not be triaged. Check the pasted messages and try again."); + } } catch (err) { setError(err.message || String(err)); } finally { @@ -157,57 +161,61 @@ export function App() { - {error ?
{error}
: null} +
+ {running ?

Triaging the shared inbox and drafting approval-ready replies...

: null} + {error ?
{error}
: null} + {!running && !error && !result ?

Run the prefilled fixture to generate a prioritized queue, drafts, receipt, and JSON download.

: null} - {result ? ( -
-
-
-

Structured result

-

{result.summary || result.status}

+ {result ? ( + <> +
+
+

Structured result

+

{result.summary || result.status}

+
+ {result.artifact ? ( + + ) : null}
- {result.artifact ? ( - + +

{result.approval_boundary}

+ {result.receipt ? ( +

+ Receipt {result.receipt.receipt_id}: {result.receipt.message} +

) : null} -
-

{result.approval_boundary}

- {result.receipt ? ( -

- Receipt {result.receipt.receipt_id}: {result.receipt.message} -

- ) : null} - -
- {(result.queue || []).map((item) => ( -
-
- {item.priority} - {item.category} -
-

{item.subject}

-

From: {item.sender}

-

Why: {item.reason}

-

Next: {item.next_action}

-
- Approval-ready draft -
-

To: {item.draft.to}

-

Subject: {item.draft.subject}

-
{item.draft.body}
-

Approval reason: {item.draft.approval_reason}

-
    - {(item.draft.policy_basis || []).map((basis) =>
  • {basis}
  • )} -
+
+ {(result.queue || []).map((item) => ( +
+
+ {item.priority} + {item.category}
-
-
- ))} -
-
- ) : null} +

{item.subject}

+

From: {item.sender}

+

Why: {item.reason}

+

Next: {item.next_action}

+
+ Approval-ready draft +
+

To: {item.draft.to}

+

Subject: {item.draft.subject}

+
{item.draft.body}
+

Approval reason: {item.draft.approval_reason}

+
    + {(item.draft.policy_basis || []).map((basis) =>
  • {basis}
  • )} +
+
+
+ + ))} + + + ) : null} +
); }