-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: instance에 return문 추가 * feat: 데이터 값에 맞게 각 컴포넌트 수정 * feat: 총 거래 계산 함수 데이터 값에 맞춤 * feat: 입 출금 내역 api 코드 작성 * feat: 입/출금 내역 api hook * feat: 입/출금 내역 - month store * feat: 입/출금 내역 임시 화면 * refactor: build 에러 해결 * refactor: 비밀번호 변경 관련 middleware 재설정 * style: 무한스크롤 관련 loading... -> 로딩중... 으로 변경 * refactor: 목록 페이지 무한스크롤 버그 관련 고침 * refactor: MonthComponent 현재 달부터 보이도록 * feat: 달 선택 carousel에서 select로 변경 * feat: 입/출금 내역 api 연결
- Loading branch information
Showing
19 changed files
with
278 additions
and
116 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,58 @@ | ||
'use client'; | ||
|
||
import { transactionItems } from '@/shared/mock/contentList'; | ||
import MonthComponent from '@/views/transaction/MonthComponent'; | ||
import { useEffect, useState } from 'react'; | ||
import useTransactionDetail from '@/features/content/model/useTransactionDetail'; | ||
import TotalAmount from '@/views/transaction/TotalAmount'; | ||
import TransactionListComponent from '@/views/transaction/TransactionListComponent'; | ||
import Title from '@/widgets/Title'; | ||
import { usePathname } from 'next/navigation'; | ||
import { GetTransactionDetailResData } from '@/features/content/api/types'; | ||
import { useMonthStore } from '@/features/content/model/useTransactionMonthStore'; | ||
import MonthSelectComponent from '@/views/transaction/MonthSelectComponent'; | ||
|
||
const page = () => { | ||
const Page = () => { | ||
const pathname = usePathname(); | ||
const id = pathname.split('/')[2]; | ||
const organization = pathname.split('/')[2]; | ||
const { selectMonth } = useMonthStore(); | ||
|
||
const [transactionItems, setTransactionItems] = useState< | ||
GetTransactionDetailResData[] | ||
>([]); | ||
const { data, isLoading } = useTransactionDetail( | ||
organization, | ||
new Date().getFullYear(), | ||
selectMonth, | ||
); | ||
|
||
useEffect(() => { | ||
if (data) { | ||
setTransactionItems(data); | ||
} | ||
}, [data]); | ||
|
||
return ( | ||
<div className="flex flex-col space-y-10"> | ||
<Title | ||
text={`${id === 'studentCouncil' ? '총학생회' : id === 'college' ? '단과대' : '학과'} 입/출금 내역`} | ||
text={`${ | ||
organization === 'studentCouncil' | ||
? '총학생회' | ||
: organization === 'college' | ||
? '단과대' | ||
: '학과' | ||
} 입/출금 내역`} | ||
/> | ||
<div className="flex flex-col space-y-12"> | ||
<MonthComponent /> | ||
<TotalAmount items={transactionItems} /> | ||
<TransactionListComponent list={transactionItems} /> | ||
<MonthSelectComponent /> | ||
<> | ||
<TotalAmount items={transactionItems} isLoading={isLoading} /> | ||
<TransactionListComponent | ||
list={transactionItems} | ||
isLoading={isLoading} | ||
/> | ||
</> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default page; | ||
export default Page; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useGetTransactionDetail } from '../api/queries'; | ||
|
||
const useTransactionDetail = ( | ||
organization: string, | ||
year: number, | ||
month: number, | ||
) => { | ||
let affiliation; | ||
if (organization === 'studentCouncil') { | ||
affiliation = '총학'; | ||
} else if (organization === 'college') { | ||
affiliation = '단과대'; | ||
} else if (organization === 'department') { | ||
affiliation = '학과'; | ||
} | ||
|
||
const queryResult = useGetTransactionDetail( | ||
affiliation as string, | ||
year, | ||
month, | ||
); | ||
return queryResult; | ||
}; | ||
|
||
export default useTransactionDetail; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { create } from 'zustand'; | ||
import { persist } from 'zustand/middleware'; | ||
|
||
interface MonthState { | ||
selectMonth: number; | ||
setSelectMonth: (month: number) => void; | ||
} | ||
|
||
export const useMonthStore = create<MonthState>()( | ||
persist( | ||
(set) => ({ | ||
selectMonth: new Date().getMonth() + 1, | ||
setSelectMonth: (month: number) => set({ selectMonth: month }), | ||
}), | ||
{ | ||
name: 'transaction-month-storage', | ||
}, | ||
), | ||
); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.