Skip to content

Commit

Permalink
Fix the issue #444 (#874)
Browse files Browse the repository at this point in the history
* Fix the issue #444
* fix: remove extra / in image path

---------

Co-authored-by: viet nguyen <vietnguyen@noreply>
  • Loading branch information
Ali7040 and viet nguyen authored Jun 18, 2023
1 parent d13c24f commit e10595c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@
"engines": {
"node": "18"
}
}
}
10 changes: 5 additions & 5 deletions src/components/ui/FeatureCard/FeatureCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { sanitizeName } from '../../../js/utils'
import { FeatureImage } from './FeatureImage'
import { CLIENT_CONFIG } from '../../../js/configs/clientConfig'

function FeatureCard ({ area }: { area: AreaType }): JSX.Element {
function FeatureCard ({ area }: { area: AreaType }): JSX.Element | null {
const { areaName, pathTokens, aggregate, metadata, totalClimbs, media } = area
let imageUrl
if (media != null && media.length > 0) {
imageUrl = `${CLIENT_CONFIG.CDN_BASE_URL}/${shuffle(media)[0].mediaUrl}?format=webp&h=300&q=90`
}

if (media == null || media.length === 0) return null

const imageUrl = `${CLIENT_CONFIG.CDN_BASE_URL}${shuffle(media)[0].mediaUrl}?format=webp&h=300&q=90`

const image = {
url: imageUrl,
Expand Down
9 changes: 5 additions & 4 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { IndexResponseType, MediaWithTags } from '../js/types'
import { ExploreProps } from '../components/home/DenseAreas'
import TabsTrigger from '../components/ui/TabsTrigger'
import RecentTaggedMedia from '../components/home/RecentMedia'
import { FRAGMENT_MEDIA_WITH_TAGS } from '../js/graphql/gql/tags'

const allowedViews = ['explore', 'newTags', 'map', 'edit', 'pulse']

Expand Down Expand Up @@ -135,8 +136,8 @@ const Home: NextPage<HomePageType> = ({ exploreData, recentMediaWithTags }) => {
}

export const getStaticProps: GetStaticProps = async ({ params }) => {
// ${FRAGMENT_MEDIA_WITH_TAGS}
const query = gql`
${FRAGMENT_MEDIA_WITH_TAGS}
query UsaAreas( $filter: Filter) {
areas(filter: $filter, sort: { totalClimbs: -1 }) {
id
Expand Down Expand Up @@ -175,9 +176,9 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
lng
areaId
}
# media {
# ... MediaWithTagsFields
# }
media {
... MediaWithTagsFields
}
}
}`

Expand Down

1 comment on commit e10595c

@vercel
Copy link

@vercel vercel bot commented on e10595c Jun 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.