diff --git a/frontend/src/components/settings/git/ActionButtons.jsx b/frontend/src/components/settings/git/ActionButtons.jsx new file mode 100644 index 0000000..30c00ba --- /dev/null +++ b/frontend/src/components/settings/git/ActionButtons.jsx @@ -0,0 +1,119 @@ +import React from 'react'; +import {Loader, RotateCcw, Download, CheckCircle, Plus} from 'lucide-react'; +import Tooltip from '../../ui/Tooltip'; + +const ActionButtons = ({ + isDevMode, + selectedOutgoingChanges, + selectedIncomingChanges, + selectionType, + commitMessage, + loadingAction, + onStageSelected, + onCommitSelected, + onRevertSelected, + onPullSelected, + getStageButtonTooltip, + getCommitButtonTooltip, + getRevertButtonTooltip +}) => { + return ( +
+ {isDevMode && ( + <> + {/* Stage */} + {selectedOutgoingChanges.length > 0 && + selectionType !== 'staged' && ( + + + + )} + {/* Commit */} + {selectedOutgoingChanges.length > 0 && + commitMessage.trim() && + selectionType !== 'unstaged' && ( + + + + )} + + )} + {/* Revert */} + {selectedOutgoingChanges.length > 0 && ( + + + + )} + {/* Pull */} + {selectedIncomingChanges.length > 0 && ( + + + + )} +
+ ); +}; + +export default ActionButtons; diff --git a/frontend/src/components/settings/git/StatusContainer.jsx b/frontend/src/components/settings/git/StatusContainer.jsx index a04e635..a6526b3 100644 --- a/frontend/src/components/settings/git/StatusContainer.jsx +++ b/frontend/src/components/settings/git/StatusContainer.jsx @@ -1,17 +1,9 @@ import React, {useState, useEffect} from 'react'; -import { - GitBranch, - GitMerge, - Loader, - RotateCcw, - Download, - CheckCircle, - Plus -} from 'lucide-react'; +import {GitBranch, GitMerge, Download} from 'lucide-react'; import ChangeTable from './ChangeTable'; -import Tooltip from '../../ui/Tooltip'; import CommitSection from './CommitMessage'; import {getRandomMessage, noChangesMessages} from '../../../utils/messages'; +import ActionButtons from './ActionButtons'; const StatusContainer = ({ status, @@ -177,105 +169,21 @@ const StatusContainer = ({ isDevMode={isDevMode} /> - {/* Action Buttons */} -
- {isDevMode && ( - <> - {selectedOutgoingChanges.length > 0 && - selectionType !== 'staged' && ( - - - - )} - - {selectedOutgoingChanges.length > 0 && - commitMessage.trim() && - selectionType !== 'unstaged' && ( - - - - )} - - )} - - {selectedOutgoingChanges.length > 0 && ( - - - - )} - - {selectedIncomingChanges.length > 0 && ( - - - - )} -
+ ); };