mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 00:27:24 +00:00
Don't dismiss error just because Force Pull button was clicked
This commit is contained in:
1 file changed
+17
-33
@@ -1,5 +1,5 @@
|
|||||||
import { Errors as GitErrors } from 'isomorphic-git';
|
import { Errors as GitErrors } from 'isomorphic-git';
|
||||||
import { AlertTriangle, X, ArrowDown, ArrowUp } from 'lucide-react';
|
import { AlertTriangle, X, ArrowDown } from 'lucide-react';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||||
|
|
||||||
@@ -16,10 +16,7 @@ export function SyncStepError({ error, onDismiss, onForcePull, onForcePush, onPu
|
|||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={onForcePull}
|
||||||
onDismiss();
|
|
||||||
onForcePull();
|
|
||||||
}}
|
|
||||||
className="w-full hover:bg-destructive-foreground/20 border-destructive-foreground/20"
|
className="w-full hover:bg-destructive-foreground/20 border-destructive-foreground/20"
|
||||||
>
|
>
|
||||||
<AlertTriangle className="h-4 w-4" />
|
<AlertTriangle className="h-4 w-4" />
|
||||||
@@ -31,10 +28,7 @@ export function SyncStepError({ error, onDismiss, onForcePull, onForcePush, onPu
|
|||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
onClick={() => {
|
onClick={onForcePush}
|
||||||
onDismiss();
|
|
||||||
onForcePush();
|
|
||||||
}}
|
|
||||||
className="w-full hover:bg-destructive-foreground/20 border-destructive-foreground/20"
|
className="w-full hover:bg-destructive-foreground/20 border-destructive-foreground/20"
|
||||||
>
|
>
|
||||||
<AlertTriangle className="h-4 w-4" />
|
<AlertTriangle className="h-4 w-4" />
|
||||||
@@ -42,6 +36,17 @@ export function SyncStepError({ error, onDismiss, onForcePull, onForcePush, onPu
|
|||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const renderPullButton = () => (
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={onPull}
|
||||||
|
>
|
||||||
|
<ArrowDown className="h-4 w-4" />
|
||||||
|
Pull
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
|
||||||
const renderDismissButton = () => (
|
const renderDismissButton = () => (
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
@@ -104,30 +109,9 @@ export function SyncStepError({ error, onDismiss, onForcePull, onForcePush, onPu
|
|||||||
</AlertDescription>
|
</AlertDescription>
|
||||||
{renderDismissButton()}
|
{renderDismissButton()}
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-2 gap-2">
|
<div className="flex gap-2">
|
||||||
<Button
|
{renderPullButton()}
|
||||||
variant="outline"
|
{renderForcePushButton()}
|
||||||
size="sm"
|
|
||||||
onClick={() => {
|
|
||||||
onDismiss();
|
|
||||||
onPull();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ArrowDown className="h-4 w-4" />
|
|
||||||
Pull First
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="sm"
|
|
||||||
onClick={() => {
|
|
||||||
onDismiss();
|
|
||||||
onForcePush();
|
|
||||||
}}
|
|
||||||
className="hover:bg-destructive-foreground/20 border-destructive-foreground/20"
|
|
||||||
>
|
|
||||||
<ArrowUp className="h-4 w-4" />
|
|
||||||
Force Push
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Alert>
|
</Alert>
|
||||||
|
|||||||
Reference in new issue
Block a user