File size: 1,292 Bytes
3c07134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { FormEvent } from "react";
import { t } from "../i18n";

interface Props {
  url: string;
  token: string;
  busy: boolean;
  onUrl: (v: string) => void;
  onToken: (v: string) => void;
  onSubmit: () => void;
}

export function RepoInputBar({ url, token, busy, onUrl, onToken, onSubmit }: Props) {
  const m = t();
  const submit = (e: FormEvent) => {
    e.preventDefault();
    if (!busy && url.trim()) onSubmit();
  };
  return (
    <form className="card" onSubmit={submit}>
      <div className="row">
        <input
          type="text"
          value={url}
          onChange={(e) => onUrl(e.target.value)}
          placeholder={m.urlPlaceholder}
          aria-label="GitHub repository URL"
          autoComplete="off"
        />
        <button type="submit" disabled={busy || !url.trim()}>
          {busy ? m.launching : m.launch}
        </button>
      </div>
      <div className="row" style={{ marginTop: ".65rem" }}>
        <input
          type="password"
          value={token}
          onChange={(e) => onToken(e.target.value)}
          placeholder={m.tokenOptional}
          autoComplete="off"
          aria-label="GitHub token"
        />
      </div>
      <div className="hint">
        {m.tokenHint} · {m.noSecrets}
      </div>
    </form>
  );
}