diff --git a/docs/src/components/Leagues.tsx b/docs/src/components/Leagues.tsx index 722c10d799..32f6184c6a 100644 --- a/docs/src/components/Leagues.tsx +++ b/docs/src/components/Leagues.tsx @@ -11,121 +11,66 @@ function toTitleCase(str: string) { const tiers = Object.keys(combatAchievements).map(t => t.toLowerCase()); const allTasksFlat = Object.values(combatAchievements).flatMap((tier: any) => - tier.tasks.map((t: any) => ({ ...t, tier: tier.name.toLowerCase() })) + tier.tasks.map(t => ({ ...t, tier: tier.name.toLowerCase() })) ); - -export type APIUser = { - id: string; - completed_ca_task_ids: number[]; - is_ironman: boolean; - leagues_completed_tasks_ids: number[]; -}; - export function Leagues() { const [tiersBeingShown, setTiersBeingShown] = useState(tiers); const [tasksBeingShown, setTasksBeingShown] = useState(allTasksFlat); - const [hideCompleted, setHideCompleted] = useState(false); const [userID, setUserID] = useState(null); - const [data, setData] = useState(null); - const [isLoading, setIsLoading] = useState(false); + // const [data, setData] = useState(); - useEffect(() => { - setTasksBeingShown( - allTasksFlat.filter(task => { - if (hideCompleted && data?.completed_ca_task_ids.includes(task.id)) return false; - return tiersBeingShown.includes(task.tier); - }) - ); - }, [tiersBeingShown, data, hideCompleted]); + // console.log({data}); + // useEffect(() => { + // fetch('https://api.oldschool.gg/') + // .then(response => response.json()) + // .then(data => setData(data)); + // }, []); useEffect(() => { - if (localStorage) { - const storedUserID = localStorage.getItem('userID'); - if (storedUserID) setUserID(storedUserID); - - const storedData = localStorage.getItem(`minion.${storedUserID}`); - if (storedData) setData(JSON.parse(storedData)); - } - }, []); + setTasksBeingShown(allTasksFlat.filter(task => tiersBeingShown.includes(task.tier))); + }, [tiersBeingShown]); return ( <>
-
-