summaryrefslogtreecommitdiff
path: root/web/templates/projects.tmpl
blob: ce75454b0f193b5e636a85b4151403bf935f4c2d (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{{define "projects"}}<!doctype html>
<html lang="en" data-live="1">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{.Title}}</title>
<link rel="icon" type="image/svg+xml" href="/bemtevi.svg">
<link rel="stylesheet" href="/style.css">
<script>
// Match project pages: wear the saved theme before first paint, and load the
// installed-theme stylesheet now only when that saved choice requires it.
{const d = document.documentElement, t = localStorage.getItem("notevi-theme");
 if (t && t !== "system") d.dataset.theme = t;
 if (t && !/^(system|dark|light)$/.test(t)) {
   const l = document.createElement("link");
   l.rel = "stylesheet"; l.id = "themescss"; l.href = "/themes.css";
   document.head.append(l);
 }
 d.dataset.mode = localStorage.getItem("notevi-mode") || "trace";}
</script>
<script src="/app.js" defer></script>
</head>
<body class="projects">
<nav aria-label="projects" id="nav">
  <header><a class="brand" href="/"><img class="mark" src="/bemtevi.svg" alt="" width="20" height="20">{{.Title}}</a></header>
  <p class="meta">one process · every local notevi sidecar</p>
  <input id="projectfind" class="find" type="search" placeholder="find project…" aria-label="find project" autocomplete="off" spellcheck="false">
  <form method="post" action="/projects/refresh" class="project-refresh">
    <button type="submit">refresh repositories</button>
  </form>
  <p class="meta">scans <code>{{.ScanRoot}}</code></p>
  <p class="meta">last refresh {{.Scanned}}</p>
  <footer>
    <span>selection and scan results stay in memory</span>
    <div class="themepick" id="themepick"
         data-js="/themes.js" data-css="/themes.css"
         data-dark="{{.Theme.Name}}" data-light="{{.Light.Name}}"
         data-darkid="{{.Theme.ID}}" data-lightid="{{.Light.ID}}">
      <button type="button" id="themebtn" aria-haspopup="listbox" aria-expanded="false"
              title="theme — every one installed here (T)">theme</button>
      <div class="thememenu" id="thememenu" hidden>
        <input id="themefind" type="search" placeholder="filter themes…" aria-label="filter themes"
               role="combobox" aria-controls="themelist" aria-autocomplete="list"
               autocomplete="off" spellcheck="false">
        <ul id="themelist" role="listbox" aria-label="themes"></ul>
        <p class="meta hint">↑↓ preview · enter keeps · esc puts it back</p>
      </div>
    </div>
  </footer>
</nav>

<main class="projects-main">
  <header class="filehead">
    <h1>Projects</h1>
    <p class="meta">Choose a notevi log, start one in a jj repository, or colocate jj with an existing Git repository.</p>
  </header>
  {{if .Message}}<p class="ok project-message">{{.Message}}</p>{{end}}
  {{if .Err}}<p class="err project-message">{{.Err}}</p>{{end}}

  <section>
    <h2>Logs <span class="meta">— {{len .Active}} repositories with a private sidecar</span></h2>
    <div class="project-grid">
    {{range .Active}}
      <article class="project-card" data-project="{{.Name}} {{.Relative}}">
        <header><h3><a href="/p/{{.ID}}/">{{.Name}}</a></h3><span class="project-state active">log</span></header>
        <p class="project-path" title="{{.Path}}"><code>{{.Relative}}</code></p>
        <p class="meta">{{.Entries}} entries · {{.Notes}} notes · {{.Agents}} agents · {{.Updated}}</p>
        {{if gt (len .Workspaces) 1}}<p class="meta">{{len .Workspaces}} jj workspaces share this log</p>{{end}}
        {{if .Err}}<p class="err">{{.Err}}</p>{{end}}
        <a class="project-action" href="/p/{{.ID}}/">open project</a>
      </article>
    {{end}}
    {{if not .Active}}<p class="meta hint">no notevi sidecars found yet</p>{{end}}
    </div>
  </section>

  <section>
    <h2>Ready to start <span class="meta">— {{len .Ready}} jj repositories without a notevi sidecar</span></h2>
    <div class="project-grid">
    {{range .Ready}}
      <article class="project-card" data-project="{{.Name}} {{.Relative}}">
        <header><h3>{{.Name}}</h3><span class="project-state">jj</span></header>
        <p class="project-path" title="{{.Path}}"><code>{{.Relative}}</code></p>
        {{if gt (len .Workspaces) 1}}<p class="meta">{{len .Workspaces}} workspaces</p>{{end}}
        {{if .Err}}<p class="err">{{.Err}}</p>{{end}}
        <form method="post" action="/projects/{{.ID}}/start">
          <button type="submit">start private sidecar</button>
        </form>
      </article>
    {{end}}
    {{if not .Ready}}<p class="meta hint">every detected jj repository already has a sidecar</p>{{end}}
    </div>
  </section>

  <section>
    <h2>Git repositories <span class="meta">— {{len .Git}} without jj metadata</span></h2>
    <p class="meta">Initializing adds colocated <code>.jj</code> metadata; it does not create a sidecar until you choose “start private sidecar”.</p>
    <div class="project-grid">
    {{range .Git}}
      <article class="project-card" data-project="{{.Name}} {{.Relative}}">
        <header><h3>{{.Name}}</h3><span class="project-state git">git</span></header>
        <p class="project-path" title="{{.Path}}"><code>{{.Relative}}</code></p>
        <form method="post" action="/git/{{.ID}}/init">
          <button type="submit">initialize colocated jj</button>
        </form>
      </article>
    {{end}}
    {{if not .Git}}<p class="meta hint">no Git-only repositories detected</p>{{end}}
    </div>
  </section>
</main>
</body>
</html>{{end}}