From b7d804eb4bba18297ad0d5a8f2549aea874d53c8 Mon Sep 17 00:00:00 2001 From: Braian Mellor Date: Tue, 28 Jan 2025 17:24:54 -0300 Subject: [PATCH] fix: show place when not logged in (#583) feat: change places url for slack message --- src/config/dev.json | 1 + src/config/local.json | 1 + src/config/prod.json | 1 + src/entities/Place/utils.test.ts | 4 ++-- src/entities/Place/utils.ts | 12 +++++++++--- src/hooks/usePlaceFromParams.ts | 2 +- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/config/dev.json b/src/config/dev.json index aac6d404..d724ff19 100644 --- a/src/config/dev.json +++ b/src/config/dev.json @@ -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", diff --git a/src/config/local.json b/src/config/local.json index 309675e5..2aaf7b5a 100644 --- a/src/config/local.json +++ b/src/config/local.json @@ -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", diff --git a/src/config/prod.json b/src/config/prod.json index c9ea486a..4282d182 100644 --- a/src/config/prod.json +++ b/src/config/prod.json @@ -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", diff --git a/src/entities/Place/utils.test.ts b/src/entities/Place/utils.test.ts index 77f359f1..eca6d249 100644 --- a/src/entities/Place/utils.test.ts +++ b/src/entities/Place/utils.test.ts @@ -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/") }) }) diff --git a/src/entities/Place/utils.ts b/src/entities/Place/utils.ts index c25f40f6..0bd7559b 100644 --- a/src/entities/Place/utils.ts +++ b/src/entities/Place/utils.ts @@ -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 } diff --git a/src/hooks/usePlaceFromParams.ts b/src/hooks/usePlaceFromParams.ts index c4bd9ec2..5ec4fa61 100644 --- a/src/hooks/usePlaceFromParams.ts +++ b/src/hooks/usePlaceFromParams.ts @@ -36,6 +36,6 @@ export function usePlaceFromParams( return null }, [params, ...deps], - { callWithTruthyDeps: true, initialValue: null } + { initialValue: null } ) }