feat: publish shared task and reply activities through MCP
This commit is contained in:
@@ -1,28 +1,31 @@
|
||||
import { conversations } from "#/features/support/mock-conversations";
|
||||
import { useActivities } from "#/features/activities/activity-state";
|
||||
import { useWorkspaceState } from "#/features/workspace/workspace-state";
|
||||
|
||||
export function DailyBrief({ onOpenContact }: { onOpenContact: (id: string) => void }) {
|
||||
const { tasks, statuses, entries } = useWorkspaceState();
|
||||
const focus = tasks.find((task) => task.section === "focus" && task.status === "todo");
|
||||
const optional = tasks.find((task) => task.section === "optional" && task.status === "todo");
|
||||
const contacts = conversations.filter(
|
||||
(person) =>
|
||||
(statuses[person.id] ?? "now") === "now" &&
|
||||
(person.replyRequired || statuses[person.id] === "now"),
|
||||
);
|
||||
const { entries } = useWorkspaceState();
|
||||
const { activities, loading, error } = useActivities();
|
||||
const tasks = activities
|
||||
.filter((activity) => activity.userState === "available" || activity.userState === "inProgress")
|
||||
.map((activity) => activity.effective);
|
||||
const focus = tasks.find((task) => task.section === "focus");
|
||||
const optional = tasks.find((task) => task.section === "optional");
|
||||
const contacts = tasks.filter((activity) => activity.kind === "reply");
|
||||
const firstContact = contacts[0];
|
||||
const resume = entries.find(
|
||||
(entry) =>
|
||||
entry.kind === "再開地点" && !entries.some((other) => other.correctionOf === entry.id),
|
||||
);
|
||||
|
||||
if (loading || error) return null;
|
||||
return (
|
||||
<section
|
||||
className="mt-px-20 max-w-[760px] text-ui-15 leading-brief wrap-anywhere"
|
||||
aria-label="Daily brief"
|
||||
>
|
||||
<p>
|
||||
{focus ? `Start with “${focus.title}” today.` : "There are no priority tasks right now."}
|
||||
{focus
|
||||
? `Start with “${focus.title}” today.`
|
||||
: "There are no priority activities right now."}
|
||||
{firstContact ? (
|
||||
<>
|
||||
{" "}
|
||||
@@ -31,14 +34,14 @@ export function DailyBrief({ onOpenContact }: { onOpenContact: (id: string) => v
|
||||
type="button"
|
||||
onClick={() => onOpenContact(firstContact.id)}
|
||||
>
|
||||
Reply to {firstContact.name}
|
||||
{firstContact.title}
|
||||
</button>
|
||||
{contacts.length > 1
|
||||
? ` — one of ${contacts.length} conversations to review.`
|
||||
? ` — one of ${contacts.length} reply actions to review.`
|
||||
: " when you’re ready."}
|
||||
</>
|
||||
) : (
|
||||
" There are no conversations awaiting your attention."
|
||||
" No other reply activities are currently registered."
|
||||
)}
|
||||
</p>
|
||||
{resume ? (
|
||||
|
||||
Reference in New Issue
Block a user