diff --git a/qwilight-fe/src/Loading.tsx b/qwilight-fe/src/Loading.tsx index bacdac7..0162bc6 100644 --- a/qwilight-fe/src/Loading.tsx +++ b/qwilight-fe/src/Loading.tsx @@ -1,5 +1,5 @@ import WwwLevelItem from "@/avatar/WwwLevelItem"; -import AvatarItem from "@/hof/AvatarItem"; +import AvatarItem from "@/hall/AvatarItem"; import NoteItem from "@/note/NoteItem"; export const NoteLoading = ({ loadingCount }: { loadingCount: number }) => { diff --git a/qwilight-fe/src/QwilightView.tsx b/qwilight-fe/src/QwilightView.tsx index 5e54bd7..c28cd4f 100644 --- a/qwilight-fe/src/QwilightView.tsx +++ b/qwilight-fe/src/QwilightView.tsx @@ -60,8 +60,8 @@ - - + + diff --git a/qwilight-fe/src/Stores.tsx b/qwilight-fe/src/Stores.tsx index 38f95c1..58b75d2 100644 --- a/qwilight-fe/src/Stores.tsx +++ b/qwilight-fe/src/Stores.tsx @@ -2,7 +2,7 @@ import setAvatarStore from "@/avatar/setAvatarStore"; import setEtcStore from "@/etc/setEtcStore"; -import setHOFStore from "@/hof/setHOFStore"; +import setHallStore from "@/hall/setHallStore"; import setNoteStore from "@/note/setNoteStore"; import setSiteStore from "@/site/setSiteStore"; @@ -13,7 +13,7 @@ noteStore: ReturnType; siteStore: ReturnType; avatarStore: ReturnType; - hofStore: ReturnType; + hallStore: ReturnType; etcStore: ReturnType; }; @@ -26,7 +26,7 @@ noteStore: useLocalObservable(setNoteStore), siteStore: useLocalObservable(setSiteStore), avatarStore: useLocalObservable(setAvatarStore), - hofStore: useLocalObservable(setHOFStore), + hallStore: useLocalObservable(setHallStore), etcStore: useLocalObservable(setEtcStore), }} > @@ -40,6 +40,6 @@ export const useAvatarStore = () => useContext(qwilightStore).avatarStore; -export const useHOFStore = () => useContext(qwilightStore).hofStore; +export const useHallStore = () => useContext(qwilightStore).hallStore; export const useEtcStore = () => useContext(qwilightStore).etcStore; diff --git "a/qwilight-fe/src/app/\133language\135/hall/loading.tsx" "b/qwilight-fe/src/app/\133language\135/hall/loading.tsx" new file mode 100644 index 0000000..d51e131 --- /dev/null +++ "b/qwilight-fe/src/app/\133language\135/hall/loading.tsx" @@ -0,0 +1,8 @@ +import LoadingLayer from "@/LoadingLayer"; +import { useTranslations } from "next-intl"; + +export default function Loading() { + const t = useTranslations(); + + return ; +} diff --git "a/qwilight-fe/src/app/\133language\135/hall/page.tsx" "b/qwilight-fe/src/app/\133language\135/hall/page.tsx" new file mode 100644 index 0000000..dabe44e --- /dev/null +++ "b/qwilight-fe/src/app/\133language\135/hall/page.tsx" @@ -0,0 +1,286 @@ +"use client"; + +import AvatarItem from "@/hall/AvatarItem"; +import { Hall } from "@/hall/Hall"; +import useGetAbility5KHall from "@/hall/useGetAbility5KHall"; +import useGetAbility7KHall from "@/hall/useGetAbility7KHall"; +import useGetAbility9KHall from "@/hall/useGetAbility9KHall"; +import useGetAtBandHall from "@/hall/useGetAtBandHall"; +import useGetAtHighestHall from "@/hall/useGetAtHighestHall"; +import useGetAtStandHall from "@/hall/useGetAtStandHall"; +import useGetAtTotalHall from "@/hall/useGetAtTotalHall"; +import useGetLevelHall from "@/hall/useGetLevelHall"; +import useGetTotalBandHall from "@/hall/useGetTotalBandHall"; +import useGetTotalHighestHall from "@/hall/useGetTotalHighestHall"; +import useGetTotalStandHall from "@/hall/useGetTotalStandHall"; +import useGetTotalTotalHall from "@/hall/useGetTotalTotalHall"; +import { AvatarLoading } from "@/Loading"; + +import { useHallStore } from "@/Stores"; +import { observer } from "mobx-react-lite"; +import { useTranslations } from "next-intl"; +import { + ListGroup, + Nav, + NavItem, + NavLink, + TabContent, + TabPane, +} from "reactstrap"; + +const getAvatarItems = (halls: Hall[]) => { + return halls.map(({ avatarID, avatarName, text }) => ( + + )); +}; + +export default observer(() => { + const { + tabPosition, + totalTabPosition, + atTabPosition, + abilityTabPosition, + setTabPosition, + setTotalTabPosition, + setAtTabPosition, + setAbilityTabPosition, + } = useHallStore(); + const t = useTranslations(); + + const { data: totalTotalHall, isFetched: isTotalTotalHallLoaded } = + useGetTotalTotalHall(); + const { data: totalHighestHall, isFetched: isTotalHighestHallLoaded } = + useGetTotalHighestHall(); + const { data: totalStandHall, isFetched: isTotalStandHallLoaded } = + useGetTotalStandHall(); + const { data: totalBandHall, isFetched: isTotalBandHallLoaded } = + useGetTotalBandHall(); + const { data: atTotalHall, isFetched: isAtTotalHallLoaded } = + useGetAtTotalHall(); + const { data: atHighestHall, isFetched: isAtHighestHallLoaded } = + useGetAtHighestHall(); + const { data: atStandHall, isFetched: isAtStandHallLoaded } = + useGetAtStandHall(); + const { data: atBandHall, isFetched: isAtBandHallLoaded } = + useGetAtBandHall(); + const { data: ability5KHall, isFetched: isAbility5KHallLoaded } = + useGetAbility5KHall(); + const { data: ability7KHall, isFetched: isAbility7KHallLoaded } = + useGetAbility7KHall(); + const { data: ability9KHall, isFetched: isAbility9KHallLoaded } = + useGetAbility9KHall(); + const { data: levelHall, isFetched: isLevelHallLoaded } = useGetLevelHall(); + + const getProperties = (i: number) => ({ + className: tabPosition === i ? "active route" : "route", + onClick: () => { + setTabPosition(i); + }, + }); + + const getTotalProperties = (i: number) => ({ + className: totalTabPosition === i ? "active route" : "route", + onClick: () => { + setTotalTabPosition(i); + }, + }); + + const getAtProperties = (i: number) => ({ + className: atTabPosition === i ? "active route" : "route", + onClick: () => { + setAtTabPosition(i); + }, + }); + + const getAbilityProperties = (i: number) => ({ + className: abilityTabPosition === i ? "active route" : "route", + onClick: () => { + setAbilityTabPosition(i); + }, + }); + + return ( + <> + + + + + + + + {isTotalTotalHallLoaded ? ( + getAvatarItems(totalTotalHall) + ) : ( + + )} + + + + + {isTotalHighestHallLoaded ? ( + getAvatarItems(totalHighestHall) + ) : ( + + )} + + + + + {isTotalStandHallLoaded ? ( + getAvatarItems(totalStandHall) + ) : ( + + )} + + + + + {isTotalBandHallLoaded ? ( + getAvatarItems(totalBandHall) + ) : ( + + )} + + + + + + + + + + {isAtTotalHallLoaded ? ( + getAvatarItems(atTotalHall) + ) : ( + + )} + + + + + {isAtHighestHallLoaded ? ( + getAvatarItems(atHighestHall) + ) : ( + + )} + + + + + {isAtStandHallLoaded ? ( + getAvatarItems(atStandHall) + ) : ( + + )} + + + + + {isAtBandHallLoaded ? ( + getAvatarItems(atBandHall) + ) : ( + + )} + + + + + + + + + + {isAbility5KHallLoaded ? ( + getAvatarItems(ability5KHall) + ) : ( + + )} + + + + + {isAbility7KHallLoaded ? ( + getAvatarItems(ability7KHall) + ) : ( + + )} + + + + + {isAbility9KHallLoaded ? ( + getAvatarItems(ability9KHall) + ) : ( + + )} + + + + + + + {isLevelHallLoaded ? ( + getAvatarItems(levelHall) + ) : ( + + )} + + + + + ); +}); diff --git "a/qwilight-fe/src/app/\133language\135/hof/loading.tsx" "b/qwilight-fe/src/app/\133language\135/hof/loading.tsx" deleted file mode 100644 index 16e6648..0000000 --- "a/qwilight-fe/src/app/\133language\135/hof/loading.tsx" +++ /dev/null @@ -1,8 +0,0 @@ -import LoadingLayer from "@/LoadingLayer"; -import { useTranslations } from "next-intl"; - -export default function Loading() { - const t = useTranslations(); - - return ; -} diff --git "a/qwilight-fe/src/app/\133language\135/hof/page.tsx" "b/qwilight-fe/src/app/\133language\135/hof/page.tsx" deleted file mode 100644 index 81b6b47..0000000 --- "a/qwilight-fe/src/app/\133language\135/hof/page.tsx" +++ /dev/null @@ -1,285 +0,0 @@ -"use client"; - -import AvatarItem from "@/hof/AvatarItem"; -import { HOF } from "@/hof/HOF"; -import useGetAbility5KHOF from "@/hof/useGetAbility5KHOF"; -import useGetAbility7KHOF from "@/hof/useGetAbility7KHOF"; -import useGetAbility9KHOF from "@/hof/useGetAbility9KHOF"; -import useGetAtBandHOF from "@/hof/useGetAtBandHOF"; -import useGetAtHighestHOF from "@/hof/useGetAtHighestHOF"; -import useGetAtStandHOF from "@/hof/useGetAtStandHOF"; -import useGetAtTotalHOF from "@/hof/useGetAtTotalHOF"; -import useGetLevelHOF from "@/hof/useGetLevelHOF"; -import useGetTotalBandHOF from "@/hof/useGetTotalBandHOF"; -import useGetTotalHighestHOF from "@/hof/useGetTotalHighestHOF"; -import useGetTotalStandHOF from "@/hof/useGetTotalStandHOF"; -import useGetTotalTotalHOF from "@/hof/useGetTotalTotalHOF"; -import { AvatarLoading } from "@/Loading"; - -import { useHOFStore } from "@/Stores"; -import { observer } from "mobx-react-lite"; -import { useTranslations } from "next-intl"; -import { - ListGroup, - Nav, - NavItem, - NavLink, - TabContent, - TabPane, -} from "reactstrap"; - -const getAvatarItems = (hofs: HOF[]) => { - return hofs.map(({ avatarID, avatarName, text }) => ( - - )); -}; - -export default observer(() => { - const { - tabPosition, - totalTabPosition, - atTabPosition, - abilityTabPosition, - setTabPosition, - setTotalTabPosition, - setAtTabPosition, - setAbilityTabPosition, - } = useHOFStore(); - const t = useTranslations(); - - const { data: totalTotalHOF, isFetched: isTotalTotalHOFLoaded } = - useGetTotalTotalHOF(); - const { data: totalHighestHOF, isFetched: isTotalHighestHOFLoaded } = - useGetTotalHighestHOF(); - const { data: totalStandHOF, isFetched: isTotalStandHOFLoaded } = - useGetTotalStandHOF(); - const { data: totalBandHOF, isFetched: isTotalBandHOFLoaded } = - useGetTotalBandHOF(); - const { data: atTotalHOF, isFetched: isAtTotalHOFLoaded } = - useGetAtTotalHOF(); - const { data: atHighestHOF, isFetched: isAtHighestHOFLoaded } = - useGetAtHighestHOF(); - const { data: atStandHOF, isFetched: isAtStandHOFLoaded } = - useGetAtStandHOF(); - const { data: atBandHOF, isFetched: isAtBandHOFLoaded } = useGetAtBandHOF(); - const { data: ability5KHOF, isFetched: isAbility5KHOFLoaded } = - useGetAbility5KHOF(); - const { data: ability7KHOF, isFetched: isAbility7KHOFLoaded } = - useGetAbility7KHOF(); - const { data: ability9KHOF, isFetched: isAbility9KHOFLoaded } = - useGetAbility9KHOF(); - const { data: levelHOF, isFetched: isLevelHOFLoaded } = useGetLevelHOF(); - - const getProperties = (i: number) => ({ - className: tabPosition === i ? "active route" : "route", - onClick: () => { - setTabPosition(i); - }, - }); - - const getTotalProperties = (i: number) => ({ - className: totalTabPosition === i ? "active route" : "route", - onClick: () => { - setTotalTabPosition(i); - }, - }); - - const getAtProperties = (i: number) => ({ - className: atTabPosition === i ? "active route" : "route", - onClick: () => { - setAtTabPosition(i); - }, - }); - - const getAbilityProperties = (i: number) => ({ - className: abilityTabPosition === i ? "active route" : "route", - onClick: () => { - setAbilityTabPosition(i); - }, - }); - - return ( - <> - - - - - - - - {isTotalTotalHOFLoaded ? ( - getAvatarItems(totalTotalHOF) - ) : ( - - )} - - - - - {isTotalHighestHOFLoaded ? ( - getAvatarItems(totalHighestHOF) - ) : ( - - )} - - - - - {isTotalStandHOFLoaded ? ( - getAvatarItems(totalStandHOF) - ) : ( - - )} - - - - - {isTotalBandHOFLoaded ? ( - getAvatarItems(totalBandHOF) - ) : ( - - )} - - - - - - - - - - {isAtTotalHOFLoaded ? ( - getAvatarItems(atTotalHOF) - ) : ( - - )} - - - - - {isAtHighestHOFLoaded ? ( - getAvatarItems(atHighestHOF) - ) : ( - - )} - - - - - {isAtStandHOFLoaded ? ( - getAvatarItems(atStandHOF) - ) : ( - - )} - - - - - {isAtBandHOFLoaded ? ( - getAvatarItems(atBandHOF) - ) : ( - - )} - - - - - - - - - - {isAbility5KHOFLoaded ? ( - getAvatarItems(ability5KHOF) - ) : ( - - )} - - - - - {isAbility7KHOFLoaded ? ( - getAvatarItems(ability7KHOF) - ) : ( - - )} - - - - - {isAbility9KHOFLoaded ? ( - getAvatarItems(ability9KHOF) - ) : ( - - )} - - - - - - - {isLevelHOFLoaded ? ( - getAvatarItems(levelHOF) - ) : ( - - )} - - - - - ); -}); diff --git a/qwilight-fe/src/assets/language/en.json b/qwilight-fe/src/assets/language/en.json index 6683bfd..9cc9211 100644 --- a/qwilight-fe/src/assets/language/en.json +++ b/qwilight-fe/src/assets/language/en.json @@ -35,14 +35,14 @@ "etcTotalTitles": "Titles TOP 10", "exileAvatar": "Kick", "highestCountText": "Record count: {highestCount}", - "hofAbilityText": "Rating", - "hofAtText": "Month", - "hofBand": "Combo", - "hofHighest": "Record", - "hofLevelText": "Level", - "hofStand": "Score", - "hofTotal": "Play", - "hofTotalText": "All", + "hallAbilityText": "Rating", + "hallAtText": "Month", + "hallBand": "Combo", + "hallHighest": "Record", + "hallLevelText": "Level", + "hallStand": "Score", + "hallTotal": "Play", + "hallTotalText": "All", "inputNewSite": "Create Chat Room", "notAvatarViewFault": "Non-member profiles are not available.", "notSignedInText": "Thank you, {avatarName}.", @@ -95,7 +95,7 @@ "toFit4": "Artist order", "toFit5": "Genre order", "toFit6": "Difficulty order", - "toHOF": "Hall of Fame", + "toHall": "Hall of Fame", "toilNoteFile": "Illegal BMS, reported as BMSON note file", "toilNoteFileText": "Please write down the reason for the report", "toNote": "Online Ranking", diff --git a/qwilight-fe/src/assets/language/ko.json b/qwilight-fe/src/assets/language/ko.json index b4247d9..5058085 100644 --- a/qwilight-fe/src/assets/language/ko.json +++ b/qwilight-fe/src/assets/language/ko.json @@ -35,14 +35,14 @@ "etcTotalTitles": "호칭 TOP 10", "exileAvatar": "추방", "highestCountText": "기록 개수: {highestCount} 개", - "hofAbilityText": "레이팅", - "hofAtText": "이번 달", - "hofBand": "콤보", - "hofHighest": "기록", - "hofLevelText": "레벨", - "hofStand": "점수", - "hofTotal": "플레이", - "hofTotalText": "전체", + "hallAbilityText": "레이팅", + "hallAtText": "이번 달", + "hallBand": "콤보", + "hallHighest": "기록", + "hallLevelText": "레벨", + "hallStand": "점수", + "hallTotal": "플레이", + "hallTotalText": "전체", "inputNewSite": "대화방 만들기", "notAvatarViewFault": "비회원의 프로필은 제공되지 않습니다.", "notSignedInText": "{avatarName}님 감사합니다.", @@ -95,7 +95,7 @@ "toFit4": "아티스트순", "toFit5": "장르순", "toFit6": "난이도순", - "toHOF": "명예의 전당", + "toHall": "명예의 전당", "toilNoteFile": "불법 BMS, BMSON 노트 파일로 신고", "toilNoteFileText": "신고 사유를 적어주세요", "toNote": "온라인 랭킹", diff --git a/qwilight-fe/src/hall/AvatarItem.tsx b/qwilight-fe/src/hall/AvatarItem.tsx new file mode 100644 index 0000000..76c6809 --- /dev/null +++ b/qwilight-fe/src/hall/AvatarItem.tsx @@ -0,0 +1,31 @@ +import AvatarDrawing from "@/AvatarDrawing"; +import AvatarTitle from "@/AvatarTitle"; + +import { Hall } from "@/hall/Hall"; +import { Col, ListGroupItem, Row } from "reactstrap"; +import { useTo } from "taehui-ts/fe-utility"; + +export default function AvatarItem({ avatarID, avatarName, text }: Hall) { + const to = useTo(); + + return ( + + { + to(`/avatar/${encodeURIComponent("#")}${avatarID}`); + }} + > + + + + + {avatarID && } + {avatarName} +
+ {text} + +
+
+ ); +} diff --git a/qwilight-fe/src/hall/Hall.d.ts b/qwilight-fe/src/hall/Hall.d.ts new file mode 100644 index 0000000..e4c8b20 --- /dev/null +++ b/qwilight-fe/src/hall/Hall.d.ts @@ -0,0 +1,5 @@ +export type Hall = { + avatarID: string; + avatarName: string; + text: string; +}; diff --git a/qwilight-fe/src/hall/setHallStore.ts b/qwilight-fe/src/hall/setHallStore.ts new file mode 100644 index 0000000..22d76c6 --- /dev/null +++ b/qwilight-fe/src/hall/setHallStore.ts @@ -0,0 +1,24 @@ +export default function setHallStore() { + return { + tabPosition: 0, + totalTabPosition: 0, + atTabPosition: 0, + abilityTabPosition: 0, + + setTabPosition(tabPosition: number) { + this.tabPosition = tabPosition; + }, + + setTotalTabPosition(totalTabPosition: number) { + this.totalTabPosition = totalTabPosition; + }, + + setAtTabPosition(atTabPosition: number) { + this.atTabPosition = atTabPosition; + }, + + setAbilityTabPosition(abilityTabPosition: number) { + this.abilityTabPosition = abilityTabPosition; + }, + }; +} diff --git a/qwilight-fe/src/hall/useGetAbility5KHall.ts b/qwilight-fe/src/hall/useGetAbility5KHall.ts new file mode 100644 index 0000000..94b5ef6 --- /dev/null +++ b/qwilight-fe/src/hall/useGetAbility5KHall.ts @@ -0,0 +1,32 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetAbility5KHall() { + const { tabPosition, abilityTabPosition } = useHallStore(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 2 && abilityTabPosition === 0 && isPath("/hall"), + queryKey: ["ability5KHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/ability/5K"); + return data.map((hall) => ({ + ...hall, + text: `${formatText(hall.value)} Point`, + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetAbility7KHall.ts b/qwilight-fe/src/hall/useGetAbility7KHall.ts new file mode 100644 index 0000000..55eb9b6 --- /dev/null +++ b/qwilight-fe/src/hall/useGetAbility7KHall.ts @@ -0,0 +1,32 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetAbility7KHall() { + const { tabPosition, abilityTabPosition } = useHallStore(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 2 && abilityTabPosition === 1 && isPath("/hall"), + queryKey: ["ability7KHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/ability/7K"); + return data.map((hall) => ({ + ...hall, + text: `${formatText(hall.value)} Point`, + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetAbility9KHall.ts b/qwilight-fe/src/hall/useGetAbility9KHall.ts new file mode 100644 index 0000000..1b32a2b --- /dev/null +++ b/qwilight-fe/src/hall/useGetAbility9KHall.ts @@ -0,0 +1,32 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetAbility9KHall() { + const { tabPosition, abilityTabPosition } = useHallStore(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 2 && abilityTabPosition === 2 && isPath("/hall"), + queryKey: ["ability9KHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/ability/9K"); + return data.map((hall) => ({ + ...hall, + text: `${formatText(hall.value)} Point`, + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetAtBandHall.ts b/qwilight-fe/src/hall/useGetAtBandHall.ts new file mode 100644 index 0000000..931a7c4 --- /dev/null +++ b/qwilight-fe/src/hall/useGetAtBandHall.ts @@ -0,0 +1,35 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useTranslations } from "next-intl"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetAtBandHall() { + const { tabPosition, atTabPosition } = useHallStore(); + + const t = useTranslations(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 1 && atTabPosition === 3 && isPath("/hall"), + queryKey: ["atBandHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/atBand"); + return data.map((hall) => ({ + ...hall, + text: t("textBand", { value: formatText(hall.value) }), + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetAtHighestHall.ts b/qwilight-fe/src/hall/useGetAtHighestHall.ts new file mode 100644 index 0000000..2569c5e --- /dev/null +++ b/qwilight-fe/src/hall/useGetAtHighestHall.ts @@ -0,0 +1,35 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useTranslations } from "next-intl"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetAtHighestHall() { + const { tabPosition, atTabPosition } = useHallStore(); + + const t = useTranslations(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 1 && atTabPosition === 1 && isPath("/hall"), + queryKey: ["atHighestHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/atHighest"); + return data.map((hall) => ({ + ...hall, + text: t("textCount", { value: formatText(hall.value) }), + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetAtStandHall.ts b/qwilight-fe/src/hall/useGetAtStandHall.ts new file mode 100644 index 0000000..cb92131 --- /dev/null +++ b/qwilight-fe/src/hall/useGetAtStandHall.ts @@ -0,0 +1,35 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useTranslations } from "next-intl"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetAtStandHall() { + const { tabPosition, atTabPosition } = useHallStore(); + + const t = useTranslations(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 1 && atTabPosition === 2 && isPath("/hall"), + queryKey: ["atStandHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/atStand"); + return data.map((hall) => ({ + ...hall, + text: t("textStand", { value: formatText(hall.value) }), + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetAtTotalHall.ts b/qwilight-fe/src/hall/useGetAtTotalHall.ts new file mode 100644 index 0000000..1d849d8 --- /dev/null +++ b/qwilight-fe/src/hall/useGetAtTotalHall.ts @@ -0,0 +1,35 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useTranslations } from "next-intl"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetAtTotalHall() { + const { tabPosition, atTabPosition } = useHallStore(); + + const t = useTranslations(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 1 && atTabPosition === 0 && isPath("/hall"), + queryKey: ["atTotalHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/atTotal"); + return data.map((hall) => ({ + ...hall, + text: t("textHandled", { value: formatText(hall.value) }), + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetLevelHall.ts b/qwilight-fe/src/hall/useGetLevelHall.ts new file mode 100644 index 0000000..f774af1 --- /dev/null +++ b/qwilight-fe/src/hall/useGetLevelHall.ts @@ -0,0 +1,32 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetLevelHall() { + const { tabPosition } = useHallStore(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 3 && isPath("/hall"), + queryKey: ["levelHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/level"); + return data.map((hall) => ({ + ...hall, + text: `LV.${formatText(hall.value)}`, + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetTotalBandHall.ts b/qwilight-fe/src/hall/useGetTotalBandHall.ts new file mode 100644 index 0000000..2c349a6 --- /dev/null +++ b/qwilight-fe/src/hall/useGetTotalBandHall.ts @@ -0,0 +1,35 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useTranslations } from "next-intl"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetTotalBandHall() { + const { tabPosition, totalTabPosition } = useHallStore(); + + const t = useTranslations(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 0 && totalTabPosition === 3 && isPath("/hall"), + queryKey: ["totalBandHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/totalBand"); + return data.map((hall) => ({ + ...hall, + text: t("textBand", { value: formatText(hall.value) }), + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetTotalHighestHall.ts b/qwilight-fe/src/hall/useGetTotalHighestHall.ts new file mode 100644 index 0000000..26d38a1 --- /dev/null +++ b/qwilight-fe/src/hall/useGetTotalHighestHall.ts @@ -0,0 +1,35 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useTranslations } from "next-intl"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetTotalHighestHall() { + const { tabPosition, totalTabPosition } = useHallStore(); + + const t = useTranslations(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 0 && totalTabPosition === 1 && isPath("/hall"), + queryKey: ["totalHighestHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/totalHighest"); + return data.map((hall) => ({ + ...hall, + text: t("textCount", { value: formatText(hall.value) }), + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetTotalStandHall.ts b/qwilight-fe/src/hall/useGetTotalStandHall.ts new file mode 100644 index 0000000..2fc673b --- /dev/null +++ b/qwilight-fe/src/hall/useGetTotalStandHall.ts @@ -0,0 +1,35 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useTranslations } from "next-intl"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetTotalStandHall() { + const { tabPosition, totalTabPosition } = useHallStore(); + + const t = useTranslations(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 0 && totalTabPosition === 2 && isPath("/hall"), + queryKey: ["totalStandHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/totalStand"); + return data.map((hall) => ({ + ...hall, + text: t("textStand", { value: formatText(hall.value) }), + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hall/useGetTotalTotalHall.ts b/qwilight-fe/src/hall/useGetTotalTotalHall.ts new file mode 100644 index 0000000..e294882 --- /dev/null +++ b/qwilight-fe/src/hall/useGetTotalTotalHall.ts @@ -0,0 +1,35 @@ +import { useHallStore } from "@/Stores"; +import { formatText } from "@/Utility"; + +import { wwwAXIOS } from "@/Www"; +import { GetHallAPI } from "@/wwwAPI"; +import { useQuery } from "@tanstack/react-query"; +import { useTranslations } from "next-intl"; +import { useIsPath } from "taehui-ts/fe-utility"; + +export default function useGetTotalTotalHall() { + const { tabPosition, totalTabPosition } = useHallStore(); + + const t = useTranslations(); + + const isPath = useIsPath(); + + return useQuery< + { + avatarID: string; + avatarName: string; + text: string; + }[] + >({ + enabled: tabPosition === 0 && totalTabPosition === 0 && isPath("/hall"), + queryKey: ["totalTotalHall"], + queryFn: async () => { + const { data } = await wwwAXIOS.get("/hall/totalTotal"); + return data.map((hall) => ({ + ...hall, + text: t("textHandled", { value: formatText(hall.value) }), + })); + }, + initialData: [], + }); +} diff --git a/qwilight-fe/src/hof/AvatarItem.tsx b/qwilight-fe/src/hof/AvatarItem.tsx deleted file mode 100644 index 8b1da3f..0000000 --- a/qwilight-fe/src/hof/AvatarItem.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import AvatarDrawing from "@/AvatarDrawing"; -import AvatarTitle from "@/AvatarTitle"; - -import { HOF } from "@/hof/HOF"; -import { Col, ListGroupItem, Row } from "reactstrap"; -import { useTo } from "taehui-ts/fe-utility"; - -export default function AvatarItem({ avatarID, avatarName, text }: HOF) { - const to = useTo(); - - return ( - - { - to(`/avatar/${encodeURIComponent("#")}${avatarID}`); - }} - > - - - - - {avatarID && } - {avatarName} -
- {text} - -
-
- ); -} diff --git a/qwilight-fe/src/hof/HOF.d.ts b/qwilight-fe/src/hof/HOF.d.ts deleted file mode 100644 index 1ae7b59..0000000 --- a/qwilight-fe/src/hof/HOF.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export type HOF = { - avatarID: string; - avatarName: string; - text: string; -}; diff --git a/qwilight-fe/src/hof/setHOFStore.ts b/qwilight-fe/src/hof/setHOFStore.ts deleted file mode 100644 index 1494b1e..0000000 --- a/qwilight-fe/src/hof/setHOFStore.ts +++ /dev/null @@ -1,24 +0,0 @@ -export default function setHOFStore() { - return { - tabPosition: 0, - totalTabPosition: 0, - atTabPosition: 0, - abilityTabPosition: 0, - - setTabPosition(tabPosition: number) { - this.tabPosition = tabPosition; - }, - - setTotalTabPosition(totalTabPosition: number) { - this.totalTabPosition = totalTabPosition; - }, - - setAtTabPosition(atTabPosition: number) { - this.atTabPosition = atTabPosition; - }, - - setAbilityTabPosition(abilityTabPosition: number) { - this.abilityTabPosition = abilityTabPosition; - }, - }; -} diff --git a/qwilight-fe/src/hof/useGetAbility5KHOF.ts b/qwilight-fe/src/hof/useGetAbility5KHOF.ts deleted file mode 100644 index 794ebbd..0000000 --- a/qwilight-fe/src/hof/useGetAbility5KHOF.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetAbility5KHOF() { - const { tabPosition, abilityTabPosition } = useHOFStore(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 2 && abilityTabPosition === 0 && isPath("/hof"), - queryKey: ["ability5KHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/ability/5K"); - return data.map((hof) => ({ - ...hof, - text: `${formatText(hof.value)} Point`, - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetAbility7KHOF.ts b/qwilight-fe/src/hof/useGetAbility7KHOF.ts deleted file mode 100644 index 00621d9..0000000 --- a/qwilight-fe/src/hof/useGetAbility7KHOF.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetAbility7KHOF() { - const { tabPosition, abilityTabPosition } = useHOFStore(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 2 && abilityTabPosition === 1 && isPath("/hof"), - queryKey: ["ability7KHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/ability/7K"); - return data.map((hof) => ({ - ...hof, - text: `${formatText(hof.value)} Point`, - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetAbility9KHOF.ts b/qwilight-fe/src/hof/useGetAbility9KHOF.ts deleted file mode 100644 index b446b86..0000000 --- a/qwilight-fe/src/hof/useGetAbility9KHOF.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetAbility9KHOF() { - const { tabPosition, abilityTabPosition } = useHOFStore(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 2 && abilityTabPosition === 2 && isPath("/hof"), - queryKey: ["ability9KHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/ability/9K"); - return data.map((hof) => ({ - ...hof, - text: `${formatText(hof.value)} Point`, - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetAtBandHOF.ts b/qwilight-fe/src/hof/useGetAtBandHOF.ts deleted file mode 100644 index fcfa876..0000000 --- a/qwilight-fe/src/hof/useGetAtBandHOF.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useTranslations } from "next-intl"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetAtBandHOF() { - const { tabPosition, atTabPosition } = useHOFStore(); - - const t = useTranslations(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 1 && atTabPosition === 3 && isPath("/hof"), - queryKey: ["atBandHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/atBand"); - return data.map((hof) => ({ - ...hof, - text: t("textBand", { value: formatText(hof.value) }), - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetAtHighestHOF.ts b/qwilight-fe/src/hof/useGetAtHighestHOF.ts deleted file mode 100644 index aa0cafd..0000000 --- a/qwilight-fe/src/hof/useGetAtHighestHOF.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useTranslations } from "next-intl"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetAtHighestHOF() { - const { tabPosition, atTabPosition } = useHOFStore(); - - const t = useTranslations(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 1 && atTabPosition === 1 && isPath("/hof"), - queryKey: ["atHighestHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/atHighest"); - return data.map((hof) => ({ - ...hof, - text: t("textCount", { value: formatText(hof.value) }), - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetAtStandHOF.ts b/qwilight-fe/src/hof/useGetAtStandHOF.ts deleted file mode 100644 index aecdb6b..0000000 --- a/qwilight-fe/src/hof/useGetAtStandHOF.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useTranslations } from "next-intl"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetAtStandHOF() { - const { tabPosition, atTabPosition } = useHOFStore(); - - const t = useTranslations(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 1 && atTabPosition === 2 && isPath("/hof"), - queryKey: ["atStandHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/atStand"); - return data.map((hof) => ({ - ...hof, - text: t("textStand", { value: formatText(hof.value) }), - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetAtTotalHOF.ts b/qwilight-fe/src/hof/useGetAtTotalHOF.ts deleted file mode 100644 index f759586..0000000 --- a/qwilight-fe/src/hof/useGetAtTotalHOF.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useTranslations } from "next-intl"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetAtTotalHOF() { - const { tabPosition, atTabPosition } = useHOFStore(); - - const t = useTranslations(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 1 && atTabPosition === 0 && isPath("/hof"), - queryKey: ["atTotalHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/atTotal"); - return data.map((hof) => ({ - ...hof, - text: t("textHandled", { value: formatText(hof.value) }), - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetLevelHOF.ts b/qwilight-fe/src/hof/useGetLevelHOF.ts deleted file mode 100644 index cc9b2ae..0000000 --- a/qwilight-fe/src/hof/useGetLevelHOF.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetLevelHOF() { - const { tabPosition } = useHOFStore(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 3 && isPath("/hof"), - queryKey: ["levelHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/level"); - return data.map((hof) => ({ - ...hof, - text: `LV.${formatText(hof.value)}`, - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetTotalBandHOF.ts b/qwilight-fe/src/hof/useGetTotalBandHOF.ts deleted file mode 100644 index 8fb6781..0000000 --- a/qwilight-fe/src/hof/useGetTotalBandHOF.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useTranslations } from "next-intl"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetTotalBandHOF() { - const { tabPosition, totalTabPosition } = useHOFStore(); - - const t = useTranslations(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 0 && totalTabPosition === 3 && isPath("/hof"), - queryKey: ["totalBandHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/totalBand"); - return data.map((hof) => ({ - ...hof, - text: t("textBand", { value: formatText(hof.value) }), - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetTotalHighestHOF.ts b/qwilight-fe/src/hof/useGetTotalHighestHOF.ts deleted file mode 100644 index d037d38..0000000 --- a/qwilight-fe/src/hof/useGetTotalHighestHOF.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useTranslations } from "next-intl"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetTotalHighestHOF() { - const { tabPosition, totalTabPosition } = useHOFStore(); - - const t = useTranslations(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 0 && totalTabPosition === 1 && isPath("/hof"), - queryKey: ["totalHighestHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/totalHighest"); - return data.map((hof) => ({ - ...hof, - text: t("textCount", { value: formatText(hof.value) }), - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetTotalStandHOF.ts b/qwilight-fe/src/hof/useGetTotalStandHOF.ts deleted file mode 100644 index 2b00b4a..0000000 --- a/qwilight-fe/src/hof/useGetTotalStandHOF.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useTranslations } from "next-intl"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetTotalStandHOF() { - const { tabPosition, totalTabPosition } = useHOFStore(); - - const t = useTranslations(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 0 && totalTabPosition === 2 && isPath("/hof"), - queryKey: ["totalStandHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/totalStand"); - return data.map((hof) => ({ - ...hof, - text: t("textStand", { value: formatText(hof.value) }), - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/hof/useGetTotalTotalHOF.ts b/qwilight-fe/src/hof/useGetTotalTotalHOF.ts deleted file mode 100644 index 3949216..0000000 --- a/qwilight-fe/src/hof/useGetTotalTotalHOF.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { useHOFStore } from "@/Stores"; -import { formatText } from "@/Utility"; - -import { wwwAXIOS } from "@/Www"; -import { GetHOFAPI } from "@/wwwAPI"; -import { useQuery } from "@tanstack/react-query"; -import { useTranslations } from "next-intl"; -import { useIsPath } from "taehui-ts/fe-utility"; - -export default function useGetTotalTotalHOF() { - const { tabPosition, totalTabPosition } = useHOFStore(); - - const t = useTranslations(); - - const isPath = useIsPath(); - - return useQuery< - { - avatarID: string; - avatarName: string; - text: string; - }[] - >({ - enabled: tabPosition === 0 && totalTabPosition === 0 && isPath("/hof"), - queryKey: ["totalTotalHOF"], - queryFn: async () => { - const { data } = await wwwAXIOS.get("/hof/totalTotal"); - return data.map((hof) => ({ - ...hof, - text: t("textHandled", { value: formatText(hof.value) }), - })); - }, - initialData: [], - }); -} diff --git a/qwilight-fe/src/wwwAPI.d.ts b/qwilight-fe/src/wwwAPI.d.ts index aeaf411..015bb69 100644 --- a/qwilight-fe/src/wwwAPI.d.ts +++ b/qwilight-fe/src/wwwAPI.d.ts @@ -176,7 +176,7 @@ value: number; }; -export type GetHOFAPI = { +export type GetHallAPI = { avatarID: string; avatarName: string; value: number;