(project: Project)
| 207 | }; |
| 208 | |
| 209 | const handleProjectClick = async (project: Project) => { |
| 210 | // Check if we should show the warning |
| 211 | const warningKey = `mainBranchWarning_${project.id}`; |
| 212 | const hasShownWarning = localStorage.getItem(warningKey); |
| 213 | |
| 214 | if (!hasShownWarning) { |
| 215 | // Fetch the current branch before showing warning |
| 216 | try { |
| 217 | const response = await window.electronAPI.git.detectBranch(project.path); |
| 218 | if (response.success && response.data) { |
| 219 | setDetectedMainBranch(response.data); |
| 220 | } else { |
| 221 | setDetectedMainBranch('main'); |
| 222 | } |
| 223 | } catch (error) { |
| 224 | console.error('Failed to detect branch:', error); |
| 225 | setDetectedMainBranch('main'); |
| 226 | } |
| 227 | |
| 228 | // Show warning dialog |
| 229 | setPendingMainBranchProject(project); |
| 230 | setShowMainBranchWarning(true); |
| 231 | } else { |
| 232 | // Proceed directly |
| 233 | await openMainRepoSession(project); |
| 234 | } |
| 235 | }; |
| 236 | |
| 237 | const openMainRepoSession = async (project: Project) => { |
| 238 | try { |
no test coverage detected