feat(app): added external profile url (#328)

* added external profile url

* switch port back to 5174

* fix linting

* chaneged target to _parent
This commit is contained in:
Anton Tranelis 2025-08-26 14:56:55 +02:00 committed by GitHub
parent cb6737d370
commit 7e059d8deb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 3 deletions

View File

@ -116,8 +116,8 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) {
{layer.itemType.show_start_end && <StartEndView></StartEndView>}
{layer.itemType.show_profile_button && (
<PopupButton
url={'/item'}
parameterField={'id'}
url={layer.itemType.custom_profile_url ?? '/item'}
parameterField={'extended.external_profile_id'}
text={layer.itemType.botton_label ?? 'Profile'}
/>
)}

View File

@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
import { get } from 'radash'
import { Link } from 'react-router-dom'
import { useGetItemTags } from '#components/Map/hooks/useTags'
@ -22,9 +23,10 @@ export const PopupButton = ({
}) => {
const params = new URLSearchParams(window.location.search)
const getItemTags = useGetItemTags()
const parameter = get(item, parameterField ?? 'id')
return (
<Link to={`${url}/${parameterField ? item?.id : ''}?${params}`}>
<Link to={`${url}/${parameter || item?.id}?${params}`} target='_parent'>
<button
style={{
backgroundColor: `${item?.color ?? (item && (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (item?.layer?.markerDefaultColor ?? '#000')))}`,

View File

@ -61,6 +61,7 @@ export interface Item {
gallery?: GalleryItem[]
openCollectiveSlug?: string
secrets?: ItemSecret[]
extended?: JSON
// {
// coordinates: [number, number]

View File

@ -16,6 +16,7 @@ export interface ItemType {
relations: boolean
template: string
questlog: boolean
custom_profile_url?: string
small_form_edit?: boolean
botton_label?: string
text_input_label?: string