-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: original activity report pages
- Loading branch information
Showing
10 changed files
with
173 additions
and
128 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
30 changes: 30 additions & 0 deletions
30
packages/web/src/features/activity-report/hooks/useGetActivityTerm.ts
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,30 @@ | ||
import useGetActivityTerms from "../services/useGetActivityTerms"; | ||
import { ActivityTerm } from "../types/activityTerm"; | ||
|
||
const useGetActivityTerm = ( | ||
clubId: number, | ||
activityTermId: number, | ||
): { | ||
data: ActivityTerm; | ||
isLoading: boolean; | ||
isError: boolean; | ||
} => { | ||
const { data, isLoading, isError } = useGetActivityTerms({ clubId }); | ||
|
||
const activityTerm = data?.terms.find(term => term.id === activityTermId); | ||
if (isLoading || isError || !activityTerm) { | ||
return { | ||
data: {} as ActivityTerm, | ||
isLoading, | ||
isError, | ||
}; | ||
} | ||
|
||
return { | ||
data: activityTerm, | ||
isLoading, | ||
isError, | ||
}; | ||
}; | ||
|
||
export default useGetActivityTerm; |
35 changes: 35 additions & 0 deletions
35
packages/web/src/features/activity-report/hooks/useGetPastActivityReportList.ts
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,35 @@ | ||
import useGetTermActivityReportList from "../services/useGetTermActivityReportList"; | ||
import { PastActivityReportTableData } from "../types/table"; | ||
|
||
const useGetPastActivityReportList = ( | ||
termId: number, | ||
clubId: number, | ||
): { | ||
data: PastActivityReportTableData[]; | ||
isLoading: boolean; | ||
isError: boolean; | ||
} => { | ||
const { | ||
data: activityReportList, | ||
isLoading, | ||
isError, | ||
} = useGetTermActivityReportList(termId, { | ||
clubId, | ||
}); | ||
|
||
if (isLoading || isError || !activityReportList) { | ||
return { | ||
data: [], | ||
isLoading, | ||
isError, | ||
}; | ||
} | ||
|
||
return { | ||
data: activityReportList.activities, | ||
isLoading, | ||
isError, | ||
}; | ||
}; | ||
|
||
export default useGetPastActivityReportList; |
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.