Skip to content

Add manual expert#862

Open
koutst wants to merge 6 commits into
mainfrom
add-manual-expert
Open

Add manual expert#862
koutst wants to merge 6 commits into
mainfrom
add-manual-expert

Conversation

@koutst
Copy link
Copy Markdown
Member

@koutst koutst commented May 18, 2026

No description provided.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment May 26, 2026 4:29pm

@koutst koutst marked this pull request as ready for review May 19, 2026 13:10
@koutst koutst requested a review from a team as a code owner May 19, 2026 13:10
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link
Copy Markdown
Member

@nicktytarenko nicktytarenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a modal to edit an expert. Can we reuse the existing modal but add new fields for creating a new Expert, and render a different set of fields when editing? 🤔

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename it to something more generic like ExpertFormModal?

}

function buildPayload(values: {
interface AddModeProps {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that we should differentiate input Props based on the mode.
we can have something like

export interface ExpertFormModalProps {
  isOpen: boolean;
  onClose: () => void;
  searchId: string;           // required for add flow
  expert?: ExpertResult;    // undefined = add, defined = edit
  onSuccess: () => Promise<void>;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parent passes onSuccess={refetch} so the grid updates after save

Comment on lines 92 to 93
const [submitError, setSubmitError] = useState<string | null>(null);
const [isSubmitting, setIsSubmitting] = useState(false);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And now i think we shoudl have submit flow inside modal:

const [, patchExpert] = usePatchExpert();
const [, createExpert] = useCreateExpert(); // new

const handleSubmit = async () => {
  try {
    if (isEditMode) {
      await patchExpert(expert.expertId!, payload);
    } else {
      await createExpert(searchId, payload);
    }
    await onSuccess();
    onClose();
  } catch (err) {
      setSubmitError(extractApiErrorMessage(err, 'Failed to update expert'));
    } finally {
      setIsSubmitting(false);
    }
};

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants