1- import React , { useState , useEffect } from 'react' ;
1+ import React from 'react' ;
22import styled from 'styled-components' ;
33import { useQuery , useMutation , useQueryClient } from '@tanstack/react-query' ;
44import { useTranslation } from 'react-i18next' ;
@@ -42,7 +42,7 @@ const PageSubtitle = styled.p`
4242` ;
4343
4444import Button from '../components/common/atoms/Button' ; // ボタンコンポーネントをインポート
45- import { fetchComplexes , deleteComplex } from '../services/api' ; // 実際のAPI関数をインポート
45+ import { fetchComplexes , deleteComplex } from '../services/api' ;
4646
4747const AddButtonWrapper = styled . div `
4848 text-align: center;
@@ -67,10 +67,12 @@ const ComplexesPage: React.FC = () => {
6767
6868 // 削除ミューテーション
6969 const deleteMutation = useMutation < void , Error , number > ( {
70- mutationFn : deleteComplexAPI ,
70+ mutationFn : deleteComplex ,
7171 onSuccess : ( ) => {
72- queryClient . invalidateQueries ( { queryKey : [ 'complexes' ] } ) ; // キャッシュを無効化して再フェッチ
72+ queryClient . invalidateQueries ( { queryKey : [ 'complexes' ] } ) ; // キャッシュを無効化して再フェッチ
73+ // eslint-disable-next-line no-undef
7374 alert ( t ( 'deleteConfirmation' , { id : '' } ) . replace ( '{{id}} ' , '' ) ) ; // 実際には削除されたIDを渡す
75+ } ,
7476 onError : ( err ) => {
7577 // eslint-disable-next-line no-undef
7678 alert ( `削除に失敗しました: ${ err . message } ` ) ;
@@ -85,12 +87,14 @@ const ComplexesPage: React.FC = () => {
8587 const handleViewGoals = ( id : number ) => {
8688 console . log ( `目標を見る/設定: Complex ID ${ id } ` ) ;
8789 // TODO: React Routerを使用して目標設定ページへ遷移
90+ // eslint-disable-next-line no-undef
8891 alert ( t ( 'viewSetGoalsButton' ) + ` (ID: ${ id } ) 画面へ(未実装)` ) ;
8992 } ;
9093
9194 const handleEditComplex = ( id : number ) => {
9295 console . log ( `編集: Complex ID ${ id } ` ) ;
9396 // TODO: React Routerを使用して編集ページへ遷移
97+ // eslint-disable-next-line no-undef
9498 alert ( t ( 'editButton' ) + ` (ID: ${ id } ) 画面へ(未実装)` ) ;
9599 } ;
96100
@@ -106,7 +110,10 @@ const ComplexesPage: React.FC = () => {
106110 // const [showDummyData, setShowDummyData] = useState(false);
107111 // useEffect(() => { ... }, [isLoading, error, complexes]);
108112
109- if ( isLoading && ! showDummyData )
113+ if (
114+ isLoading
115+ // && !showDummyData
116+ )
110117 return (
111118 < PageWrapper >
112119 < MainContent >
@@ -127,7 +134,7 @@ const ComplexesPage: React.FC = () => {
127134 ) ;
128135
129136 return (
130- < PageWrapper >
137+ < PageWrapper >
131138 < Header onAddNewComplex = { handleAddNewComplex } />
132139 < MainContent >
133140 < PageTitleWrapper >
@@ -136,9 +143,9 @@ const ComplexesPage: React.FC = () => {
136143 </ PageTitleWrapper >
137144 { /* 新規登録ボタンをページコンテンツ内に追加 */ }
138145 < AddButtonWrapper >
139- < Button variant = "primary" onClick = { handleAddNewComplex } >
140- + { t ( 'addNewComplexButton' ) }
141- </ Button >
146+ < Button variant = "primary" onClick = { handleAddNewComplex } >
147+ + { t ( 'addNewComplexButton' ) }
148+ </ Button >
142149 </ AddButtonWrapper >
143150 < ComplexList
144151 complexes = { complexes } // TanStack Queryがデータを管理
0 commit comments