Jupyter Notebook 版のレート比較機能を GitHub Pages へ移行 - #40
Merged
Conversation
Notebook 版と同じ「複数ユーザーのレーティング推移をレート帯の背景色つきで 比較する」機能を、TypeScript + React + Next.js (App Router / static export) の Web アプリとして再実装した。 - 複数の AtCoder ID を入力して比較でき、期間(開始日・終了日 / プリセット)で絞り込める - atcoder.jp は CORS ヘッダを返さないため、AtCoder Problems のプロキシ経由で履歴を取得する - master への push で GitHub Pages へ自動デプロイする workflow を追加 - 旧実装の compare_rating.ipynb はそのまま残している Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Recharts の既定のマーカーは中が白抜きで見づらいため、線と同じ色で塗りつぶす。 凡例も同じ理由でマーカー無しの線表示にした。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
点が密集したときに 1 つの塊に見えないよう、マーカーに白い縁線を付けた。 さらにグラフ幅と点数から間隔を見積もり、詰まっているほどマーカーを小さく、 間隔がほとんど無い場合はマーカーを描かないようにした。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
AtCoder 公式のレーティンググラフ (canvas) の配色を実際に読み取り、それに合わせた。 - レート帯は公式と同じ色(各レート色 + 不透明度 0.3 相当)を不透明で描画 - Y 軸の目盛りをレート帯の境界(400 刻み)に合わせ、罫線・軸を公式同様の淡い実線に - 公式は単一ユーザーのため線が灰色だが、ここでは複数ユーザーを判別する必要があるので 線とマーカーはユーザーごとの色にし、淡い帯の上でも沈まない色に調整した Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
サプライチェーン対策として、ワークフローで使うアクションをタグ指定から コミットハッシュ指定に変更した。あわせて Dependabot を設定し、ハッシュと バージョンコメントの更新を自動化する。 - actions/checkout v7.0.1, actions/setup-node v7.0.0, actions/upload-pages-artifact v5.0.0, actions/deploy-pages v5.0.0 の 各リリースタグが指すコミットへ固定(入力・出力の互換性は確認済み) - Dependabot は github-actions と npm を週次で更新。npm は minor/patch を 1 PR にまとめ、major のみ個別に上げる Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
compare_rating.ipynbで行っていた「複数ユーザーの AtCoder レーティング推移の比較」を、TypeScript + React + Next.js の静的サイトとして再実装し、GitHub Pages で公開できるようにしました。変更内容
Web アプリ
output: 'export'による静的書き出しグラフのデザイン
AtCoder 公式のレーティンググラフ (https://atcoder.jp/users/hiramekun) の canvas を実際に読み取って配色を合わせました。
デプロイ
masterへの push で GitHub Pages へ自動デプロイする workflow を追加NEXT_PUBLIC_BASE_PATHにリポジトリ名を渡して basePath を設定レビュー時に見てほしい点
/users/<user>/history/jsonは CORS ヘッダを返さずブラウザから直接取得できないため、AtCoder Problems (kenkoooo.com) が公開しているプロキシを経由しています。この依存を許容するかどうか。compare_rating.ipynbとrequirements.txtは削除せず残しています(README に旧実装として記載)。不要であれば削除します。マージ後に必要な手動設定
リポジトリの Settings → Pages → Build and deployment → Source を GitHub Actions に設定する必要があります。
動作確認
/AtCoderRatingGraph/配下で配信した状態の両方で確認npm run lint/npm run typecheck/npm run buildがすべて成功🤖 Generated with Claude Code