issue-map 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- <title>開發地圖</title>
1
+ <title>Dev map</title>
2
2
  <link rel="preconnect" href="https://fonts.googleapis.com" />
3
3
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
4
4
  <link
@@ -35,8 +35,16 @@
35
35
  --t3: #8c5a24;
36
36
  --t4: #2f7a5a;
37
37
 
38
- --display: 'Bricolage Grotesque', 'Noto Sans TC', 'PingFang TC', sans-serif;
39
- --body: 'Public Sans', 'Noto Sans TC', 'PingFang TC', system-ui, sans-serif;
38
+ /*
39
+ * CJK 的部分只到 Noto Sans TC 為止是網路字型,簡體與日文交給系統字型(PingFang SC、
40
+ * Hiragino、YaHei、Meiryo)——四種語言各拉一套 Noto 會讓這頁多下載幾百 KB,而這是本機
41
+ * 開發用的頁面。
42
+ */
43
+ --cjk:
44
+ 'Noto Sans TC', 'PingFang TC', 'PingFang SC', 'Hiragino Sans', 'Microsoft JhengHei',
45
+ 'Microsoft YaHei', Meiryo;
46
+ --display: 'Bricolage Grotesque', var(--cjk), sans-serif;
47
+ --body: 'Public Sans', var(--cjk), system-ui, sans-serif;
40
48
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
41
49
  color-scheme: light;
42
50
  }
@@ -143,6 +151,14 @@
143
151
  flex-direction: column;
144
152
  gap: 14px;
145
153
  }
154
+ /* 抬頭第一行:左邊是 repo 與抓取時間,右邊是語言。 */
155
+ .masthead-top {
156
+ display: flex;
157
+ flex-wrap: wrap;
158
+ align-items: center;
159
+ justify-content: space-between;
160
+ gap: 8px 16px;
161
+ }
146
162
  .eyebrow {
147
163
  font-family: var(--mono);
148
164
  font-size: 11px;
@@ -151,6 +167,21 @@
151
167
  text-transform: uppercase;
152
168
  color: var(--faint);
153
169
  }
170
+ /* 語言用原生 select:鍵盤與行動裝置都不必自己實作,而且四個選項不值得一套下拉選單。 */
171
+ .lang {
172
+ font-family: var(--mono);
173
+ font-size: 11.5px;
174
+ color: var(--muted);
175
+ background: var(--card);
176
+ border: 1px solid var(--line-strong);
177
+ border-radius: 2px;
178
+ padding: 4px 8px;
179
+ cursor: pointer;
180
+ }
181
+ .lang:hover {
182
+ color: var(--ink);
183
+ border-color: var(--ink);
184
+ }
154
185
  h1 {
155
186
  font-family: var(--display);
156
187
  font-weight: 700;
@@ -844,8 +875,11 @@
844
875
 
845
876
  <div class="page">
846
877
  <header class="masthead">
847
- <div class="eyebrow" id="eyebrow"></div>
848
- <h1 id="page-title">開發地圖</h1>
878
+ <div class="masthead-top">
879
+ <div class="eyebrow" id="eyebrow"></div>
880
+ <select class="lang" id="lang"></select>
881
+ </div>
882
+ <h1 id="page-title"></h1>
849
883
  <p class="lede" id="lede"></p>
850
884
  <div class="stats" id="stats"></div>
851
885
  </header>
@@ -857,20 +891,17 @@
857
891
  <section class="group">
858
892
  <div class="list-head">
859
893
  <div class="group-head">
860
- <h2>清單</h2>
894
+ <h2 id="list-title"></h2>
861
895
  <span class="sub" id="list-sub"></span>
862
896
  </div>
863
- <div class="tabs" id="tabs" role="group" aria-label="狀態篩選"></div>
897
+ <div class="tabs" id="tabs" role="group"></div>
864
898
  </div>
865
899
  <div class="rows" id="rows"></div>
866
900
  </section>
867
901
 
868
902
  <footer>
869
- <div>狀態的權威是 GitHub Issues。這一頁是快照,頁面上不能改狀態。</div>
870
- <div>
871
- 重跑 <code>bun run issue-map</code> 產檔,或
872
- <code>bun run issue-map:serve</code> 讓重新整理就是最新。
873
- </div>
903
+ <div id="foot-truth"></div>
904
+ <div id="foot-refresh"></div>
874
905
  <div id="foot-config"></div>
875
906
  </footer>
876
907
  </div>
@@ -11,7 +11,7 @@
11
11
  * 帶進快照的 issue:所有 open issue,加上仍被 open issue 牽著的 closed issue。後者畫成「已完成」
12
12
  * 的節點讓進度看得見,沒人牽著之後自然消失。
13
13
  *
14
- * **要畫哪個 repo**:從 cwd 的 git 推斷,不必填——在那個 repo 裡跑 `bunx github:gunter1020/issue-map`
14
+ * **要畫哪個 repo**:從 cwd 的 git 推斷,不必填——在那個 repo 裡跑 `bunx issue-map@latest`
15
15
  * 就好。要指定別的 repo 設 `GH_REPO`。標籤字彙與 parent 的慣例都能用環境變數調,見底下的
16
16
  * `CONFIG`,整份對照表在 README。
17
17
  *
@@ -33,6 +33,7 @@ import {
33
33
  criticalPathOf,
34
34
  groupsOf,
35
35
  type MapIssue,
36
+ type NextStep,
36
37
  type Snapshot,
37
38
  type Status,
38
39
  } from './issue-map-model.ts'
@@ -228,16 +229,23 @@ function describeIssue(raw: Issue, context: Context): MapIssue {
228
229
  return waitingFor.length ? 'blocked' : 'ready'
229
230
  }
230
231
 
231
- function nextStepOf(status: Status): string {
232
- if (status === 'done') return ''
233
- if (status === 'triage') return CONFIG.triageCommand
234
- if (status === 'active') return assignees.join(', ') || CONFIG.active[0] || '進行中'
232
+ /** 只算出「是哪一種下一步」。句子是頁面的事,在 `issue-map-i18n.ts` 依語言組出來。 */
233
+ function nextStepOf(status: Status): NextStep {
234
+ if (status === 'done') return { kind: 'none' }
235
+ if (status === 'triage') return { kind: 'command', command: CONFIG.triageCommand }
236
+ if (status === 'active') {
237
+ // 沒有 assignee 但掛了 active 標籤時,能講的就只有那個標籤名。
238
+ const label = CONFIG.active[0]
239
+ return { kind: 'active', who: assignees.length ? assignees : label ? [label] : [] }
240
+ }
235
241
  if (isParent) {
236
242
  const left = context.openChildren.get(raw.number) ?? 0
237
- return left ? `等 ${left} 張子票關完` : '子票全關,可以關掉了'
243
+ return left ? { kind: 'waitChildren', count: left } : { kind: 'parentReady' }
238
244
  }
239
- if (status === 'blocked') return `等 ${waitingFor.map((number) => `#${number}`).join(' ')}`
240
- return has(CONFIG.human) ? '人工實作' : CONFIG.implementCommand
245
+ if (status === 'blocked') return { kind: 'waitIssues', issues: waitingFor }
246
+ return has(CONFIG.human)
247
+ ? { kind: 'manual' }
248
+ : { kind: 'command', command: CONFIG.implementCommand }
241
249
  }
242
250
 
243
251
  const status = statusOf()