-
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.
refactor: move components around to reflect next 14 pages structure
- Loading branch information
Showing
49 changed files
with
395 additions
and
430 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Layout } from "#components"; | ||
import EncounterContainer from "./_components/EncounterHeading/EncounterContainer"; | ||
|
||
const EncounterPage = () => { | ||
return ( | ||
<Layout> | ||
<EncounterContainer /> | ||
</Layout> | ||
); | ||
}; | ||
|
||
export { EncounterPage }; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,13 @@ | ||
import React from "react"; | ||
import { Layout } from "#components"; | ||
import ListEncounters from "./_components/ListEncounters/ListEncounters"; | ||
|
||
const EncountersPage = () => { | ||
return ( | ||
<Layout> | ||
<ListEncounters /> | ||
</Layout> | ||
); | ||
}; | ||
|
||
export { EncountersPage }; |
19 changes: 19 additions & 0 deletions
19
features/encounters/EncountersCategory/EncountersCategory.page.tsx
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 { startCase } from "lodash"; | ||
import { useRouter } from "next/router"; | ||
import React from "react"; | ||
import { Layout } from "#components"; | ||
import ListEncounterCategories from "./_components/ListEncounterCategories/ListEncounterCategories"; | ||
|
||
const EncountersCategoryPage = () => { | ||
const { | ||
query: { category }, | ||
} = useRouter(); | ||
|
||
return ( | ||
<Layout title={startCase(category as string)}> | ||
<ListEncounterCategories /> | ||
</Layout> | ||
); | ||
}; | ||
|
||
export { EncountersCategoryPage }; |
42 changes: 42 additions & 0 deletions
42
...unters/EncountersCategory/_components/ListEncounterCategories/ListEncounterCategories.tsx
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,42 @@ | ||
import { CategoryPageType } from "@exile-watch/encounter-data"; | ||
import { SimpleGrid } from "@exile-watch/writ-react"; | ||
import { useRouter } from "next/router"; | ||
import React, { useEffect, useState } from "react"; | ||
import { HomepageCard, SimpleCard } from "#components"; | ||
|
||
const ListEncounterCategories = () => { | ||
const { | ||
query: { category }, | ||
} = useRouter(); | ||
const [data, setData] = useState<CategoryPageType | null>(null); | ||
|
||
useEffect(() => { | ||
import( | ||
`@exile-watch/encounter-data/dist/extracted-data/${category}.esm` as string | ||
) | ||
.then((d) => { | ||
setData(d.default); | ||
}) | ||
.catch(() => { | ||
setData(null); | ||
}); | ||
}, [category]); | ||
|
||
const isCommonMaps = category === "common-maps"; | ||
|
||
return ( | ||
<SimpleGrid | ||
cols={{ xxxl: 6, xxl: 5, xl: 4, lg: 3, md: 2, sm: 2, xs: 1 }} | ||
mb="md" | ||
> | ||
{isCommonMaps && | ||
data?.map((data) => <SimpleCard key={data.path} {...data} />)} | ||
{!isCommonMaps && | ||
data?.map((data) => ( | ||
<HomepageCard key={data.path} {...data} isCategory={false} /> | ||
))} | ||
</SimpleGrid> | ||
); | ||
}; | ||
|
||
export default ListEncounterCategories; |
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,22 @@ | ||
import { startCase } from "lodash"; | ||
import { useRouter } from "next/router"; | ||
import React from "react"; | ||
import { Layout } from "#components"; | ||
import { EncounterPage } from "#features/pages"; | ||
import ListEncounterMap from "./_components/ListEncounterMap/ListEncounterMap"; | ||
|
||
const EncountersMapPage = () => { | ||
const { | ||
query: { category, map }, | ||
} = useRouter(); | ||
|
||
if (category !== "common-maps") return <EncounterPage />; | ||
|
||
return ( | ||
<Layout title={startCase(map as string)}> | ||
<ListEncounterMap /> | ||
</Layout> | ||
); | ||
}; | ||
|
||
export { EncountersMapPage }; |
52 changes: 52 additions & 0 deletions
52
features/encounters/EncountersMap/_components/ListEncounterMap/ListEncounterMap.tsx
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,52 @@ | ||
import { MapType } from "@exile-watch/encounter-data"; | ||
import { SimpleGrid } from "@exile-watch/writ-react"; | ||
import { kebabCase } from "lodash"; | ||
import { useRouter } from "next/router"; | ||
import React, { useEffect, useState } from "react"; | ||
import { HomepageCard } from "#components"; | ||
import { EncounterPage } from "#features/pages"; | ||
|
||
const ListEncounterMap = () => { | ||
const { | ||
query: { category, map }, | ||
asPath, | ||
} = useRouter(); | ||
const [data, setData] = useState<MapType | null>(null); | ||
|
||
useEffect(() => { | ||
import( | ||
`@exile-watch/encounter-data/dist/extracted-data/${category}/${map}.esm` as string | ||
) | ||
.then((d) => { | ||
setData(d.default); | ||
}) | ||
.catch(() => { | ||
setData(null); | ||
}); | ||
}, [map]); | ||
|
||
if (!map) return null; | ||
|
||
if (category !== "common-maps") return <EncounterPage />; | ||
|
||
return ( | ||
<SimpleGrid cols={{ xxxl: 6, xxl: 5, xl: 4, lg: 3, md: 2, sm: 2, xs: 1 }}> | ||
{data?.bosses.map(({ name: encounterName, abilities }) => { | ||
const ability = abilities?.pop(); | ||
const path = `${asPath}/${kebabCase(encounterName)}`; | ||
|
||
return ( | ||
<HomepageCard | ||
key={path} | ||
name={encounterName} | ||
gif={ability?.gif} | ||
path={path} | ||
isCategory={false} | ||
/> | ||
); | ||
})} | ||
</SimpleGrid> | ||
); | ||
}; | ||
|
||
export default ListEncounterMap; |
Oops, something went wrong.