-
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.
- Loading branch information
1 parent
345c6b8
commit a75a9f5
Showing
68 changed files
with
694 additions
and
361 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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,9 @@ | ||
import Spinner from '~/components/styled/Spinner'; | ||
|
||
const Loading = () => ( | ||
<div className="my-6 flex grow items-center justify-center"> | ||
<Spinner /> | ||
</div> | ||
); | ||
|
||
export default Loading; |
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,56 @@ | ||
import { notFound } from 'next/navigation'; | ||
import { z } from 'zod'; | ||
|
||
import TalentBuilder from '~/components/builder/TalentBuilder'; | ||
import { getOgInfo } from '~/server/api/routers/openGraph'; | ||
import { classMask, getIconPath } from '~/utils'; | ||
import { env } from '~/env'; | ||
import { getCollectionTree } from '~/server/api/routers/collection'; | ||
|
||
const ParamsSchema = z.object({ | ||
collection: z.string(), | ||
class: z.preprocess( | ||
v => | ||
Object.entries(classMask).find( | ||
m => m[1].name.toLocaleLowerCase() === v | ||
)?.[0] ?? 0, | ||
z.coerce.number() | ||
), | ||
index: z.coerce.number() | ||
}); | ||
|
||
type PageProps = { | ||
params: z.infer<typeof ParamsSchema>; | ||
}; | ||
|
||
export const generateMetadata = async ({ params }: PageProps) => { | ||
const parsed = ParamsSchema.safeParse(params); | ||
if (!parsed.success) return notFound(); | ||
|
||
const talentTree = await getCollectionTree(parsed.data); | ||
if (!talentTree) return notFound(); | ||
|
||
const info = await getOgInfo(talentTree.id); | ||
if (!info) return null; | ||
return { | ||
title: `${info.name} | Talent Builder`, | ||
description: `Talent tree created by ${info.user.name}`, | ||
icons: [{ rel: 'icon', url: env.DEPLOY_URL + getIconPath(info.icon) }] | ||
}; | ||
}; | ||
|
||
const TalentTreePage = async ({ params }: PageProps) => { | ||
const parsed = ParamsSchema.safeParse(params); | ||
if (!parsed.success) { | ||
console.dir(parsed.error, { depth: null }); | ||
return notFound(); | ||
} | ||
|
||
console.log(parsed.data); | ||
const talentTree = await getCollectionTree(parsed.data); | ||
if (!talentTree) return notFound(); | ||
|
||
return <TalentBuilder defaultValues={talentTree} />; | ||
}; | ||
|
||
export default TalentTreePage; |
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,9 @@ | ||
import Spinner from '~/components/styled/Spinner'; | ||
|
||
const Loading = () => ( | ||
<div className="my-6 flex grow items-center justify-center"> | ||
<Spinner /> | ||
</div> | ||
); | ||
|
||
export default Loading; |
Oops, something went wrong.