mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +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_start_end && <StartEndView></StartEndView>}
|
||||||
{layer.itemType.show_profile_button && (
|
{layer.itemType.show_profile_button && (
|
||||||
<PopupButton
|
<PopupButton
|
||||||
url={'/item'}
|
url={layer.itemType.custom_profile_url ?? '/item'}
|
||||||
parameterField={'id'}
|
parameterField={'extended.external_profile_id'}
|
||||||
text={layer.itemType.botton_label ?? 'Profile'}
|
text={layer.itemType.botton_label ?? 'Profile'}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||||
|
import { get } from 'radash'
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
import { useGetItemTags } from '#components/Map/hooks/useTags'
|
import { useGetItemTags } from '#components/Map/hooks/useTags'
|
||||||
@ -22,9 +23,10 @@ export const PopupButton = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const params = new URLSearchParams(window.location.search)
|
const params = new URLSearchParams(window.location.search)
|
||||||
const getItemTags = useGetItemTags()
|
const getItemTags = useGetItemTags()
|
||||||
|
const parameter = get(item, parameterField ?? 'id')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link to={`${url}/${parameterField ? item?.id : ''}?${params}`}>
|
<Link to={`${url}/${parameter || item?.id}?${params}`} target='_parent'>
|
||||||
<button
|
<button
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: `${item?.color ?? (item && (getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : (item?.layer?.markerDefaultColor ?? '#000')))}`,
|
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[]
|
gallery?: GalleryItem[]
|
||||||
openCollectiveSlug?: string
|
openCollectiveSlug?: string
|
||||||
secrets?: ItemSecret[]
|
secrets?: ItemSecret[]
|
||||||
|
extended?: JSON
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// coordinates: [number, number]
|
// 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
|
relations: boolean
|
||||||
template: string
|
template: string
|
||||||
questlog: boolean
|
questlog: boolean
|
||||||
|
custom_profile_url?: string
|
||||||
small_form_edit?: boolean
|
small_form_edit?: boolean
|
||||||
botton_label?: string
|
botton_label?: string
|
||||||
text_input_label?: string
|
text_input_label?: string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user