10clouds / 10minions-vscode

Your Army of GPT-4 Powered Coding Buddies (Boost Your Productivity)
https://marketplace.visualstudio.com/items?itemName=10Clouds.10minions
MIT License
2 stars 0 forks source link

Wrong replace happened here #81

Closed cielecki closed 1 year ago

cielecki commented 1 year ago

File: MinionTaskComponent.tsx Task: Use OutlineButton for other buttons

//////////////////////////////////////////////////////////////////////////////// // Stage 2: Understanding ... ////////////////////////////////////////////////////////////////////////////////

LocalChange

Classification: LocalChange

//////////////////////////////////////////////////////////////////////////////// // Stage 3: Conceptualising ... ////////////////////////////////////////////////////////////////////////////////

Step 1: Identify the buttons that need to be refactored to use the OutlineButton component

Currently, there are four buttons that do not use the OutlineButton component yet:

  1. stopButton
  2. diffButton
  3. retryButton
  4. openLogFileButton

Step 2: Refactor the buttons to use the OutlineButton component

Now, let's refactor the buttons one by one.

  1. stopButton:
const stopButton = (
  <OutlineButton
    title="Stop Execution"
    description="Stop"
    onClick={() => {
      postMessageToVsCode({
        type: "stopExecution",
        minionTaskId: minionTask.id,
      });
    }}
  />
);
  1. diffButton:
const diffButton = (
  <OutlineButton
    title="Show Diff"
    description="Diff"
    onClick={handleClickShowDiff}
  />
);
  1. retryButton:
const retryButton = (
  <OutlineButton
    title="Retry Execution"
    description="Retry"
    onClick={() => {
      postMessageToVsCode({
        type: "reRunExecution",
        minionTaskId: minionTask.id,
      });
    }}
  />
);
  1. openLogFileButton:
const openLogFileButton = (
  <OutlineButton
    title="Open Log"
    className="mb-2"
    description="Open Log file"
    onClick={() => {
      postMessageToVsCode({
        type: "openLog",
        minionTaskId: minionTask.id,
      });
    }}
  />
);

Now, all the buttons are using the OutlineButton component. Here's the final code for the buttons:

const stopButton = (
  <OutlineButton
    title="Stop Execution"
    description="Stop"
    onClick={() => {
      postMessageToVsCode({
        type: "stopExecution",
        minionTaskId: minionTask.id,
      });
    }}
  />
);

const diffButton = (
  <OutlineButton
    title="Show Diff"
    description="Diff"
    onClick={handleClickShowDiff}
  />
);

const retryButton = (
  <OutlineButton
    title="Retry Execution"
    description="Retry"
    onClick={() => {
      postMessageToVsCode({
        type: "reRunExecution",
        minionTaskId: minionTask.id,
      });
    }}
  />
);

const openLogFileButton = (
  <OutlineButton
    title="Open Log"
    className="mb-2"
    description="Open Log file"
    onClick={() => {
      postMessageToVsCode({
        type: "openLog",
        minionTaskId: minionTask.id,
      });
    }}
  />
);

Make sure to replace the old buttons in the component with the new refactored OutlineButtons.

//////////////////////////////////////////////////////////////////////////////// // Stage 4: Preparing Changes ... ////////////////////////////////////////////////////////////////////////////////

I will refactor the four buttons (stopButton, diffButton, retryButton, and openLogFileButton) to use the OutlineButton component. I will replace the old button definitions with the new refactored OutlineButton definitions.

REPLACE const stopButton = ( <button title="Stop Execution" onClick={() => { postMessageToVsCode({ type: "stopExecution", minionTaskId: minionTask.id, }); }} style={{ borderColor: "var(--vscode-button-separator)", }} className="cursor-pointer border rounded px-2 ml-2"

Stop );

const diffButton = ( <button title="Show Diff" style={{ borderColor: "var(--vscode-button-separator)", }} className="cursor-pointer border rounded px-2 ml-2" onClick={handleClickShowDiff}

Diff );

const retryButton = ( <button title="Retry Execution" onClick={() => { postMessageToVsCode({ type: "reRunExecution", minionTaskId: minionTask.id, }); }} style={{ borderColor: "var(--vscode-button-separator)", }} className="cursor-pointer border rounded px-2 ml-2"

Retry );

const openLogFileButton = ( <button title="Open Log" className="cursor-pointer mb-2 border rounded px-2" onClick={() => { postMessageToVsCode({ type: "openLog", minionTaskId: minionTask.id, }); }} style={{ borderColor: "var(--vscode-button-separator)", }}

Open Log file ); WITH const stopButton = ( <OutlineButton title="Stop Execution" description="Stop" onClick={() => { postMessageToVsCode({ type: "stopExecution", minionTaskId: minionTask.id, }); }} /> );

const diffButton = ( <OutlineButton title="Show Diff" description="Diff" onClick={handleClickShowDiff} /> );

const retryButton = ( <OutlineButton title="Retry Execution" description="Retry" onClick={() => { postMessageToVsCode({ type: "reRunExecution", minionTaskId: minionTask.id, }); }} /> );

const openLogFileButton = ( <OutlineButton title="Open Log" className="mb-2" description="Open Log file" onClick={() => { postMessageToVsCode({ type: "openLog", minionTaskId: minionTask.id, }); }} /> ); END_REPLACE

//////////////////////////////////////////////////////////////////////////////// // Stage 5: Applying Changes ... ////////////////////////////////////////////////////////////////////////////////

CONSOLIDATION SUCCESFULY APPLIED

//////////////////////////////////////////////////////////////////////////////// // Stage 6: Preparing Changes (retry) ... ////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////// // Stage 7: Applying Changes (retry) ... ////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////// // Stage 8: Applying changes as comment (fall back) ... ////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////// // Stage 9: Finishing ... ////////////////////////////////////////////////////////////////////////////////

Finished (Execution Time: 00:02:10)

cielecki commented 1 year ago

Not enough data