aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/components/SanpiAllTable.astro
blob: bd0f131b8357931dbe8e3071b5c7ccf1aed8eeb2 (plain)
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
---
// 全期間の議案賛否一覧。年度別ページの表から安竹洋平の列だけを取り出し、
// 市側の議案・議員提出の議案・請願に分けて表示する。
import { computeSanpiBills, type BillType } from "@/utils/sanpiStats";

interface Props {
  type: BillType;
}

const { type } = Astro.props;
const rows = computeSanpiBills().filter((row) => row.type === type);

const PASS = ["可決", "認定", "採択", "同意", "承認"];
const STOP = ["否決", "不採択"];

function kekkaClass(result: string): string {
  if (STOP.some((key) => result.includes(key))) return "stop";
  if (PASS.some((key) => result.includes(key))) return "pass";
  return "";
}
---

<table>
  <thead>
    <tr>
      <th>議案</th>
      <th>年度</th>
      <th>定例会</th>
      <th>議決結果</th>
      <th><span class="sanpi-me">安竹</span></th>
    </tr>
  </thead>
  <tbody>
    {
      rows.map((row) => (
        <tr>
          <td>{row.title}</td>
          <td>
            <a href={row.yearHref}>{row.year}</a>
          </td>
          <td>{row.session}</td>
          <td>
            <span class={`sanpi-kekka ${kekkaClass(row.result)}`}>{row.result}</span>
          </td>
          <td>
            <span class="sanpi-me">{row.me}</span>
          </td>
        </tr>
      ))
    }
  </tbody>
</table>