mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix issues (#136)
* fix: prevent delete button click when card is not swiped open * refactor: improve CreateRepoInput type safety * security: require AUTH_SECRET and use secure random generation * fix: SSH key path validation, async passphrase stripping, and port handling * fix: use correct console methods for logger levels * Add error handling to DB update functions and improve migration logging * Add error handling for session lookup in auth middleware * Add structured git error handling with user-friendly messages - Parse git errors with specific error codes (AUTH_FAILED, REPO_NOT_FOUND, PUSH_REJECTED, MERGE_CONFLICT, etc.) and appropriate HTTP status codes - Return structured error responses with summary and detail from backend - Add GitErrorBanner component for better error display in UI - Add optional onError callback to useGit hook for external error handling * Make IPC server initialization/disposal async and fix SSH host key handler * add try-catch error handling in frontend lib utilities * remove unresolved promise handlers in speech synthesizer callbacks * Extract error types to shared package * Import GitErrorCode from shared package * Refactor API layer to use shared FetchError and fetchWrapper * Update prompt parser and source control components * Extract MCP server list to separate component with improved badge menu UX * merge useSettingsDialogUrl into useSettingsDialog and extract getRepoDisplayName utility * add separate loading state for passkey sign in * refactor hooks: use fetchWrapper, improve error handling, add proper types * replace browser confirm() with DeleteDialog component in settings * fix: add missing variables parameter in React Query onError callbacks * Refactor message parts to use separate Zustand store * Update QuestionPrompt styling for light/dark mode
This commit is contained in:
1 parent
7f7d106c28
commit
5de419ee28
75 files changed
+1990
-1367
No files matched your search
@@ -1,10 +1,12 @@
|
||||
import { useState } from 'react'
|
||||
import { FetchError } from '@opencode-manager/shared'
|
||||
import { useGitStatus, getApiErrorMessage } from '@/api/git'
|
||||
|
||||
import { useGit } from '@/hooks/useGit'
|
||||
import { ChangesTab } from './ChangesTab'
|
||||
import { CommitsTab } from './CommitsTab'
|
||||
import { BranchesTab } from './BranchesTab'
|
||||
import { GitErrorBanner } from './GitErrorBanner'
|
||||
import { FileDiffView } from '@/components/file-browser/FileDiffView'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
||||
@@ -23,7 +25,6 @@ import {
|
||||
} from 'lucide-react'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useMobile } from '@/hooks/useMobile'
|
||||
import { showToast } from '@/lib/toast'
|
||||
|
||||
interface SourceControlPanelProps {
|
||||
repoId: number
|
||||
@@ -48,15 +49,26 @@ export function SourceControlPanel({
|
||||
}: SourceControlPanelProps) {
|
||||
const [activeTab, setActiveTab] = useState<Tab>('changes')
|
||||
const [selectedFile, setSelectedFile] = useState<{path: string, staged: boolean} | undefined>()
|
||||
const [gitError, setGitError] = useState<{ summary: string; detail?: string } | null>(null)
|
||||
const { data: status } = useGitStatus(repoId)
|
||||
const git = useGit(repoId)
|
||||
const isMobile = useMobile()
|
||||
|
||||
const handleGitError = (error: unknown) => {
|
||||
if (error instanceof FetchError) {
|
||||
setGitError({ summary: getApiErrorMessage(error), detail: error.detail })
|
||||
} else {
|
||||
setGitError({ summary: getApiErrorMessage(error) })
|
||||
}
|
||||
}
|
||||
|
||||
const git = useGit(repoId, handleGitError)
|
||||
|
||||
const handleGitAction = async (action: () => Promise<unknown>) => {
|
||||
try {
|
||||
setGitError(null)
|
||||
await action()
|
||||
} catch (error: unknown) {
|
||||
const message = getApiErrorMessage(error)
|
||||
showToast.error(message)
|
||||
} catch {
|
||||
// error already handled by useGit's onError -> handleGitError
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +150,10 @@ export function SourceControlPanel({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{gitError && (
|
||||
<GitErrorBanner error={gitError} onDismiss={() => setGitError(null)} />
|
||||
)}
|
||||
|
||||
<div className="flex border-b border-border flex-shrink-0">
|
||||
{tabs.map((tab) => {
|
||||
const Icon = tab.icon
|
||||
@@ -175,6 +191,7 @@ export function SourceControlPanel({
|
||||
onFileSelect={(path, staged) => setSelectedFile({ path, staged })}
|
||||
selectedFile={selectedFile}
|
||||
isMobile={isMobile}
|
||||
onError={handleGitError}
|
||||
/>
|
||||
)}
|
||||
{activeTab === 'commits' && (
|
||||
|
||||
Reference in new issue
Block a user