Move a bunch of git ops to use the git binary (#302)

This commit is contained in:
Gregory Schier
2025-11-17 15:22:39 -08:00
committed by GitHub
parent 84219571e8
commit 9c52652a5e
43 changed files with 1238 additions and 1176 deletions

View File

@@ -16,7 +16,7 @@ export function Banner({ children, className, color }: BannerProps) {
color && 'bg-surface',
`x-theme-banner--${color}`,
'border border-border border-dashed',
'px-4 py-2 rounded-lg select-auto',
'px-4 py-2 rounded-lg select-auto cursor-auto',
'overflow-auto text-text',
'mb-auto', // Don't stretch all the way down if the parent is in grid or flexbox
)}

View File

@@ -75,6 +75,7 @@ import {
GitPullRequestIcon,
GripVerticalIcon,
HandIcon,
HardDriveDownloadIcon,
HistoryIcon,
HomeIcon,
ImportIcon,
@@ -202,6 +203,7 @@ const icons = {
grip_vertical: GripVerticalIcon,
circle_off: CircleOffIcon,
hand: HandIcon,
hard_drive_download: HardDriveDownloadIcon,
help: CircleHelpIcon,
history: HistoryIcon,
house: HomeIcon,

View File

@@ -16,7 +16,18 @@ import type { InputProps } from './Input';
import { Label } from './Label';
import { HStack } from './Stacks';
export type PlainInputProps = Omit<InputProps, 'wrapLines' | 'onKeyDown' | 'type' | 'stateKey'> &
export type PlainInputProps = Omit<
InputProps,
| 'wrapLines'
| 'onKeyDown'
| 'type'
| 'stateKey'
| 'autocompleteVariables'
| 'autocompleteFunctions'
| 'autocomplete'
| 'extraExtensions'
| 'forcedEnvironmentId'
> &
Pick<HTMLAttributes<HTMLInputElement>, 'onKeyDownCapture'> & {
onFocusRaw?: HTMLAttributes<HTMLInputElement>['onFocus'];
type?: 'text' | 'password' | 'number';

View File

@@ -1,28 +1,27 @@
import type { PromptTextRequest } from '@yaakapp-internal/plugins';
import type { FormEvent, ReactNode } from 'react';
import { useCallback, useState } from 'react';
import type { FormInput, JsonPrimitive } from '@yaakapp-internal/plugins';
import type { FormEvent } from 'react';
import { useCallback, useRef, useState } from 'react';
import { generateId } from '../../lib/generateId';
import { DynamicForm } from '../DynamicForm';
import { Button } from './Button';
import { PlainInput } from './PlainInput';
import { HStack } from './Stacks';
export type PromptProps = Omit<PromptTextRequest, 'id' | 'title' | 'description'> & {
description?: ReactNode;
export interface PromptProps {
inputs: FormInput[];
onCancel: () => void;
onResult: (value: string | null) => void;
};
onResult: (value: Record<string, JsonPrimitive> | null) => void;
confirmText?: string;
cancelText?: string;
}
export function Prompt({
onCancel,
label,
defaultValue,
placeholder,
password,
inputs,
onResult,
required,
confirmText,
cancelText,
confirmText = 'Confirm',
cancelText = 'Cancel',
}: PromptProps) {
const [value, setValue] = useState<string>(defaultValue ?? '');
const [value, setValue] = useState<Record<string, JsonPrimitive>>({});
const handleSubmit = useCallback(
(e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
@@ -31,20 +30,14 @@ export function Prompt({
[onResult, value],
);
const id = 'prompt.form.' + useRef(generateId()).current;
return (
<form
className="grid grid-rows-[auto_auto] grid-cols-[minmax(0,1fr)] gap-4 mb-4"
onSubmit={handleSubmit}
>
<PlainInput
autoSelect
required={required}
placeholder={placeholder ?? 'Enter text'}
type={password ? 'password' : 'text'}
label={label}
defaultValue={defaultValue}
onChange={setValue}
/>
<DynamicForm inputs={inputs} onChange={setValue} data={value} stateKey={id} />
<HStack space={2} justifyContent="end">
<Button onClick={onCancel} variant="border" color="secondary">
{cancelText || 'Cancel'}

View File

@@ -42,7 +42,7 @@ export function Toast({ children, open, onClose, timeout, action, icon, color }:
[open],
);
const toastIcon = icon === null ? null : icon ?? (color && color in ICONS && ICONS[color]);
const toastIcon = icon === null ? null : (icon ?? (color && color in ICONS && ICONS[color]));
return (
<m.div
@@ -64,7 +64,7 @@ export function Toast({ children, open, onClose, timeout, action, icon, color }:
<div className="px-3 py-3 flex items-start gap-2 w-full">
{toastIcon && <Icon icon={toastIcon} color={color} className="mt-1" />}
<VStack space={2} className="w-full">
<div>{children}</div>
<div className="select-auto">{children}</div>
{action?.({ hide: onClose })}
</VStack>
</div>