diff --git a/frontend/src/components/settings/SettingsBranchModal.jsx b/frontend/src/components/settings/SettingsBranchModal.jsx index 995f8bc..d02a29a 100644 --- a/frontend/src/components/settings/SettingsBranchModal.jsx +++ b/frontend/src/components/settings/SettingsBranchModal.jsx @@ -13,7 +13,8 @@ import { GitBranchPlus, ArrowRightCircle, Loader, - CloudUpload + CloudUpload, + Search } from 'lucide-react'; import Tooltip from '../ui/Tooltip'; import Alert from '../ui/Alert'; @@ -27,6 +28,8 @@ const SettingsBranchModal = ({ isDevMode }) => { const [branches, setBranches] = useState([]); + const [filteredBranches, setFilteredBranches] = useState([]); + const [searchTerm, setSearchTerm] = useState(''); const [branchOffMode, setBranchOffMode] = useState(null); const [newBranchName, setNewBranchName] = useState(''); const [validBranchName, setValidBranchName] = useState(true); @@ -40,6 +43,14 @@ const SettingsBranchModal = ({ } }, [isOpen]); + useEffect(() => { + setFilteredBranches( + branches.filter(branch => + branch.name.toLowerCase().includes(searchTerm.toLowerCase()) + ) + ); + }, [branches, searchTerm]); + const fetchBranches = async () => { try { const response = await getBranches(); @@ -59,6 +70,7 @@ const SettingsBranchModal = ({ setValidBranchName(true); setBranchToDelete(null); setLoadingAction(''); + setSearchTerm(''); }; const handleCheckout = async branchName => { @@ -200,171 +212,191 @@ const SettingsBranchModal = ({ }; return ( - -
-
-

- Branches -

-
    - {branches.map((branch, index) => ( -
  • -
    -
    - - {branch.name || 'Unknown Branch'} - - - {branch.isLocal && !branch.isRemote - ? '(Local)' - : !branch.isLocal && branch.isRemote - ? '(Remote)' - : '(Local & Remote)'} - -
    -
    - {branch.name !== currentBranch && ( - - - - )} - - - - {branch.isLocal && - !branch.isRemote && - isDevMode && ( - - - - )} - {(branch.isLocal || - (branch.isRemote && isDevMode)) && - branch.name !== currentBranch && - branch.name.toLowerCase() !== - 'stable' && ( - - - - )} + +
    +
    +
    + setSearchTerm(e.target.value)} + className='w-full pl-10 pr-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400' + /> + +
    - {branch.isRemote && ( - +
    +
      + {filteredBranches.map((branch, index) => ( +
    • +
      +
      + + {branch.name || 'Unknown Branch'} + + + {branch.isLocal && !branch.isRemote + ? '(Local)' + : !branch.isLocal && + branch.isRemote + ? '(Remote)' + : '(Local & Remote)'} + +
      +
      + {/* Keep existing buttons with updated styles */} + {branch.name !== currentBranch && ( + + + + )} + - )} -
      -
    • - ))} -
    + {branch.isLocal && + !branch.isRemote && + isDevMode && ( + + + + )} + {(branch.isLocal || + (branch.isRemote && isDevMode)) && + branch.name !== currentBranch && + branch.name.toLowerCase() !== + 'stable' && ( + + + + )} + {branch.isRemote && ( + + + + )} +
    +
  • + ))} +
+
+ {branchOffMode && ( -
-

+
+

Create New Branch

@@ -375,11 +407,11 @@ const SettingsBranchModal = ({ validateBranchName(e.target.value) } placeholder={`New branch from ${branchOffMode}`} - className={`flex-grow p-2 border rounded bg-gray-800 text-gray-300 focus:ring-2 focus:ring-blue-500 transition-all ${ + className={`flex-grow p-2 rounded-lg border ${ !validBranchName - ? 'border-red-500' - : 'border-gray-600' - }`} + ? 'border-red-500 dark:border-red-400' + : 'border-gray-300 dark:border-gray-600' + } bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400`} />
)} + {branchToDelete && ( -
+

Are you sure you want to delete the branch{' '} - - {branchToDelete} - - ? This action cannot be undone. + {branchToDelete}? This action + cannot be undone.

diff --git a/frontend/src/components/settings/SettingsPage.jsx b/frontend/src/components/settings/SettingsPage.jsx index ca88330..d5e7e13 100644 --- a/frontend/src/components/settings/SettingsPage.jsx +++ b/frontend/src/components/settings/SettingsPage.jsx @@ -593,7 +593,11 @@ const SettingsPage = () => {

Git Repository Settings + + {isDevMode ? 'Dev Mode: Enabled' : 'Dev Mode: Disabled'} +

+ {!settings && (