added external profile url

This commit is contained in:
Anton Tranelis 2025-08-23 22:39:09 +02:00
parent 2baabe7940
commit db3535b698
5 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable import/no-relative-parent-imports */
/* eslint-disable array-callback-return */
/* eslint-disable new-cap */
@ -47,7 +47,7 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) {
setApis((current) => [
...current,
{
id: layer.id!,
id: layer.id,
api: new itemsApi<Place>('items', layer.id, undefined, {
_or: [
{
@ -115,7 +115,11 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) {
<PopupView>
{layer.itemType.show_start_end && <StartEndView></StartEndView>}
{layer.itemType.show_profile_button && (
<PopupButton url={'/item'} parameterField={'id'} text={'Profile'} />
<PopupButton
url={layer.itemType.custom_profile_url ?? '/item'}
parameterField={'extended.external_profile_id'}
text={'Profile'}
/>
)}
{layer.itemType.show_text && <TextView truncate></TextView>}
</PopupView>

View File

@ -11,7 +11,7 @@ const __dirname = path.dirname(new URL(import.meta.url).pathname)
export default defineConfig({
server: {
host: true,
port: 5174,
port: 5175,
/**
* https: {
* key: fs.readFileSync(path.resolve(__dirname, 'localhost-key.pem')),

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}`}>
<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,4 +16,5 @@ export interface ItemType {
relations: boolean
template: string
questlog: boolean
custom_profile_url: string
}