Skip to content

Commit

Permalink
Merge pull request #412 from decentraland/fix/prefixed-links
Browse files Browse the repository at this point in the history
fix: Prefixed links
  • Loading branch information
LautaroPetaccio authored Nov 29, 2023
2 parents 08be619 + 69d7e75 commit ee4cdb9
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 32 deletions.
33 changes: 18 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"caniuse-lite": "^1.0.30001470",
"core-js": "^3.22.2",
"cssnano": "^5.0.10",
"decentraland-gatsby": "^5.92.0",
"decentraland-gatsby": "^5.96.0",
"es6-shim": "^0.35.6",
"express-fileupload": "^1.2.1",
"gatsby": "4.23.0",
Expand Down
4 changes: 3 additions & 1 deletion src/components/Layout/OverviewList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from "react"

import { withPrefix } from "gatsby"

import useFormatMessage from "decentraland-gatsby/dist/hooks/useFormatMessage"
import { navigate } from "decentraland-gatsby/dist/plugins/intl"
import TokenList from "decentraland-gatsby/dist/utils/dom/TokenList"
Expand Down Expand Up @@ -83,7 +85,7 @@ export default React.memo(function OverviewList(props: OverviewListProps) {
<Button
basic
as="a"
href={props.href}
href={withPrefix(props.href)}
onClick={(e) => {
e.preventDefault()
navigate(props.href)
Expand Down
14 changes: 12 additions & 2 deletions src/components/Place/PlaceCard/PlaceCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useCallback, useContext, useMemo } from "react"

import { withPrefix } from "gatsby"

import ImgFixed from "decentraland-gatsby/dist/components/Image/ImgFixed"
import useTrackContext from "decentraland-gatsby/dist/context/Track/useTrackContext"
import useTrackLinkContext from "decentraland-gatsby/dist/context/Track/useTrackLinkContext"
Expand Down Expand Up @@ -109,10 +111,18 @@ export default React.memo(function PlaceCard(props: PlaceCardProps) {
</div>
</Link>
<Card.Content>
<Card.Header as="a" href={href} onClick={handleClickCard}>
<Card.Header
as="a"
href={href ? withPrefix(href) : href}
onClick={handleClickCard}
>
{place?.title || " "}
</Card.Header>
<Card.Meta as="a" href={href} onClick={handleClickCard}>
<Card.Meta
as="a"
href={href ? withPrefix(href) : href}
onClick={handleClickCard}
>
{place?.contact_name || " "}
</Card.Meta>
{false && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Place/PlaceDetails/PlaceDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import useFormatMessage from "decentraland-gatsby/dist/hooks/useFormatMessage"
import { SceneContentRating } from "decentraland-gatsby/dist/utils/api/Catalyst.types"
import TokenList from "decentraland-gatsby/dist/utils/dom/TokenList"
import { Tabs } from "decentraland-ui/dist/components/Tabs/Tabs"
import { intersects } from "radash/dist/array"
import { intersects } from "radash"
import rehypeSanitize from "rehype-sanitize"
import remarkGfm from "remark-gfm"
import Icon from "semantic-ui-react/dist/commonjs/elements/Icon"
Expand Down
6 changes: 4 additions & 2 deletions src/components/Place/PlaceFeatured/PlaceFeatured.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useMemo } from "react"

import { withPrefix } from "gatsby"

import useTrackLinkContext from "decentraland-gatsby/dist/context/Track/useTrackLinkContext"
import useFormatMessage from "decentraland-gatsby/dist/hooks/useFormatMessage"
import { navigate } from "decentraland-gatsby/dist/plugins/intl/utils"
Expand Down Expand Up @@ -51,7 +53,7 @@ export default React.memo(function PlaceFeatured(props: PlaceFeaturedProps) {
<Button
primary
as="a"
href={placeJumpInUrl}
href={withPrefix(placeJumpInUrl)}
onClick={handleJumpInTrack}
target="_blank"
data-event={SegmentPlace.JumpIn}
Expand All @@ -64,7 +66,7 @@ export default React.memo(function PlaceFeatured(props: PlaceFeaturedProps) {
<Button
secondary
as="a"
href={placeDetailUrl}
href={withPrefix(placeDetailUrl)}
onClick={(e: React.MouseEvent<HTMLButtonElement>) => {
e.preventDefault()
placeDetailUrl && navigate(placeDetailUrl)
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Place/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
values,
} from "decentraland-gatsby/dist/entities/Database/utils"
import { numeric, oneOf } from "decentraland-gatsby/dist/entities/Schema/utils"
import { diff, unique } from "radash/dist/array"
import { diff, unique } from "radash"
import isEthereumAddress from "validator/lib/isEthereumAddress"

import PlaceCategories from "../PlaceCategories/model"
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Place/routes/getPlaceMostActiveList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
numeric,
oneOf,
} from "decentraland-gatsby/dist/entities/Schema/utils"
import { flat, sort } from "radash/dist/array"
import { flat, sort } from "radash"

import { getHotScenes } from "../../../modules/hotScenes"
import { getSceneStats } from "../../../modules/sceneStats"
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Place/routes/getPlaceUserVisitsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Context from "decentraland-gatsby/dist/entities/Route/wkc/context/Context
import ApiResponse from "decentraland-gatsby/dist/entities/Route/wkc/response/ApiResponse"
import Router from "decentraland-gatsby/dist/entities/Route/wkc/routes/Router"
import { bool, numeric } from "decentraland-gatsby/dist/entities/Schema/utils"
import { sort } from "radash/dist/array"
import { sort } from "radash"

import { getHotScenes } from "../../../modules/hotScenes"
import { getSceneStats } from "../../../modules/sceneStats"
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Report/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Context from "decentraland-gatsby/dist/entities/Route/wkc/context/Context
import ApiResponse from "decentraland-gatsby/dist/entities/Route/wkc/response/ApiResponse"
import routes from "decentraland-gatsby/dist/entities/Route/wkc/routes"
import env from "decentraland-gatsby/dist/utils/env"
import { retry } from "radash/dist/async"
import { retry } from "radash"

import { extension } from "./util"

Expand Down
2 changes: 1 addition & 1 deletion src/modules/entityScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Catalyst, {
ContentEntityScene,
} from "decentraland-gatsby/dist/utils/api/Catalyst"
import Time from "decentraland-gatsby/dist/utils/date/Time"
import { memo } from "radash/dist/curry"
import { memo } from "radash"

const loader = new DataLoader(
async function (
Expand Down
2 changes: 1 addition & 1 deletion src/modules/pois.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Time from "decentraland-gatsby/dist/utils/date/Time"
import env from "decentraland-gatsby/dist/utils/env"
import { memo } from "radash/dist/curry"
import { memo } from "radash"

const DCL_LIST_URL = env(
`GATSBY_DCL_LIST_URL`,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/sceneStats.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Time from "decentraland-gatsby/dist/utils/date/Time"
import { memo } from "radash/dist/curry"
import { memo } from "radash"

import DataTeam from "../api/DataTeam"

Expand Down
2 changes: 1 addition & 1 deletion src/modules/worldsLiveData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Time from "decentraland-gatsby/dist/utils/date/Time"
import fetch from "node-fetch"
import { memo } from "radash/dist/curry"
import { memo } from "radash"

export type WorldLivePerWorldProps = {
users: number
Expand Down
2 changes: 1 addition & 1 deletion src/pages/favorites/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Container } from "decentraland-ui/dist/components/Container/Container"
import { Header } from "decentraland-ui/dist/components/Header/Header"
import { HeaderMenu } from "decentraland-ui/dist/components/HeaderMenu/HeaderMenu"
import { SignIn } from "decentraland-ui/dist/components/SignIn/SignIn"
import { cluster } from "radash/dist/array"
import { cluster } from "radash"
import Icon from "semantic-ui-react/dist/commonjs/elements/Icon"

import Navigation, { NavigationTab } from "../../components/Layout/Navigation"
Expand Down
4 changes: 3 additions & 1 deletion src/pages/place.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useCallback, useEffect, useMemo, useState } from "react"

import { withPrefix } from "gatsby"
import { Helmet } from "react-helmet"

import { useLocation } from "@gatsbyjs/reach-router"
Expand Down Expand Up @@ -102,7 +103,8 @@ export default function PlacePage() {
share({
title: place.title || undefined,
text: `${l("general.place_share")}${shareableText}`,
url: location.origin + locations.place(place.base_position),
url:
location.origin + withPrefix(locations.place(place.base_position)),
thumbnail: place.image || undefined,
})
}
Expand Down

0 comments on commit ee4cdb9

Please sign in to comment.