Skip to content

Commit

Permalink
should have fixed #173
Browse files Browse the repository at this point in the history
  • Loading branch information
luketd committed Oct 20, 2024
1 parent 33c6ee2 commit f8ef95c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 32 deletions.
2 changes: 1 addition & 1 deletion components/collection/PackOpen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const PackOpen: React.FC<PackOpenProps> = ({ packID }) => {
width={300}
height={475}
alt={`Card ${card.cardID}`}
className={`rounded-sm`}
className={`rounded-sm hover:scale-105 hover:shadow-xl`}
loading="lazy"
unoptimized={true}
/>
Expand Down
44 changes: 13 additions & 31 deletions pages/packs/[packID]/index.tsx → pages/packs/[packID].tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
import React from 'react'
import { useRouter } from 'next/router'
import {
Box,
SimpleGrid,
Spinner,
Text,
Card,
CardBody,
Image,
VStack,
HStack,
} from '@chakra-ui/react'
import { Box, Spinner, VStack, HStack } from '@chakra-ui/react'
import { query } from '@pages/api/database/query'
import { GET } from '@constants/http-methods'
import axios from 'axios'
import { LatestCards, UserPacks } from '@pages/api/v3'
import { PageWrapper } from '@components/common/PageWrapper'
import { UserData } from '@pages/api/v3/user'
import { formatDateTime } from '@utils/formatDateTime'
import PackOpen from '@components/collection/PackOpen'
import GetUsername from '@components/common/GetUsername'
import { GetServerSideProps } from 'next'

interface PackPageProps {
customImageLoader?: (src: string) => string
imageWidth?: number
imageHeight?: number
}

const PackPage: React.FC<PackPageProps> = ({
customImageLoader = (src: string) =>
`https://simulationhockey.com/tradingcards/${src}.png`,
imageWidth = 200,
imageHeight = 300,
}) => {
const router = useRouter()
const packID = router.query.packID as string | undefined
export default ({ packID }: { packID: string }) => {

const { payload: cards, isLoading } = query<LatestCards[]>({
queryKey: ['latest-cards', packID],
Expand All @@ -55,11 +32,8 @@ const PackPage: React.FC<PackPageProps> = ({
}),
enabled: !!packID,
})
if (!packID) {
return <div>Invalid Pack ID</div>
}

if (isLoading || packsLoading ) {
if (isLoading || packsLoading) {
return (
<Box
display="flex"
Expand Down Expand Up @@ -101,4 +75,12 @@ const PackPage: React.FC<PackPageProps> = ({
)
}

export default PackPage
export const getServerSideProps: GetServerSideProps = async ({ query }) => {
const { packID } = query;

return {
props: {
packID,
},
};
};

0 comments on commit f8ef95c

Please sign in to comment.