forked from lgou2w/HoYo.Gacha
-
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.
- Loading branch information
Showing
24 changed files
with
596 additions
and
453 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
import React from 'react' | ||
import { useRouteError } from 'react-router-dom' | ||
import Box from '@mui/material/Box' | ||
import Typography from '@mui/material/Typography' | ||
import React from "react"; | ||
import { useRouteError } from "react-router-dom"; | ||
import Box from "@mui/material/Box"; | ||
import Typography from "@mui/material/Typography"; | ||
|
||
export default function ErrorPage () { | ||
const error = useRouteError() as any | ||
console.error(error) | ||
export default function ErrorPage() { | ||
const error = useRouteError(); | ||
console.error(error); | ||
// TODO: Error page | ||
|
||
return ( | ||
<Box padding={2}> | ||
<Typography variant="h5">Oops!</Typography> | ||
<Typography gutterBottom>Sorry, an unexpected error has occurred.</Typography> | ||
<Typography gutterBottom> | ||
Sorry, an unexpected error has occurred. | ||
</Typography> | ||
<Typography> | ||
<pre>{error.stack || error.statusText || error.message}</pre> | ||
</Typography> | ||
</Box> | ||
) | ||
); | ||
} |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import React from 'react' | ||
import Box from '@mui/material/Box' | ||
import React from "react"; | ||
import Box from "@mui/material/Box"; | ||
|
||
export default function Content (props: React.PropsWithChildren) { | ||
export default function Content(props: React.PropsWithChildren) { | ||
return ( | ||
<Box component="main" display="flex" flexDirection="column" width="100%"> | ||
{props.children} | ||
</Box> | ||
) | ||
); | ||
} |
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 |
---|---|---|
@@ -1,28 +1,26 @@ | ||
import React from 'react' | ||
import Avatar, { AvatarProps } from '@mui/material/Avatar' | ||
import { AccountFacet } from '@/interfaces/account' | ||
import AvatarGenshinLumine from '@/assets/images/genshin/UI_AvatarIcon_PlayerGirl.png' | ||
import AvatarGenshinAether from '@/assets/images/genshin/UI_AvatarIcon_PlayerBoy.png' | ||
import AvatarStarRailTrailblazer from '@/assets/images/starrail/Trailblazer.png' | ||
import React from "react"; | ||
import Avatar, { AvatarProps } from "@mui/material/Avatar"; | ||
import { AccountFacet } from "@/interfaces/account"; | ||
import AvatarGenshinLumine from "@/assets/images/genshin/UI_AvatarIcon_PlayerGirl.png"; | ||
// import AvatarGenshinAether from "@/assets/images/genshin/UI_AvatarIcon_PlayerBoy.png"; | ||
import AvatarStarRailTrailblazer from "@/assets/images/starrail/Trailblazer.png"; | ||
|
||
export interface AccountAvatarProps extends Omit<AvatarProps, 'src'> { | ||
facet: AccountFacet | ||
export interface AccountAvatarProps extends Omit<AvatarProps, "src"> { | ||
facet: AccountFacet; | ||
} | ||
|
||
export default function AccountAvatar (props: AccountAvatarProps) { | ||
const { facet, ...rest } = props | ||
export default function AccountAvatar(props: AccountAvatarProps) { | ||
const { facet, ...rest } = props; | ||
const src = React.useMemo(() => { | ||
switch (facet) { | ||
case AccountFacet.Genshin: | ||
return AvatarGenshinLumine | ||
return AvatarGenshinLumine; | ||
case AccountFacet.StarRail: | ||
return AvatarStarRailTrailblazer | ||
return AvatarStarRailTrailblazer; | ||
default: | ||
return undefined | ||
return undefined; | ||
} | ||
}, [facet]) | ||
}, [facet]); | ||
|
||
return ( | ||
<Avatar src={src} {...rest} /> | ||
) | ||
return <Avatar src={src} {...rest} />; | ||
} |
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 |
---|---|---|
@@ -1,22 +1,28 @@ | ||
import React from 'react' | ||
import { AccountFacet, Account } from '@/interfaces/account' | ||
import { GachaRecords } from '@/hooks/useGachaRecordsQuery' | ||
import React from "react"; | ||
import { AccountFacet, Account } from "@/interfaces/account"; | ||
import { GachaRecords } from "@/hooks/useGachaRecordsQuery"; | ||
|
||
export interface GachaLayoutContextValue { | ||
facet: AccountFacet | ||
selectedAccount: Account | ||
gachaRecords: GachaRecords | ||
alert (error: Error | string | undefined | null | unknown, message?: string): void | ||
facet: AccountFacet; | ||
selectedAccount: Account; | ||
gachaRecords: GachaRecords; | ||
alert( | ||
error: Error | string | undefined | null | unknown, | ||
message?: string | ||
): void; | ||
} | ||
|
||
export const GachaLayoutContext = | ||
React.createContext<GachaLayoutContextValue | undefined>(undefined) | ||
export const GachaLayoutContext = React.createContext< | ||
GachaLayoutContextValue | undefined | ||
>(undefined); | ||
|
||
export function useGachaLayoutContext () { | ||
const context = React.useContext(GachaLayoutContext) | ||
export function useGachaLayoutContext() { | ||
const context = React.useContext(GachaLayoutContext); | ||
if (!context) { | ||
throw new Error('useGachaLayoutContext must be used within a GachaLayoutContext.Provider') | ||
throw new Error( | ||
"useGachaLayoutContext must be used within a GachaLayoutContext.Provider" | ||
); | ||
} else { | ||
return context | ||
return context; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import React from 'react' | ||
import GachaAnalysisSum from '@/components/gacha/analysis/GachaAnalysisSum' | ||
import GachaAnalysisHistory from '@/components/gacha/analysis/GachaAnalysisHistory' | ||
import Stack from '@mui/material/Stack' | ||
import React from "react"; | ||
import GachaAnalysisSum from "@/components/gacha/analysis/GachaAnalysisSum"; | ||
import GachaAnalysisHistory from "@/components/gacha/analysis/GachaAnalysisHistory"; | ||
import Stack from "@mui/material/Stack"; | ||
|
||
export default function GachaAnalysis () { | ||
export default function GachaAnalysis() { | ||
return ( | ||
<Stack direction="column" spacing={2}> | ||
<GachaAnalysisSum /> | ||
<GachaAnalysisHistory /> | ||
</Stack> | ||
) | ||
); | ||
} |
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import React from 'react' | ||
import GachaOverviewLastUpdated from '@/components/gacha/overview/GachaOverviewLastUpdated' | ||
import GachaOverviewGrid from '@/components/gacha/overview/GachaOverviewGrid' | ||
import GachaOverviewTooltips from '@/components/gacha/overview/GachaOverviewTooltips' | ||
import Stack from '@mui/material/Stack' | ||
import React from "react"; | ||
import GachaOverviewLastUpdated from "@/components/gacha/overview/GachaOverviewLastUpdated"; | ||
import GachaOverviewGrid from "@/components/gacha/overview/GachaOverviewGrid"; | ||
import GachaOverviewTooltips from "@/components/gacha/overview/GachaOverviewTooltips"; | ||
import Stack from "@mui/material/Stack"; | ||
|
||
export default function GachaOverview () { | ||
export default function GachaOverview() { | ||
return ( | ||
<Stack direction="column" spacing={2}> | ||
<GachaOverviewLastUpdated /> | ||
<GachaOverviewGrid /> | ||
<GachaOverviewTooltips /> | ||
</Stack> | ||
) | ||
); | ||
} |
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
Oops, something went wrong.