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-unnecessary-condition */
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable import/no-relative-parent-imports */ /* eslint-disable import/no-relative-parent-imports */
/* eslint-disable array-callback-return */ /* eslint-disable array-callback-return */
/* eslint-disable new-cap */ /* eslint-disable new-cap */
@ -47,7 +47,7 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) {
setApis((current) => [ setApis((current) => [
...current, ...current,
{ {
id: layer.id!, id: layer.id,
api: new itemsApi<Place>('items', layer.id, undefined, { api: new itemsApi<Place>('items', layer.id, undefined, {
_or: [ _or: [
{ {
@ -115,7 +115,11 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) {
<PopupView> <PopupView>
{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 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>} {layer.itemType.show_text && <TextView truncate></TextView>}
</PopupView> </PopupView>

View File

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

View File

@ -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]

View File

@ -16,4 +16,5 @@ export interface ItemType {
relations: boolean relations: boolean
template: string template: string
questlog: boolean questlog: boolean
custom_profile_url: string
} }