Skip to content

Commit

Permalink
Feature/#233 (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kota8102 authored Nov 15, 2024
1 parent 2a3a45a commit 16a50bd
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 25 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/pr-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, ready_for_review]
issue_comment:
types: [created]
workflow_call:
workflow_dispatch:

# デフォルトのシェルをbashに設定
defaults:
Expand All @@ -14,6 +14,9 @@ defaults:

jobs:
pr-agent:
# ボットからのイベントは無視
if: ${{ github.event.sender.type != 'Bot' }}

runs-on: ubuntu-latest
timeout-minutes: 10

Expand All @@ -29,6 +32,6 @@ jobs:
env:
OPENAI_KEY: ${{ secrets.OPENAI_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_REVIEWER.EXTRA_INSTRUCTIONS: "プルリクエストのレビューを日本語で行ってください。コードの品質、改善点、潜在的な問題に焦点を当ててください。"
PR_DESCRIPTION.EXTRA_INSTRUCTIONS: "日本語で詳細な説明を提供してください。コミットリントのパターン(`feat:`, `chore:`, `test:`, `fix:`, `ci:`, `docs:` など)に従ってタイトルを付けてください。"
PR_TITLE.EXTRA_INSTRUCTIONS: "日本語でタイトルを作成し、コミットリントのパターン(`feat:`, `chore:`, `test:`, `fix:`, `ci:`, `docs:` など)に従ってください。"
github_action_config.auto_review: "true" # enable\disable auto review
github_action_config.auto_describe: "true" # enable\disable auto describe
github_action_config.auto_improve: "true" # enable\disable auto improve
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,9 @@ src/backend/lambda/**/__pycache__/**

.DS_Store
node_modules
.pytest_cache/
.ruff_cache/
.tox/
.coverage
.cache/
pytestdebug.log
40 changes: 40 additions & 0 deletions .pr_agent.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# https://pr-agent-docs.codium.ai/
# https://github.com/Codium-ai/pr-agent/blob/main/pr_agent/settings/configuration.toml

[config]
ignore_pr_labels = ['renovate']
model = 'gpt-4o-mini-2024-07-18'

[ignore]
glob = ['*.lock.hcl', '*.sops.yaml', '*.toml']

[pr_description]
generate_ai_title = true
final_update_message = true
extra_instructions = """\
Emphasize the following:
- Please use Japanese for everything.
- Titles should have a prefix following the commitlint pattern, such as feat:, chore:, test:, fix:, docs:, style:, refactor:, perf:, etc.
"""

[pr_reviewer]
require_tests_review = false
require_can_be_split_review = true
num_code_suggestions = 3
inline_code_comments = true
enable_auto_approval = true
maximal_review_effort = 3
extra_instructions = """\
Emphasize the following:
- Please use Japanese for everything.
"""

[pr_code_suggestions]
num_code_suggestions = 3
rank_suggestions = true
commitable_code_suggestions = true
demand_code_suggestions_self_review = true
extra_instructions = """\
Emphasize the following:
- Please use Japanese for everything.
"""
3 changes: 2 additions & 1 deletion src/frontend/src/components/layout/ContentLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type React from 'react'
import { Header } from '../Elements/Header'
import { Tab } from '../Elements/Tab'
import { Tab } from '../ui/Tab'

type ContentLayoutProps = {
children: React.ReactNode
pagetitle: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ import {

import { getToday } from '@/utils/dateUtils'
import { TabItem } from './TabItem'

type TabConfig = {
path: string
label: string
activeIcon: string
inactiveIcon: string
}
import type { TabConfig } from './types'

const TAB_ITEMS: TabConfig[] = [
{
Expand Down Expand Up @@ -61,10 +55,10 @@ const TAB_ITEMS: TabConfig[] = [
export const Tab = () => {
return (
// タブナビゲーションのコンテナ要素
<nav className="flex justify-between items-center bg-light-bgTab">
<nav className="flex justify-between items-center bg-light-bgFooter">
{/* 定義済みのタブ項目をマッピングして表示 */}
{TAB_ITEMS.map(({ path, label, activeIcon, inactiveIcon }) => (
<TabItem key={path} linkPath={path} label={label} activeIcon={activeIcon} inactiveIcon={inactiveIcon} />
<TabItem key={path} path={path} label={label} activeIcon={activeIcon} inactiveIcon={inactiveIcon} />
))}
</nav>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
import { Link, useLocation } from 'react-router-dom'

type TabItemProps = {
linkPath: string // タブのリンク先パス
label: string // タブのラベルテキスト
activeIcon: string // アクティブ時のアイコン画像パス
inactiveIcon: string // 非アクティブ時のアイコン画像パス
}
import type { TabConfig } from './types'

/**
* タブアイテムコンポーネント
* ナビゲーションタブの各項目を表示する
*/
export const TabItem = ({ linkPath, label: text, activeIcon, inactiveIcon }: TabItemProps) => {
export const TabItem = ({ path, label: text, activeIcon, inactiveIcon }: TabConfig) => {
// 現在のパス情報を取得
const { pathname } = useLocation()

// パスからベースパスを抽出する関数
const extractBasePath = (url: string) => {
return `/${url.split('/').slice(1, 3).join('/')}`
}

// 現在のパスとリンク先パスから、ベースパスを抽出
// 例: /flower/2023-12-25 -> /flower
const basePath = `/${pathname.split('/')[1]}`
const linkBasePath = `/${linkPath.split('/')[1]}`
const basePath = extractBasePath(pathname)
const linkBasePath = extractBasePath(path)

// 現在のタブがアクティブかどうかを判定
const isActive = basePath === linkBasePath

return (
// タブアイテムのリンク要素
<Link to={linkPath} className="flex flex-col items-center py-2 gap-1 w-1/5">
<Link to={path} className="flex flex-col items-center py-2 gap-1 w-1/5">
{/* アクティブ状態に応じてアイコンを切り替え */}
{isActive ? (
<img src={activeIcon} alt="Active Icon" width="32" height="32" />
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions src/frontend/src/components/ui/Tab/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type TabConfig = {
path: string
label: string
activeIcon: string
inactiveIcon: string
}

0 comments on commit 16a50bd

Please sign in to comment.