mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-12 23:36:00 +00:00
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:
parent
cb6737d370
commit
7e059d8deb
@ -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'}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -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')))}`,
|
||||
|
||||
1
lib/src/types/Item.d.ts
vendored
1
lib/src/types/Item.d.ts
vendored
@ -61,6 +61,7 @@ export interface Item {
|
||||
gallery?: GalleryItem[]
|
||||
openCollectiveSlug?: string
|
||||
secrets?: ItemSecret[]
|
||||
extended?: JSON
|
||||
|
||||
// {
|
||||
// coordinates: [number, number]
|
||||
|
||||
1
lib/src/types/ItemType.d.ts
vendored
1
lib/src/types/ItemType.d.ts
vendored
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user