🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
'use client';
import { ActionIcon, toast } from '@lobehub/ui';
import { PencilLine } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { verifyService } from '@/services/verify';
import { useVerifyStore } from '@/store/verify';
import { useAcceptanceScope } from '../AcceptanceScope';
import { useAcceptanceBundle } from '../useAcceptanceBundle';
const AcceptanceGoalEdit = () => {
const { t } = useTranslation('verify');
const { acceptanceId } = useAcceptanceScope();
const { data, mutate } = useAcceptanceBundle(acceptanceId);
/**
* Authoring the standing checklist and the goal writes through the SUBJECT
* (`ensureForSubject`), which is still resolved in the caller's own scope — it
* cannot reach a teammate's row, and the workspace-unique insert fallback then
* fails. Until that path is reviewer-aware these stay the creator's, so the page
* never offers an action that is guaranteed to answer `NOT_FOUND`.
*/
if (!data?.isOwner) return null;
const subjectType = data.subject.type;
if (subjectType === 'site') return null;
const handleEdit = async () => {
const { openGoalModal } =
await import('@/features/Conversation/ChatInput/VerifyTray/GoalModal');
openGoalModal({
initialGoal: data.acceptance.requirement ?? undefined,
onSubmit: async (goal) => {
try {
await verifyService.saveAcceptanceGoal(subjectType, data.subject.id, goal);
} catch (cause) {
toast.error(cause instanceof Error ? cause.message : t('acceptance.actionError'));
throw cause;
}
await mutate();
void useVerifyStore.getState().refreshAcceptanceLists();
},
});
};
return (
<ActionIcon
icon={PencilLine}
size={'small'}
title={t('acceptance.goalEdit')}
onClick={handleEdit}
/>
);
};
export default AcceptanceGoalEdit;