Skip to content

Commit

Permalink
Admin: Use helper to build placemark URL
Browse files Browse the repository at this point in the history
Updates 799cf01
  • Loading branch information
tordans committed Mar 10, 2025
1 parent 8e1d8f3 commit 1fd0bef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ MAILJET_APIKEY_PRIVATE='' # Only on the server
SESSION_SECRET_KEY=secret

NEXT_PUBLIC_APP_ENV=development # 'staging', 'production'
# NEXT_PUBLIC_APP_ORIGIN=http://127.0.0.1:5000 # 5000 for `npm run start` 'https://staging,trassenscout.de', 'https://trassenscout.de'
# NEXT_PUBLIC_APP_ORIGIN=http://127.0.0.1:5000 # 5000 for `npm run start` 'https://staging.trassenscout.de', 'https://trassenscout.de'

# for development: test the survey starting with another state
NEXT_PUBLIC_PUBLIC_SURVEY_START_STAGE=START
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { SuperAdminBox } from "@/src/core/components/AdminBox"
import { blueButtonStyles, Link, selectLinkStyle } from "@/src/core/components/links"
import { ButtonWrapper } from "@/src/core/components/links/ButtonWrapper"
import { getPrdOrStgDomain } from "@/src/core/components/links/getDomain"
import { useProjectSlug } from "@/src/core/routes/useProjectSlug"
import { isProduction } from "@/src/core/utils"
import getProject from "@/src/server/projects/queries/getProject"
import updateSubsectionsWithPlacemark from "@/src/server/subsections/mutations/updateSubsectionsWithPlacemark"
import getSubsections from "@/src/server/subsections/queries/getSubsections"
Expand Down Expand Up @@ -44,7 +44,11 @@ export const SubsectionPlacemarkImport = ({ project }: Props) => {
}
}

const placemarkPlayUrl = `https://play.placemark.io/?load=https://${!isProduction ? "staging." : ""}trassenscout.de/api/projects/${projectSlug}.json`
const placemarkPlayUrl = new URL("https://play.placemark.io")
placemarkPlayUrl.searchParams.append(
"load",
`${getPrdOrStgDomain()}/api/projects/${projectSlug}.json`,
)

const handleUploadChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
const files = event.target.files as FileList
Expand Down Expand Up @@ -157,7 +161,7 @@ export const SubsectionPlacemarkImport = ({ project }: Props) => {
</div>

{project.exportEnabled ? (
<Link button="blue" blank href={placemarkPlayUrl}>
<Link button="blue" blank href={placemarkPlayUrl.toString()}>
Geometrien in Placemark Play öffnen
</Link>
) : (
Expand Down

0 comments on commit 1fd0bef

Please sign in to comment.