Skip to content

Commit

Permalink
fix: show place when not logged in (#583)
Browse files Browse the repository at this point in the history
feat: change places url for slack message
  • Loading branch information
braianj authored Jan 28, 2025
1 parent 73870ac commit b7d804e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/config/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"GATSBY_DECENTRALAND_URL": "https://play.decentraland.zone",
"GATSBY_LAND_URL": "https://api.decentraland.zone",
"GATSBY_PLACES_URL": "https://places.decentraland.zone/api",
"GATSBY_PLACES_BASE_URL": "https://decentraland.zone/places/",
"GATSBY_PROFILE_URL": "https://peer.decentraland.zone",
"GATSBY_INTERCOM_APP_ID": "z0h94kay",
"GATSBY_SENTRY_SRC": "https://js.sentry-cdn.com/bb04b48d542c5a48ad9f41ea2429a500.min.js",
Expand Down
1 change: 1 addition & 0 deletions src/config/local.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"GATSBY_DECENTRALAND_URL": "https://play.decentraland.org",
"GATSBY_LAND_URL": "https://api.decentraland.org",
"GATSBY_PLACES_URL": "/api",
"GATSBY_PLACES_BASE_URL": "/",
"GATSBY_PROFILE_URL": "https://peer.decentraland.org",
"GATSBY_INTERCOM_APP_ID": "z0h94kay",
"GATSBY_SENTRY_SRC": "https://js.sentry-cdn.com/bb04b48d542c5a48ad9f41ea2429a500.min.js",
Expand Down
1 change: 1 addition & 0 deletions src/config/prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"GATSBY_CHAIN_ID": "1,137",
"GATSBY_DECENTRALAND_URL": "https://play.decentraland.org",
"GATSBY_PLACES_URL": "https://places.decentraland.org/api",
"GATSBY_PLACES_BASE_URL": "https://decentraland.org/places/",
"GATSBY_LAND_URL": "https://api.decentraland.org",
"GATSBY_PROFILE_URL": "https://peer.decentraland.org",
"GATSBY_INTERCOM_APP_ID": "z0h94kay",
Expand Down
4 changes: 2 additions & 2 deletions src/entities/Place/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ describe("Instance of URL", () => {
const url = placeUrl(placeGenesisPlaza)
expect(url).toBeInstanceOf(URL)
expect(url.toString()).toBe(
"https://places.decentraland.org/places/place/?position=-9.-9"
"https://decentraland.org/places/place/?position=-9.-9"
)
})

test("should return an URL instance of places", () => {
const url = siteUrl()
expect(url).toBeInstanceOf(URL)
expect(url.toString()).toBe("https://places.decentraland.org/places/")
expect(url.toString()).toBe("https://decentraland.org/places/")
})
})

Expand Down
12 changes: 9 additions & 3 deletions src/entities/Place/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,27 @@ const DECENTRALAND_URL =
const CONTENT_SERVER_URL = env("PROFILE_URL", "https://peer.decentraland.org")

export function placeUrl(place: PlaceAttributes) {
const target = new URL(env("PLACES_URL", "https://places.decentraland.org"))
const target = new URL(
env("PLACES_BASE_URL", "https://decentraland.org/places")
)
target.searchParams.set("position", toCanonicalPosition(place.base_position)!)
target.pathname = "/places/place/"
return target
}

export function worldUrl(place: PlaceAttributes) {
const target = new URL(env("PLACES_URL", "https://places.decentraland.org"))
const target = new URL(
env("PLACES_BASE_URL", "https://decentraland.org/places")
)
target.searchParams.set("name", place.world_name!)
target.pathname = `/places/world/`
return target
}

export function siteUrl(pathname = "") {
const target = new URL(env("PLACES_URL", "https://places.decentraland.org"))
const target = new URL(
env("PLACES_BASE_URL", "https://decentraland.org/places")
)
target.pathname = pathname ? `/places/${pathname}/` : "/places/"
return target
}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/usePlaceFromParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ export function usePlaceFromParams(
return null
},
[params, ...deps],
{ callWithTruthyDeps: true, initialValue: null }
{ initialValue: null }
)
}

0 comments on commit b7d804e

Please sign in to comment.