diff --git a/apps/api/src/app/getters/getStaticData.ts b/apps/api/src/app/getters/getStaticData.ts
index 92fddc0..d4b06b7 100644
--- a/apps/api/src/app/getters/getStaticData.ts
+++ b/apps/api/src/app/getters/getStaticData.ts
@@ -1,12 +1,36 @@
import { memoize, orderBy, uniq } from 'lodash-es'
import semver from 'semver'
+import { draconians } from '~/app/constants'
import { prisma } from '~/prisma'
export const getStaticData = memoize(async () => {
const [races, classes, gods, versions] = await Promise.all([
- prisma.race.findMany({
- orderBy: [{ trunk: 'desc' }, { name: 'asc' }],
- }),
+ prisma.race
+ .findMany({
+ orderBy: [{ trunk: 'desc' }, { name: 'asc' }],
+ })
+ .then((data) => {
+ return data.flatMap((r) => {
+ if (r.name !== 'Draconian') {
+ return {
+ ...r,
+ isSubRace: false,
+ }
+ }
+
+ return [
+ {
+ ...r,
+ isSubRace: false,
+ },
+ ...draconians.map((name) => ({
+ ...r,
+ name,
+ isSubRace: true,
+ })),
+ ]
+ })
+ }),
prisma.class.findMany({
orderBy: [{ trunk: 'desc' }, { name: 'asc' }],
}),
diff --git a/apps/api/src/app/routes/search/index.ts b/apps/api/src/app/routes/search/index.ts
index 6b80899..df1a617 100644
--- a/apps/api/src/app/routes/search/index.ts
+++ b/apps/api/src/app/routes/search/index.ts
@@ -131,6 +131,14 @@ export const getFilterOptions = async () => {
conditions: defaultConditions,
values: races.map((r) => r.name),
transformValue: (value: string) => value,
+ getValue: (item: FilterItem, condition: (typeof defaultConditions)[number]) => {
+ const isSubRace = races.some((r) => r.name === item.value && r.isSubRace)
+ return {
+ [isSubRace ? 'race' : 'normalizedRace']: {
+ [condition.toSql]: item.value,
+ },
+ }
+ },
},
{
type: 'select',
diff --git a/apps/api/src/app/routes/suggest/index.ts b/apps/api/src/app/routes/suggest/index.ts
index bea592a..a9836a2 100644
--- a/apps/api/src/app/routes/suggest/index.ts
+++ b/apps/api/src/app/routes/suggest/index.ts
@@ -59,7 +59,8 @@ export const suggestRoute = (app: AppType) => {
getCombosData({
where: {
...where,
- normalizedRace: race?.name,
+ normalizedRace: race && !race.isSubRace ? race.name : undefined,
+ race: race && race.isSubRace ? race.name : undefined,
normalizedClass: cls?.name,
god: god?.name,
versionShort: version ?? versions[0],
diff --git a/apps/web/src/screens/Player/Games.tsx b/apps/web/src/screens/Player/Games.tsx
index a702fb0..356d7a8 100644
--- a/apps/web/src/screens/Player/Games.tsx
+++ b/apps/web/src/screens/Player/Games.tsx
@@ -4,7 +4,6 @@ import { useMemo, useState } from 'react'
import { GamesList } from '~/components/GamesList'
import { Select } from '~/components/ui/Select'
import { Tooltip } from '~/components/ui/Tooltip'
-import { Class, Race } from '~/types'
import { usePlayerPageContext } from './context'
enum Filter {
@@ -25,14 +24,16 @@ const runeOptions = [
...range(0, 15).map((value) => ({ value: [value], name: String(value) })),
]
-export const Games = ({
- allActualRaces,
- allActualClasses,
-}: {
- allActualRaces: Race[]
- allActualClasses: Class[]
-}) => {
- const { lastGames, stats, player, gods, toggleOption, isOptionEnabled } = usePlayerPageContext()
+export const Games = () => {
+ const {
+ lastGames,
+ stats,
+ player,
+ gods,
+ toggleOption,
+ isOptionEnabled,
+ summary: { allActualClasses, allActualRaces },
+ } = usePlayerPageContext()
const [data, setData] = useState(() => ({ games: lastGames, total: stats.total.games }))
const sortedGods = useMemo(() => orderBy(gods, (x) => x.name.toLowerCase()), [gods])
const [filter, setFilter] = useState(() => ({
diff --git a/apps/web/src/screens/Player/main.tsx b/apps/web/src/screens/Player/main.tsx
index 67f6c65..d21e083 100644
--- a/apps/web/src/screens/Player/main.tsx
+++ b/apps/web/src/screens/Player/main.tsx
@@ -18,8 +18,6 @@ import { usePlayerPageContext } from './context'
export const Player = () => {
const { player, summary, gods, tiamat } = usePlayerPageContext()
- const { allActualClasses, allActualRaces } = summary
-
const wonGodsStats =