From b5b6471b5a5420d1bd410907ac12570b8436702e Mon Sep 17 00:00:00 2001
From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>
Date: Fri, 23 Oct 2026 09:27:06 +0900
Subject: sanpi: 集計・全期間一覧・前後リンクを修正し、非公開に戻す
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/SanpiAllTable.astro | 52 ++++++++++++++++
src/components/SanpiChart.astro | 2 +-
src/components/SanpiPagination.astro | 93 ++++++++++++++++++++++++++++
src/components/starlight/Footer.astro | 40 +++++++++++-
src/content/docs/sanpi.mdx | 14 ++++-
src/content/docs/sanpi/ichiran.mdx | 35 +++++++++++
src/content/docs/sanpi/r8d.mdx | 26 ++++++++
src/styles/custom.css | 27 +++++++-
src/utils/sanpiStats.ts | 112 ++++++++++++++++++++++++++++++++--
9 files changed, 389 insertions(+), 12 deletions(-)
create mode 100644 src/components/SanpiAllTable.astro
create mode 100644 src/components/SanpiPagination.astro
create mode 100644 src/content/docs/sanpi/ichiran.mdx
diff --git a/src/components/SanpiAllTable.astro b/src/components/SanpiAllTable.astro
new file mode 100644
index 0000000..bd0f131
--- /dev/null
+++ b/src/components/SanpiAllTable.astro
@@ -0,0 +1,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 "";
+}
+---
+
+
+
+
+ | 議案 |
+ 年度 |
+ 定例会 |
+ 議決結果 |
+ 安竹 |
+
+
+
+ {
+ rows.map((row) => (
+
+ | {row.title} |
+
+ {row.year}
+ |
+ {row.session} |
+
+ {row.result}
+ |
+
+ {row.me}
+ |
+
+ ))
+ }
+
+
diff --git a/src/components/SanpiChart.astro b/src/components/SanpiChart.astro
index 7bc4174..643eafa 100644
--- a/src/components/SanpiChart.astro
+++ b/src/components/SanpiChart.astro
@@ -15,7 +15,7 @@ const rows = computeSanpiStats();
{rows.map(({ label, yes, no, yesPct, noPct, me }) => (
-
-
+
{label}
diff --git a/src/components/SanpiPagination.astro b/src/components/SanpiPagination.astro
new file mode 100644
index 0000000..294ad76
--- /dev/null
+++ b/src/components/SanpiPagination.astro
@@ -0,0 +1,93 @@
+---
+// 年度別の賛否一覧ページの末尾に、前年度・次年度へのリンクを
+// Starlight のページネーションと同じ見た目で表示する。
+// 年度別ページはサイドバーに登録していないため、Starlight 標準の
+// Pagination では前後関係が決まらない。ここで明示的にリンクを渡す。
+import { Icon } from "@astrojs/starlight/components";
+
+interface Link {
+ href: string;
+ label: string;
+}
+
+interface Props {
+ prev?: Link;
+ next?: Link;
+}
+
+const { prev, next } = Astro.props;
+---
+
+{
+ (prev || next) && (
+
+ )
+}
+
+
diff --git a/src/components/starlight/Footer.astro b/src/components/starlight/Footer.astro
index 65a61ce..63470a4 100644
--- a/src/components/starlight/Footer.astro
+++ b/src/components/starlight/Footer.astro
@@ -3,6 +3,7 @@ import Pagination from 'virtual:starlight/components/Pagination';
import config from 'virtual:starlight/user-config';
import { Icon } from '@astrojs/starlight/components';
import SocialShare from '../SocialShare.astro';
+import SanpiPagination from '../SanpiPagination.astro';
import { shareCaption } from '../../utils/share-caption';
const route = Astro.locals.starlightRoute;
@@ -32,6 +33,37 @@ function toJapaneseDateTime(date: Date): string {
}
const lastUpdated = route.lastUpdated;
+
+// 年度別の賛否一覧はサイドバーに登録していないため、Starlight 標準の
+// 前後ページは決まらない。URL から年度を判定し、前年度・次年度を渡す。
+const SANPI_YEARS = [
+ { key: 'r1d', label: '令和元年度の賛否一覧' },
+ { key: 'r2d', label: '令和2年度の賛否一覧' },
+ { key: 'r3d', label: '令和3年度の賛否一覧' },
+ { key: 'r4d', label: '令和4年度の賛否一覧' },
+ { key: 'r5d', label: '令和5年度の賛否一覧' },
+ { key: 'r6d', label: '令和6年度の賛否一覧' },
+ { key: 'r7d', label: '令和7年度の賛否一覧' },
+ { key: 'r8d', label: '令和8年度の賛否一覧' },
+];
+const sanpiMatch = Astro.url.pathname.match(/^\/sanpi\/(r\d+d)\/?$/);
+const sanpiIndex = sanpiMatch
+ ? SANPI_YEARS.findIndex((year) => year.key === sanpiMatch[1])
+ : -1;
+const sanpiPrev =
+ sanpiIndex > 0
+ ? {
+ href: `/sanpi/${SANPI_YEARS[sanpiIndex - 1].key}/`,
+ label: SANPI_YEARS[sanpiIndex - 1].label,
+ }
+ : undefined;
+const sanpiNext =
+ sanpiIndex >= 0 && sanpiIndex < SANPI_YEARS.length - 1
+ ? {
+ href: `/sanpi/${SANPI_YEARS[sanpiIndex + 1].key}/`,
+ label: SANPI_YEARS[sanpiIndex + 1].label,
+ }
+ : undefined;
---