Skip to content

add: アプリを持っていない人でもQRコードを読み込めば、相手のユーザーの視聴履歴を閲覧できるサイトを実装。#136

Merged
KOU050223 merged 7 commits intodevelopfrom
AliceWonerfulWorld/feature/default-sort-year-desc
Aug 16, 2025
Merged

add: アプリを持っていない人でもQRコードを読み込めば、相手のユーザーの視聴履歴を閲覧できるサイトを実装。#136
KOU050223 merged 7 commits intodevelopfrom
AliceWonerfulWorld/feature/default-sort-year-desc

Conversation

@AliceWonerfulWorld
Copy link
Collaborator

Pull Request

概要

変更内容

関連Issue

Closes #

テスト

  • 単体テスト実行済み
  • 結合テスト実行済み
  • 手動テスト実行済み

スクリーンショット(該当する場合)


AI レビューガイドライン(クリックして展開)

Copilotレビューガイドライン

レビュー方針

必ず日本語でレビューコメントを記載すること

レビューレベル

レビューコメントには、以下のプレフィックスを必ず付けること:

  • [ask] - 回答必須:実装の意図や設計について確認が必要
  • [must] - 修正必須:セキュリティ、バグ、重大な設計問題
  • [imo] - 修正任意:パフォーマンス改善、可読性向上
  • [nits] - 細かな修正:typo、フォーマット、命名規則など
  • [next] - 今後の改善:今回のPRでは対応不要だが将来的な改善点
  • [good] - 良い実装:評価すべき実装や設計
  • [suggestion] - 提案:より良い実装方法の提案

チェック項目

コード品質

  • 命名規則の統一性(変数、関数、クラス名がキャメルケースやスネークケースで適切)
  • コードの可読性と保守性
  • DRY原則の遵守(重複コードの排除)
  • SOLID原則の適用
  • 適切なコメントの記載

TypeScript/JavaScript固有

  • any型の使用を避ける
  • 適切な型定義
  • 非同期処理の適切な実装
  • ES6+の適切な活用
  • エラーハンドリングの実装

セキュリティ

  • 入力値検証の実装
  • SQLインジェクション対策
  • XSS対策
  • 機密情報のハードコード回避
  • 適切な権限制御

パフォーマンス

  • 効率的なアルゴリズムの選択
  • メモリリークの回避
  • 不要な処理の排除
  • データベースクエリの最適化

テスト (しばらくは不要)

  • 単体テストの網羅性
  • テストケースの妥当性
  • モックの適切な使用
  • エッジケースのテスト

React・Next.js固有(該当する場合)

  • コンポーネントの適切な分割
  • 状態管理の最適化
  • 不要な再レンダリングの防止
  • Hooksの適切な使用

Git/GitHub関連

  • コミットメッセージの明確性
  • 適切なブランチ戦略
  • コンフリクトの解決
  • PRの説明の充実

レビュー観点の優先順位

  1. セキュリティ問題 - 最優先で指摘
  2. バグの可能性 - 高優先度で指摘
  3. パフォーマンス問題 - 重要度に応じて指摘
  4. コード品質 - 建設的にフィードバック
  5. スタイル・フォーマット - 必要に応じて指摘

レビュー時の注意事項

  • 修正提案を行う際は、具体的なコード例を提示する
  • 問題の理由と影響範囲を明確に説明する
  • 良い実装についても積極的に評価する
  • 建設的で学習につながるフィードバックを心がける
  • チーム全体のスキル向上につながる指摘を行う

除外項目

以下の場合は簡潔な指摘または省略:

  • 自動フォーマット可能な問題
  • 明らかなタイポ
  • 既存コードとの整合性のみの問題

チェックリスト

  • ブランチは最新のmain/developから作成されている
  • コンフリクトが解決されている
  • CIが通っている
  • 必要なドキュメントが更新されている

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

QRコードを使用してアプリ非ユーザーでもユーザーの視聴履歴を閲覧できるWebサイトを実装するPull Requestです。

  • Firebase Hostingを使用したWebビューアーの追加
  • QRコードからWebサイトへのリダイレクト機能
  • ユーザープロフィールとアニメ視聴履歴の表示機能

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
viewer/public/user.html ユーザープロフィール表示用のHTMLページ
viewer/public/index.html ランディングページのHTML
viewer/public/assets/js/firebase-config.js Firebase設定ファイル
viewer/public/assets/js/app.js メインアプリケーションロジック
viewer/public/assets/css/style.css レスポンシブデザインのCSS
viewer/firebase.json Firebase Hostingの設定
viewer/README.md プロジェクトのドキュメント
viewer/.firebaserc Firebaseプロジェクト設定
lib/ui/home/view/home_page.dart QRコード生成時のURL短縮機能追加
lib/ui/animes/view_model/anime_list_view_model.dart アニメリストのデフォルトソート順変更

firebase.initializeApp(firebaseConfig);

// Firestore初期化
const db = firebase.firestore();
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FirebaseのAPIキーなどの機密情報がハードコードされています。環境変数や設定ファイルを使用して機密情報を管理し、リポジトリにコミットしないようにしてください。

Suggested change
const db = firebase.firestore();
// Firebase設定を外部ファイルから読み込む
// 必ず 'viewer/public/assets/js/firebase-config.json' を作成し、機密情報を管理してください。
// このファイルは .gitignore に追加し、リポジトリにコミットしないでください。
fetch('assets/js/firebase-config.json')
.then(response => {
if (!response.ok) {
throw new Error('Firebase設定ファイルが見つかりません。firebase-config.json を作成してください。');
}
return response.json();
})
.then(firebaseConfig => {
// Firebase初期化
firebase.initializeApp(firebaseConfig);
// Firestore初期化
window.db = firebase.firestore();
})
.catch(error => {
console.error('Firebaseの初期化に失敗しました:', error);
});

Copilot uses AI. Check for mistakes.
this.shortId = this.getUserIdFromUrl();

if (shortId) {
this.currentUserId = await this.getUserIdFromShortId(shortId);
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

変数 shortId が定義されていません。正しくは this.shortId であるべきです。

Suggested change
this.currentUserId = await this.getUserIdFromShortId(shortId);
if (this.shortId) {
this.currentUserId = await this.getUserIdFromShortId(this.shortId);

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この修正入れましょう

this.shortId = this.getUserIdFromUrl();

if (shortId) {
this.currentUserId = await this.getUserIdFromShortId(shortId);
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

変数 shortId が定義されていません。正しくは this.shortId であるべきです。

Suggested change
this.currentUserId = await this.getUserIdFromShortId(shortId);
if (this.shortId) {
this.currentUserId = await this.getUserIdFromShortId(this.shortId);

Copilot uses AI. Check for mistakes.
const uid = doc.id;
if (uid.startsWith(shortId)) {
return uid;
}
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

全ユーザーのコレクションを取得してからフィルタリングするのは非効率的です。Firestoreのwhere句を使用して、より効率的なクエリを実装することを検討してください。

Suggested change
}
// Firestoreで短縮IDに一致するユーザーを検索(shortIdフィールドで検索)
const usersSnapshot = await db.collection('users').where('shortId', '==', shortId).get();
if (!usersSnapshot.empty) {
// 最初の一致したユーザーのIDを返す
return usersSnapshot.docs[0].id;

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これはして欲しい

@KOU050223
Copy link
Owner

修正まとめ

  • ハードコーディングをやめる
  • shortIdにしなくても良いかも
    • _generateShortIdの場所を移動する
    • if (shortId) {this.shortIdに修正する

Copy link
Owner

@KOU050223 KOU050223 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

まとめた修正点を修正しましょう

this.shortId = this.getUserIdFromUrl();

if (shortId) {
this.currentUserId = await this.getUserIdFromShortId(shortId);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この修正入れましょう

async getUserIdFromShortId(shortId) {
try {
// Firestoreで短縮IDに一致するユーザーを検索
const usersSnapshot = await db.collection('users').get();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

全ユーザーデータをとってくるのをやめたいです

class HomeTabPage extends StatefulWidget {
const HomeTabPage({super.key});

String _generateShortId(String uid) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この関数を下の_HomeTabPageStateに移動してください
ビルドが落ちています

@github-actions
Copy link

github-actions bot commented Aug 16, 2025

Visit the preview URL for this PR (updated for commit 6bf28eb):

https://animeishi-73560--pr136-alicewonerfulworld-f-nk0dnmbd.web.app

(expires Sat, 23 Aug 2025 14:14:43 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f1f494a67df8ccbb2232f73b6ccab4934a51e505

@KOU050223
Copy link
Owner

.envが上がってきています

@KOU050223
Copy link
Owner

結局shortを使用する感じですか?

Copy link
Owner

@KOU050223 KOU050223 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KOU050223 KOU050223 merged commit 2e25cb2 into develop Aug 16, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from レビュー待ち to Done in アニ名刺Project Aug 16, 2025
@KOU050223 KOU050223 deleted the AliceWonerfulWorld/feature/default-sort-year-desc branch August 16, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants