Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/SantaClaas/gigit. git client
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import { createSignal } from "solid-js";
/** * Opening a repository by path. * * A plain form, because a native folder picker needs the Tauri dialog plugin * and that is a dependency this change does not need. The picker arrives with * the repository-picker work, along with recent repositories; until then a path * still gets you in, and anything below a repository's root works because the * Rust side searches upwards the way git does. */export default function OpenRepository(props: { busy: boolean; onOpen: (path: string) => void }) { const [path, setPath] = createSignal("");
function onSubmit(event: SubmitEvent) { event.preventDefault();
const trimmed = path().trim(); if (trimmed) props.onOpen(trimmed); }
return ( <form onSubmit={onSubmit} class="ml-auto flex items-center gap-2"> <label for="repository-path" class="text-label-lg text-on-surface-variant"> Repository </label> <input id="repository-path" name="path" type="text" required spellcheck={false} autocapitalize="off" autocorrect="off" placeholder="/path/to/repository" value={path()} onInput={(event) => setPath(event.currentTarget.value)} class="w-72 rounded-small border border-outline bg-surface px-3 py-1.5 text-body-md text-on-surface focus-visible:outline-2 focus-visible:outline-offset-[-1px] focus-visible:outline-primary" /> <button type="submit" disabled={props.busy} class="rounded-large bg-primary px-4 py-2 text-label-lg text-on-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:opacity-50" > {props.busy ? "Opening…" : "Open"} </button> </form> );}