🤯 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
import { toast } from '@lobehub/ui';
import { useTranslation } from 'react-i18next';
import { openRenameModal } from '@/components/RenameModal';
import { useVerifyReportBundle } from '@/features/Acceptance/hooks';
import { type PortalMoreMenuConfig } from '@/features/Portal/components/PortalMoreMenu/types';
import { usePermission } from '@/hooks/usePermission';
import { useVerifyStore } from '@/store/verify';
import { useVerifyReportUrl } from './useReportUrl';
export const useVerifyReportMoreMenu = (): PortalMoreMenuConfig | undefined => {
const { t } = useTranslation('verify');
const { reportUrl, runId } = useVerifyReportUrl();
// Same replica entry as the title and body, so this shares their request.
const { data } = useVerifyReportBundle(runId ?? null);
const refreshVerifyReportBundle = useVerifyStore((s) => s.refreshVerifyReportBundle);
const renameVerifyReportRun = useVerifyStore((s) => s.renameVerifyReportRun);
const { allowed: canEdit } = usePermission('edit_own_content');
if (!runId) return;
const refresh = () => refreshVerifyReportBundle(runId);
return {
copyId: runId,
// Only a run inside an acceptance has a page to link to.
copyLink: reportUrl,
refresh,
rename:
// Report URLs are public; only the author can rename the run.
canEdit && data?.isOwner
? () =>
openRenameModal({
defaultValue: data.run.title ?? '',
onSave: async (next) => {
try {
await renameVerifyReportRun(runId, next);
toast.success(t('workspace.renameSuccess'));
} catch (error) {
console.error('[verify-report:rename]', error);
toast.error(t('workspace.renameError'));
// Keep the modal open with the typed title for a retry.
throw error;
}
},
})
: undefined,
};
};