mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-12 15:25:59 +00:00
Merge branch 'main' into serverside-geocoding
This commit is contained in:
commit
e19eb10daa
45
.github/dependabot.yml
vendored
Normal file
45
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
rebase-strategy: "disabled"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "wednesday"
|
||||
time: "03:00"
|
||||
timezone: "Europe/Berlin"
|
||||
open-pull-requests-limit: 99
|
||||
groups:
|
||||
react-ecosystem:
|
||||
patterns:
|
||||
- "react"
|
||||
- "react-dom"
|
||||
- "@types/react"
|
||||
- "@types/react-dom"
|
||||
typescript-eslint:
|
||||
patterns:
|
||||
- "@typescript-eslint/parser"
|
||||
- "@typescript-eslint/eslint-plugin"
|
||||
tiptap:
|
||||
patterns:
|
||||
- "@tiptap/core"
|
||||
- "@tiptap/extension-*"
|
||||
- "@tiptap/pm"
|
||||
- "@tiptap/react"
|
||||
- "@tiptap/starter-kit"
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "javascript"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
rebase-strategy: "disabled"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "wednesday"
|
||||
time: "03:00"
|
||||
timezone: "Europe/Berlin"
|
||||
open-pull-requests-limit: 99
|
||||
labels:
|
||||
- "dependencies"
|
||||
- "github_actions"
|
||||
6
.github/workflows/deploy.docs.yml
vendored
6
.github/workflows/deploy.docs.yml
vendored
@ -11,8 +11,8 @@ jobs:
|
||||
# Specify runner + build & upload the static files as an artifact
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Install Dependencies & Build Library
|
||||
@ -42,7 +42,7 @@ jobs:
|
||||
|
||||
- name: Upload static files as artifact
|
||||
id: deployment
|
||||
uses: actions/upload-pages-artifact@v3.0.1
|
||||
uses: actions/upload-pages-artifact@v4.0.0
|
||||
with:
|
||||
path: lib/docs/
|
||||
|
||||
|
||||
11
.github/workflows/test.backend.seed.yml
vendored
11
.github/workflows/test.backend.seed.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
outputs:
|
||||
changes: ${{ steps.filter.outputs.match }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@ -27,10 +27,10 @@ jobs:
|
||||
WORKING_DIRECTORY: ./
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
|
||||
@ -39,7 +39,8 @@ jobs:
|
||||
mkdir -p ./data/uploads
|
||||
sudo chmod 777 -R ./data
|
||||
docker compose -f docker-compose.yml up -d
|
||||
sleep 5
|
||||
# Wait for Directus to be ready using health endpoint polling
|
||||
timeout 120 bash -c 'until curl -f http://localhost:8055/server/health; do echo "Waiting for Directus..."; sleep 5; done'
|
||||
cd backend && ./push.sh && ./seed.sh
|
||||
working-directory: ${{env.WORKING_DIRECTORY}}
|
||||
|
||||
@ -52,7 +53,7 @@ jobs:
|
||||
# WORKING_DIRECTORY: ./
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
# uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
#
|
||||
# - name: Build Docker Development
|
||||
# run: docker compose build
|
||||
|
||||
6
.github/workflows/test.build.docker.yml
vendored
6
.github/workflows/test.build.docker.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
outputs:
|
||||
changes: ${{ steps.filter.outputs.build-docker }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@ -27,7 +27,7 @@ jobs:
|
||||
WORKING_DIRECTORY: ./
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
|
||||
- name: Build Docker Production
|
||||
run: docker compose -f docker-compose.yml build
|
||||
@ -42,7 +42,7 @@ jobs:
|
||||
# WORKING_DIRECTORY: ./
|
||||
# steps:
|
||||
# - name: Checkout code
|
||||
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
# uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
#
|
||||
# - name: Build Docker Development
|
||||
# run: docker compose build
|
||||
|
||||
10
.github/workflows/test.build.lib.yml
vendored
10
.github/workflows/test.build.lib.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
outputs:
|
||||
build: ${{ steps.filter.outputs.build }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@ -24,8 +24,8 @@ jobs:
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Install Dependencies & Build Library
|
||||
@ -44,8 +44,8 @@ jobs:
|
||||
app: [examples/1-basic-map, examples/2-static-layers, examples/3-tags ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Link Utopia-UI in Example App
|
||||
|
||||
10
.github/workflows/test.docs.lib.yml
vendored
10
.github/workflows/test.docs.lib.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
outputs:
|
||||
docs: ${{ steps.filter.outputs.docs }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@ -25,8 +25,8 @@ jobs:
|
||||
# needs: files-changed
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
# - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
# - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
# - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
# with:
|
||||
# node-version-file: './.tool-versions'
|
||||
# - name: Frontend | Build
|
||||
@ -41,8 +41,8 @@ jobs:
|
||||
env:
|
||||
COVERAGE_REQUIRED: 0
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Docs
|
||||
|
||||
16
.github/workflows/test.e2e.yml
vendored
16
.github/workflows/test.e2e.yml
vendored
@ -12,10 +12,10 @@ jobs:
|
||||
test_failed: ${{ steps.report-results.outputs.test_failed }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@89d709d423dc495668cd762a18dd4a070611be3f # v5.0.0
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v5.0.0
|
||||
with:
|
||||
node-version-file: ./.tool-versions
|
||||
cache: 'npm'
|
||||
@ -140,7 +140,7 @@ jobs:
|
||||
|
||||
- name: Upload test artifacts on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@2848b2cda0e5190984587ec6bb1f36730ca78d50 # v4.6.2
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v4.6.2
|
||||
with:
|
||||
name: cypress-test-results-${{ github.run_id }}
|
||||
path: |
|
||||
@ -156,10 +156,10 @@ jobs:
|
||||
if: failure() && needs.cypress-e2e-tests.result == 'failure'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@89d709d423dc495668cd762a18dd4a070611be3f # v5.0.0
|
||||
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v5.0.0
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
@ -170,7 +170,7 @@ jobs:
|
||||
working-directory: ./cypress
|
||||
|
||||
- name: Download test artifacts
|
||||
uses: actions/download-artifact@4a24838f3d5601fd639834081e118c2995d51e1c # v5.0.0
|
||||
uses: actions/download-artifact@f093f21ca4cfa7c75ccbbc2be54da76a0c7e1f05 # v5.0.0
|
||||
with:
|
||||
name: cypress-test-results-${{ github.run_id }}
|
||||
path: ./cypress
|
||||
@ -191,7 +191,7 @@ jobs:
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
|
||||
- name: Upload consolidated test report
|
||||
uses: actions/upload-artifact@2848b2cda0e5190984587ec6bb1f36730ca78d50 # v4.6.2
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v4.6.2
|
||||
with:
|
||||
name: e2e-test-report-${{ github.run_id }}
|
||||
path: cypress/results/html/
|
||||
@ -200,7 +200,7 @@ jobs:
|
||||
|
||||
- name: Upload raw test data (for debugging)
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@2848b2cda0e5190984587ec6bb1f36730ca78d50 # v4.6.2
|
||||
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v4.6.2
|
||||
with:
|
||||
name: e2e-raw-data-${{ github.run_id }}
|
||||
path: |
|
||||
|
||||
6
.github/workflows/test.lint.cypress.yml
vendored
6
.github/workflows/test.lint.cypress.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
outputs:
|
||||
cypress: ${{ steps.filter.outputs.cypress }}
|
||||
steps:
|
||||
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@ -25,8 +25,8 @@ jobs:
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0
|
||||
- uses: actions/setup-node@89d709d423dc495668cd762a18dd4a070611be3f # v5.0.0
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5.0.0
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v5.0.0
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Lint
|
||||
|
||||
6
.github/workflows/test.lint.frontend.yml
vendored
6
.github/workflows/test.lint.frontend.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
outputs:
|
||||
lint: ${{ steps.filter.outputs.lint }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@ -24,8 +24,8 @@ jobs:
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Lint
|
||||
|
||||
22
.github/workflows/test.lint.lib.examples.yml
vendored
22
.github/workflows/test.lint.lib.examples.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
outputs:
|
||||
lint: ${{ steps.filter.outputs.lint }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@ -24,8 +24,8 @@ jobs:
|
||||
# needs: files-changed
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
# - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
# - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
# - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
# with:
|
||||
# node-version-file: './.tool-versions'
|
||||
# - name: Frontend | Build
|
||||
@ -38,8 +38,8 @@ jobs:
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Lint
|
||||
@ -52,8 +52,8 @@ jobs:
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Lint
|
||||
@ -66,8 +66,8 @@ jobs:
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Lint
|
||||
@ -80,8 +80,8 @@ jobs:
|
||||
# needs: files-changed
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
# - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
# - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
# - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
# with:
|
||||
# node-version-file: './.tool-versions'
|
||||
# - name: Frontend | Unit
|
||||
|
||||
6
.github/workflows/test.lint.lib.yml
vendored
6
.github/workflows/test.lint.lib.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
outputs:
|
||||
lint: ${{ steps.filter.outputs.lint }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@ -24,8 +24,8 @@ jobs:
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Lint
|
||||
|
||||
4
.github/workflows/test.lint.pr.yml
vendored
4
.github/workflows/test.lint.pr.yml
vendored
@ -32,6 +32,8 @@ jobs:
|
||||
backend
|
||||
app
|
||||
lib
|
||||
deps
|
||||
deps-dev
|
||||
docu
|
||||
docker
|
||||
release
|
||||
@ -76,4 +78,4 @@ jobs:
|
||||
# special "[WIP]" prefix to indicate this state. This will avoid the
|
||||
# validation of the PR title and the pull request checks remain pending.
|
||||
# Note that a second check will be reported if this is enabled.
|
||||
wip: true
|
||||
wip: true
|
||||
|
||||
6
.github/workflows/test.unit.lib.yml
vendored
6
.github/workflows/test.unit.lib.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
outputs:
|
||||
unit: ${{ steps.filter.outputs.unit }}
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
||||
id: filter
|
||||
with:
|
||||
@ -24,8 +24,8 @@ jobs:
|
||||
needs: files-changed
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
||||
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.0.3
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4.1.7
|
||||
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v4.0.3
|
||||
with:
|
||||
node-version-file: '.tool-versions'
|
||||
- name: Unit
|
||||
|
||||
17
README.md
17
README.md
@ -23,8 +23,23 @@ Utopia Map is made for networks and initiatives that aim to connect people in r
|
||||
|
||||
Clone the repository and get started with the following commands:
|
||||
|
||||
**Start docker**
|
||||
```bash
|
||||
npm install
|
||||
docker compose up -d
|
||||
```
|
||||
**Initialize backend**
|
||||
|
||||
```bash
|
||||
sudo chmod 777 -R ./data/
|
||||
cd backend/
|
||||
./push.sh
|
||||
./seed.sh
|
||||
```
|
||||
After this the frontend is running on http://localhost:8080 and the backend on http://localhost:8055
|
||||
|
||||
**Start dev server**
|
||||
```bash
|
||||
cd app/
|
||||
npm run dev
|
||||
```
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
VITE_OPEN_COLLECTIVE_API_KEY=your_key
|
||||
VITE_API_URL=http://localhost:8055/
|
||||
VITE_API_URL=http://localhost:8055
|
||||
#VITE_API_URL=https://api.utopia-lab.org/
|
||||
VITE_MAP_URL=http://local.development
|
||||
#VITE_MAP_URL=CURRENT_WINDOW_LOCATION
|
||||
|
||||
12331
app/package-lock.json
generated
12331
app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,10 +15,9 @@
|
||||
"dependencies": {
|
||||
"@directus/sdk": "^17.0.2",
|
||||
"@heroicons/react": "^2.1.1",
|
||||
"@tailwindcss/vite": "^4.0.15",
|
||||
"@tailwindcss/vite": "^4.1.17",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"axios": "^1.6.5",
|
||||
"date-fns": "^3.3.1",
|
||||
"axios": "^1.13.2",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-rnd": "^10.4.1",
|
||||
@ -28,32 +27,32 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
||||
"@types/node": "^22.15.28",
|
||||
"@types/node": "^24.10.1",
|
||||
"@types/react": "^18.2.79",
|
||||
"@types/react-dom": "^18.2.25",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"daisyui": "^5.0.6",
|
||||
"daisyui": "^5.5.5",
|
||||
"eslint": "^8.24.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-json": "^3.1.0",
|
||||
"eslint-plugin-n": "^16.6.2",
|
||||
"eslint-plugin-n": "^17.23.1",
|
||||
"eslint-plugin-no-catch-all": "^1.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-promise": "^7.2.1",
|
||||
"eslint-plugin-react": "^7.31.8",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.18",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.24",
|
||||
"eslint-plugin-security": "^3.0.1",
|
||||
"eslint-plugin-yml": "^1.14.0",
|
||||
"postcss": "^8.4.30",
|
||||
"tailwindcss": "^4.0.15",
|
||||
"typescript": "^5.0.2",
|
||||
"vite": "^6.2.0",
|
||||
"vite-plugin-pwa": "^0.21.1"
|
||||
"tailwindcss": "^4.1.17",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^7.2.4",
|
||||
"vite-plugin-pwa": "^1.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ function App() {
|
||||
path: '/' + l.name, // url
|
||||
icon: l.markerIcon?.image ? (
|
||||
<SVG
|
||||
src={`${config.apiUrl}assets/${l.markerIcon.image_outline ?? l.markerIcon.image}`}
|
||||
src={`${config.apiUrl}/assets/${l.markerIcon.image_outline ?? l.markerIcon.image}`}
|
||||
style={{
|
||||
width: `${(l.markerIcon.size ?? 18) * 1.3}px`,
|
||||
height: `${(l.markerIcon.size ?? 18) * 1.3}px`,
|
||||
@ -183,7 +183,7 @@ function App() {
|
||||
link.rel = 'icon'
|
||||
document.getElementsByTagName('head')[0].appendChild(link)
|
||||
}
|
||||
link.href = map?.logo && config.apiUrl + 'assets/' + map.logo // Specify the path to your favicon
|
||||
link.href = map?.logo && config.apiUrl + '/assets/' + map.logo // Specify the path to your favicon
|
||||
}
|
||||
|
||||
// Only set loading to false when both map and layers are successfully loaded
|
||||
@ -200,7 +200,7 @@ function App() {
|
||||
<div className='App tw:overflow-x-hidden'>
|
||||
<AuthProvider userApi={userApi} inviteApi={inviteApi}>
|
||||
<AppShell
|
||||
assetsApi={new assetsApi(config.apiUrl + 'assets/')}
|
||||
assetsApi={new assetsApi(config.apiUrl + '/assets/')}
|
||||
appName={map.name}
|
||||
embedded={embedded}
|
||||
openCollectiveApiKey={config.openCollectiveApiKey}
|
||||
|
||||
@ -33,7 +33,7 @@ export function Welcome1({ clickAction1, map }: ChapterProps) {
|
||||
<h3 className='tw:font-bold tw:text-lg'>Welcome to {map?.name || 'Utopia Map'}</h3>
|
||||
<img
|
||||
className='tw:float-right tw:w-32 tw:m-2'
|
||||
src={config.apiUrl + 'assets/' + map.logo}
|
||||
src={config.apiUrl + '/assets/' + map.logo}
|
||||
></img>
|
||||
<p className='tw:py-3'>
|
||||
It is a tool for collaborative mapping to connect local initiatives, people and events.
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
const normalizeBaseUrl = (value: string) => value.replace(/\/+$/, '')
|
||||
|
||||
const getMapUrl = () => {
|
||||
const url = String(import.meta.env.VITE_MAP_URL ?? 'http://local.development')
|
||||
if (url === 'CURRENT_WINDOW_LOCATION') return url
|
||||
return normalizeBaseUrl(url)
|
||||
}
|
||||
|
||||
export const config = {
|
||||
apiUrl: String(import.meta.env.VITE_API_URL ?? 'http://localhost:8055/'),
|
||||
mapUrl: String(import.meta.env.VITE_MAP_URL ?? 'http://local.development'),
|
||||
apiUrl: normalizeBaseUrl(String(import.meta.env.VITE_API_URL ?? 'http://localhost:8055/')),
|
||||
mapUrl: getMapUrl(),
|
||||
adminRole: String(import.meta.env.VITE_DIRECTUS_ADMIN_ROLE ?? ''),
|
||||
validateInviteFlowId: String(
|
||||
import.meta.env.VITE_VALIDATE_INVITE_FLOW_ID ?? '01d61db0-25aa-4bfa-bc24-c6a8f208a455',
|
||||
|
||||
@ -138,7 +138,7 @@ export const Landingpage = () => {
|
||||
<li key={idx}>
|
||||
<div className='w-24 h-24 mx-auto'>
|
||||
<img
|
||||
src={`${config.apiUrl}assets/${item.image}`}
|
||||
src={`${config.apiUrl}/assets/${item.image}`}
|
||||
className='w-full h-full rounded-full'
|
||||
alt=''
|
||||
/>
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable import/no-relative-parent-imports */
|
||||
/* eslint-disable array-callback-return */
|
||||
/* eslint-disable new-cap */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
import { useEffect, useState } from 'react'
|
||||
import {
|
||||
UtopiaMap,
|
||||
@ -36,34 +34,37 @@ function MapContainer({ layers, map }: { layers: LayerProps[]; map: any }) {
|
||||
const [apis, setApis] = useState<layerApi[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
// get timestamp for the end of the current day
|
||||
// get timestamp for the start of the current day
|
||||
const now = new Date()
|
||||
const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate())
|
||||
const etartOfDayISO = startOfDay.toISOString()
|
||||
const startOfDayISO = startOfDay.toISOString()
|
||||
|
||||
layers.map((layer: LayerProps) => {
|
||||
apis &&
|
||||
setApis((current) => [
|
||||
...current,
|
||||
{
|
||||
id: layer.id,
|
||||
api: new itemsApi<Place>('items', layer.id, undefined, {
|
||||
_or: [
|
||||
{
|
||||
end: {
|
||||
_gt: etartOfDayISO,
|
||||
},
|
||||
const newApis = layers.map((layer: LayerProps) => {
|
||||
// Only apply date filter if showPastItems is not explicitly set to true
|
||||
const dateFilter = layer.showPastItems
|
||||
? undefined
|
||||
: {
|
||||
_or: [
|
||||
{
|
||||
end: {
|
||||
_gt: startOfDayISO,
|
||||
},
|
||||
{
|
||||
end: {
|
||||
_null: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
end: {
|
||||
_null: true,
|
||||
},
|
||||
],
|
||||
}),
|
||||
},
|
||||
])
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
return {
|
||||
id: layer.id,
|
||||
api: new itemsApi<Place>('items', layer.id, undefined, dateFilter),
|
||||
}
|
||||
})
|
||||
|
||||
setApis(newApis)
|
||||
}, [layers])
|
||||
|
||||
useEffect(() => {}, [apis])
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
{
|
||||
"collection": "layers",
|
||||
"field": "showPastItems",
|
||||
"type": "boolean",
|
||||
"meta": {
|
||||
"collection": "layers",
|
||||
"conditions": null,
|
||||
"display": null,
|
||||
"display_options": null,
|
||||
"field": "showPastItems",
|
||||
"group": null,
|
||||
"hidden": false,
|
||||
"interface": "boolean",
|
||||
"note": null,
|
||||
"options": null,
|
||||
"readonly": false,
|
||||
"required": false,
|
||||
"sort": 19,
|
||||
"special": [
|
||||
"cast-boolean"
|
||||
],
|
||||
"translations": null,
|
||||
"validation": null,
|
||||
"validation_message": null,
|
||||
"width": "full"
|
||||
},
|
||||
"schema": {
|
||||
"name": "showPastItems",
|
||||
"table": "layers",
|
||||
"data_type": "boolean",
|
||||
"default_value": false,
|
||||
"max_length": null,
|
||||
"numeric_precision": null,
|
||||
"numeric_scale": null,
|
||||
"is_nullable": true,
|
||||
"is_unique": false,
|
||||
"is_indexed": false,
|
||||
"is_primary_key": false,
|
||||
"is_generated": false,
|
||||
"generation_expression": null,
|
||||
"has_auto_increment": false,
|
||||
"foreign_key_table": null,
|
||||
"foreign_key_column": null
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@
|
||||
"name": "zoom_offset",
|
||||
"table": "maps",
|
||||
"data_type": "integer",
|
||||
"default_value": -1,
|
||||
"default_value": 0,
|
||||
"max_length": null,
|
||||
"numeric_precision": 32,
|
||||
"numeric_scale": 0,
|
||||
|
||||
1449
cypress/package-lock.json
generated
1449
cypress/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -24,14 +24,14 @@
|
||||
"@eslint/js": "^9.36.0",
|
||||
"@types/mochawesome": "^6.2.4",
|
||||
"@types/node": "^24.5.2",
|
||||
"cypress": "^15.3.0",
|
||||
"cypress-split": "^1.24.23",
|
||||
"eslint": "^9.36.0",
|
||||
"eslint-plugin-cypress": "^5.1.1",
|
||||
"cypress": "^15.6.0",
|
||||
"cypress-split": "^1.24.25",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-plugin-cypress": "^5.2.0",
|
||||
"mochawesome": "^7.1.4",
|
||||
"mochawesome-merge": "^4.3.0",
|
||||
"mochawesome-report-generator": "^6.2.0",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript-eslint": "^8.44.1"
|
||||
"mochawesome-merge": "^5.0.0",
|
||||
"mochawesome-report-generator": "^6.3.2",
|
||||
"typescript": "^5.9.3",
|
||||
"typescript-eslint": "^8.47.0"
|
||||
}
|
||||
}
|
||||
|
||||
924
lib/examples/1-basic-map/package-lock.json
generated
924
lib/examples/1-basic-map/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
84
lib/examples/2-static-layers/package-lock.json
generated
84
lib/examples/2-static-layers/package-lock.json
generated
@ -28,31 +28,48 @@
|
||||
}
|
||||
},
|
||||
"../..": {
|
||||
"version": "3.0.86",
|
||||
"name": "utopia-ui",
|
||||
"version": "3.0.111",
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@heroicons/react": "^2.0.17",
|
||||
"@tanstack/react-query": "^5.17.8",
|
||||
"@maplibre/maplibre-gl-leaflet": "^0.1.3",
|
||||
"@tiptap/core": "^3.6.5",
|
||||
"@tiptap/extension-bubble-menu": "^3.6.5",
|
||||
"@tiptap/extension-color": "^3.6.5",
|
||||
"@tiptap/extension-image": "^3.6.5",
|
||||
"@tiptap/extension-link": "^3.6.5",
|
||||
"@tiptap/extension-placeholder": "^3.6.5",
|
||||
"@tiptap/extension-youtube": "^3.6.5",
|
||||
"@tiptap/pm": "^3.6.5",
|
||||
"@tiptap/react": "^3.6.5",
|
||||
"@tiptap/starter-kit": "^3.6.5",
|
||||
"axios": "^1.6.5",
|
||||
"date-fns": "^3.3.1",
|
||||
"browser-image-compression": "^2.0.2",
|
||||
"classnames": "^2.5.1",
|
||||
"leaflet": "^1.9.4",
|
||||
"leaflet.locatecontrol": "^0.79.0",
|
||||
"maplibre-gl": "^5.9.0",
|
||||
"radash": "^12.1.0",
|
||||
"react-colorful": "^5.6.1",
|
||||
"react-image-crop": "^10.1.8",
|
||||
"react-dropzone": "^14.3.8",
|
||||
"react-icons": "^5.5.0",
|
||||
"react-image-crop": "^11.0.10",
|
||||
"react-inlinesvg": "^4.2.0",
|
||||
"react-leaflet": "^4.2.1",
|
||||
"react-leaflet-cluster": "^2.1.0",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-photo-album": "^3.0.2",
|
||||
"react-router-dom": "^6.16.0",
|
||||
"react-qr-code": "^2.0.16",
|
||||
"react-toastify": "^9.1.3",
|
||||
"remark-breaks": "^4.0.0",
|
||||
"tiptap-markdown": "^0.9.0",
|
||||
"yet-another-react-lightbox": "^3.21.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
||||
"@rollup/plugin-alias": "^5.1.1",
|
||||
"@rollup/plugin-commonjs": "^28.0.3",
|
||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||
"@rollup/plugin-typescript": "^12.1.2",
|
||||
"@tailwindcss/postcss": "^4.0.14",
|
||||
@ -67,8 +84,8 @@
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"@vitest/coverage-v8": "^3.0.5",
|
||||
"cypress": "^14.0.3",
|
||||
"daisyui": "^5.0.6",
|
||||
"cypress": "^15.6.0",
|
||||
"daisyui": "^5.2.3",
|
||||
"eslint": "^8.24.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
@ -84,7 +101,7 @@
|
||||
"eslint-plugin-react-refresh": "^0.4.18",
|
||||
"eslint-plugin-security": "^3.0.1",
|
||||
"eslint-plugin-yml": "^1.14.0",
|
||||
"happy-dom": "^16.8.1",
|
||||
"happy-dom": "^20.0.0",
|
||||
"postcss": "^8.4.21",
|
||||
"prettier": "^3.3.3",
|
||||
"react": "^18.3.1",
|
||||
@ -102,9 +119,13 @@
|
||||
"vite-plugin-svgr": "^4.3.0",
|
||||
"vitest": "^3.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.20.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
"react-dom": "^18.2.0",
|
||||
"react-router-dom": "^6.23.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
@ -969,19 +990,32 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/plugin-kit": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.1.tgz",
|
||||
"integrity": "sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w==",
|
||||
"version": "0.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.5.tgz",
|
||||
"integrity": "sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@eslint/core": "^0.14.0",
|
||||
"@eslint/core": "^0.15.2",
|
||||
"levn": "^0.4.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/plugin-kit/node_modules/@eslint/core": {
|
||||
"version": "0.15.2",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.2.tgz",
|
||||
"integrity": "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/core": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
||||
@ -1662,9 +1696,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
|
||||
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
||||
"integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@ -1833,9 +1867,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
|
||||
"integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@ -2544,9 +2578,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
|
||||
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@ -3287,9 +3321,9 @@
|
||||
"link": true
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "6.3.5",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz",
|
||||
"integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==",
|
||||
"version": "6.4.1",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz",
|
||||
"integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
912
lib/examples/3-tags/package-lock.json
generated
912
lib/examples/3-tags/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,9 +19,9 @@
|
||||
"@types/react": "^18.3.18",
|
||||
"@types/react-dom": "^18.3.5",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-plugin-react-hooks": "^5.0.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.16",
|
||||
"eslint-plugin-react-refresh": "^0.4.24",
|
||||
"globals": "^15.14.0",
|
||||
"typescript": "~5.6.2",
|
||||
"typescript-eslint": "^8.18.2",
|
||||
|
||||
14658
lib/package-lock.json
generated
14658
lib/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -44,15 +44,15 @@
|
||||
"license": "GPL-3.0-only",
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
||||
"@rollup/plugin-alias": "^5.1.1",
|
||||
"@rollup/plugin-commonjs": "^28.0.3",
|
||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||
"@rollup/plugin-typescript": "^12.1.2",
|
||||
"@tailwindcss/postcss": "^4.0.14",
|
||||
"@rollup/plugin-alias": "^6.0.0",
|
||||
"@rollup/plugin-commonjs": "^29.0.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.3",
|
||||
"@rollup/plugin-typescript": "^12.3.0",
|
||||
"@tailwindcss/postcss": "^4.1.17",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.2.0",
|
||||
"@types/geojson": "^7946.0.14",
|
||||
"@types/leaflet": "^1.7.11",
|
||||
"@types/leaflet": "^1.9.21",
|
||||
"@types/leaflet.markercluster": "^1.5.5",
|
||||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
@ -60,38 +60,38 @@
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"@vitest/coverage-v8": "^3.0.5",
|
||||
"cypress": "^14.0.3",
|
||||
"daisyui": "^5.2.3",
|
||||
"cypress": "^15.7.1",
|
||||
"daisyui": "^5.5.5",
|
||||
"eslint": "^8.24.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-config-standard": "^17.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-json": "^3.1.0",
|
||||
"eslint-plugin-n": "^16.6.2",
|
||||
"eslint-plugin-n": "^17.23.1",
|
||||
"eslint-plugin-no-catch-all": "^1.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-promise": "^7.2.1",
|
||||
"eslint-plugin-react": "^7.31.8",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.18",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.24",
|
||||
"eslint-plugin-security": "^3.0.1",
|
||||
"eslint-plugin-yml": "^1.14.0",
|
||||
"happy-dom": "^20.0.0",
|
||||
"happy-dom": "^20.0.11",
|
||||
"postcss": "^8.4.21",
|
||||
"prettier": "^3.3.3",
|
||||
"prettier": "^3.7.3",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"rollup": "^4.34.6",
|
||||
"rollup": "^4.53.3",
|
||||
"rollup-plugin-dts": "^6.1.1",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"rollup-plugin-svg": "^2.0.0",
|
||||
"tailwindcss": "^4.0.14",
|
||||
"tailwindcss": "^4.1.17",
|
||||
"typedoc": "^0.27.6",
|
||||
"typedoc-plugin-coverage": "^3.4.1",
|
||||
"typedoc-plugin-missing-exports": "^3.1.0",
|
||||
"typescript": "^5.7.3",
|
||||
"vite": "^6.0.11",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^7.2.4",
|
||||
"vite-plugin-svgr": "^4.3.0",
|
||||
"vitest": "^3.0.5"
|
||||
},
|
||||
@ -103,21 +103,19 @@
|
||||
"dependencies": {
|
||||
"@heroicons/react": "^2.0.17",
|
||||
"@maplibre/maplibre-gl-leaflet": "^0.1.3",
|
||||
"@tanstack/react-query": "^5.17.8",
|
||||
"@tiptap/core": "^3.6.5",
|
||||
"@tiptap/extension-bubble-menu": "^3.6.5",
|
||||
"@tiptap/extension-color": "^3.6.5",
|
||||
"@tiptap/extension-image": "^3.6.5",
|
||||
"@tiptap/extension-link": "^3.6.5",
|
||||
"@tiptap/extension-placeholder": "^3.6.5",
|
||||
"@tiptap/extension-youtube": "^3.6.5",
|
||||
"@tiptap/core": "^3.11.0",
|
||||
"@tiptap/extension-bubble-menu": "^3.11.0",
|
||||
"@tiptap/extension-color": "^3.11.0",
|
||||
"@tiptap/extension-image": "^3.11.0",
|
||||
"@tiptap/extension-link": "^3.11.0",
|
||||
"@tiptap/extension-placeholder": "^3.11.0",
|
||||
"@tiptap/extension-youtube": "^3.11.0",
|
||||
"@tiptap/pm": "^3.6.5",
|
||||
"@tiptap/react": "^3.6.5",
|
||||
"@tiptap/starter-kit": "^3.6.5",
|
||||
"axios": "^1.6.5",
|
||||
"@tiptap/react": "^3.11.0",
|
||||
"@tiptap/starter-kit": "^3.11.0",
|
||||
"axios": "^1.13.2",
|
||||
"browser-image-compression": "^2.0.2",
|
||||
"classnames": "^2.5.1",
|
||||
"date-fns": "^3.3.1",
|
||||
"leaflet": "^1.9.4",
|
||||
"leaflet.locatecontrol": "^0.79.0",
|
||||
"maplibre-gl": "^5.9.0",
|
||||
@ -125,12 +123,12 @@
|
||||
"react-colorful": "^5.6.1",
|
||||
"react-dropzone": "^14.3.8",
|
||||
"react-icons": "^5.5.0",
|
||||
"react-image-crop": "^10.1.8",
|
||||
"react-image-crop": "^11.0.10",
|
||||
"react-inlinesvg": "^4.2.0",
|
||||
"react-leaflet": "^4.2.1",
|
||||
"react-leaflet-cluster": "^2.1.0",
|
||||
"react-leaflet-cluster": "^3.1.1",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-photo-album": "^3.0.2",
|
||||
"react-photo-album": "^3.2.1",
|
||||
"react-qr-code": "^2.0.16",
|
||||
"react-toastify": "^9.1.3",
|
||||
"remark-breaks": "^4.0.0",
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { useContext, createContext } from 'react'
|
||||
import { BrowserRouter as Router, useInRouterContext } from 'react-router-dom'
|
||||
import { ToastContainer } from 'react-toastify'
|
||||
@ -54,8 +53,6 @@ export const ContextWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
export const Wrappers = ({ children }) => {
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
return (
|
||||
<PermissionsProvider initialPermissions={[]}>
|
||||
<TagsProvider initialTags={[]}>
|
||||
@ -64,30 +61,28 @@ export const Wrappers = ({ children }) => {
|
||||
<ItemsProvider initialItems={[]}>
|
||||
<SelectPositionProvider>
|
||||
<LeafletRefsProvider initialLeafletRefs={{}}>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<AppStateProvider>
|
||||
<ClusterRefProvider>
|
||||
<PopupFormProvider>
|
||||
<QuestsProvider initialOpen={true}>
|
||||
<ToastContainer
|
||||
position='top-right'
|
||||
autoClose={2000}
|
||||
hideProgressBar
|
||||
newestOnTop={false}
|
||||
closeOnClick
|
||||
rtl={false}
|
||||
pauseOnFocusLoss
|
||||
draggable
|
||||
pauseOnHover
|
||||
theme='light'
|
||||
closeButton={CloseButton}
|
||||
/>
|
||||
{children}
|
||||
</QuestsProvider>
|
||||
</PopupFormProvider>
|
||||
</ClusterRefProvider>
|
||||
</AppStateProvider>
|
||||
</QueryClientProvider>
|
||||
<AppStateProvider>
|
||||
<ClusterRefProvider>
|
||||
<PopupFormProvider>
|
||||
<QuestsProvider initialOpen={true}>
|
||||
<ToastContainer
|
||||
position='top-right'
|
||||
autoClose={2000}
|
||||
hideProgressBar
|
||||
newestOnTop={false}
|
||||
closeOnClick
|
||||
rtl={false}
|
||||
pauseOnFocusLoss
|
||||
draggable
|
||||
pauseOnHover
|
||||
theme='light'
|
||||
closeButton={CloseButton}
|
||||
/>
|
||||
{children}
|
||||
</QuestsProvider>
|
||||
</PopupFormProvider>
|
||||
</ClusterRefProvider>
|
||||
</AppStateProvider>
|
||||
</LeafletRefsProvider>
|
||||
</SelectPositionProvider>
|
||||
</ItemsProvider>
|
||||
|
||||
@ -44,7 +44,7 @@ export function RichTextEditor({
|
||||
|
||||
const regex = /!\[.*?\]\(.*?\)/g
|
||||
newValue = newValue.replace(regex, (match: string) => match + '\n\n')
|
||||
if (updateFormValue && newValue) {
|
||||
if (updateFormValue) {
|
||||
updateFormValue(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { LatLng } from 'leaflet'
|
||||
import { forwardRef, useState } from 'react'
|
||||
@ -17,6 +16,7 @@ import { useRemoveItem, useUpdateItem } from '#components/Map/hooks/useItems'
|
||||
import { usePopupForm } from '#components/Map/hooks/usePopupForm'
|
||||
import { useSetSelectPosition } from '#components/Map/hooks/useSelectPosition'
|
||||
import { timeAgo } from '#utils/TimeAgo'
|
||||
import { removeItemFromUrl } from '#utils/UrlHelper'
|
||||
|
||||
import { HeaderView } from './ItemPopupComponents/HeaderView'
|
||||
import { TextView } from './ItemPopupComponents/TextView'
|
||||
@ -80,8 +80,7 @@ export const ItemViewPopup = forwardRef((props: ItemViewPopupProps, ref: any) =>
|
||||
}
|
||||
setLoading(false)
|
||||
map.closePopup()
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
window.history.pushState({}, '', '/' + `${params ? `?${params}` : ''}`)
|
||||
removeItemFromUrl()
|
||||
navigate('/')
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
@ -15,6 +14,12 @@ import { toast } from 'react-toastify'
|
||||
import { useSetAppState } from '#components/AppShell/hooks/useAppState'
|
||||
import { useTheme } from '#components/AppShell/hooks/useTheme'
|
||||
import { containsUUID } from '#utils/ContainsUUID'
|
||||
import {
|
||||
removeItemFromUrl,
|
||||
resetMetaTags as resetMetaTagsUtil,
|
||||
setItemInUrl,
|
||||
updateMetaTags,
|
||||
} from '#utils/UrlHelper'
|
||||
|
||||
import { useClusterRef, useSetClusterRef } from './hooks/useClusterRef'
|
||||
import {
|
||||
@ -152,21 +157,45 @@ export function UtopiaMapInner({
|
||||
return null
|
||||
}
|
||||
|
||||
// Track if we're currently switching popups to prevent URL cleanup
|
||||
const popupCloseTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
||||
|
||||
useMapEvents({
|
||||
popupopen: (e) => {
|
||||
const item = Object.entries(leafletRefs).find((r) => r[1].popup === e.popup)?.[1].item
|
||||
if (window.location.pathname.split('/')[1] !== item?.id) {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
if (!location.pathname.includes('/item/')) {
|
||||
window.history.pushState(
|
||||
{},
|
||||
'',
|
||||
`/${item?.id}` + `${params.toString() !== '' ? `?${params}` : ''}`,
|
||||
)
|
||||
|
||||
// Cancel any pending popup close URL cleanup - we're opening a new popup
|
||||
if (popupCloseTimeoutRef.current) {
|
||||
clearTimeout(popupCloseTimeoutRef.current)
|
||||
popupCloseTimeoutRef.current = null
|
||||
}
|
||||
|
||||
// Only update URL if no profile is open
|
||||
if (!location.pathname.includes('/item/')) {
|
||||
if (window.location.pathname.split('/')[1] !== item?.id && item?.id) {
|
||||
setItemInUrl(item.id)
|
||||
}
|
||||
let title = ''
|
||||
if (item?.name) title = item.name
|
||||
document.title = `${document.title.split('-')[0]} - ${title}`
|
||||
if (item?.name) {
|
||||
updateMetaTags(item.name, item.text)
|
||||
}
|
||||
}
|
||||
// If profile is open, don't change URL but still update meta tags
|
||||
else if (item?.name) {
|
||||
updateMetaTags(item.name, item.text)
|
||||
}
|
||||
},
|
||||
popupclose: () => {
|
||||
// Only remove UUID from URL if no profile is open
|
||||
if (!location.pathname.includes('/item/')) {
|
||||
// Wait briefly to see if another popup is being opened
|
||||
// If so, the popupopen handler will cancel this timeout
|
||||
popupCloseTimeoutRef.current = setTimeout(() => {
|
||||
if (containsUUID(window.location.pathname)) {
|
||||
removeItemFromUrl()
|
||||
resetMetaTagsUtil()
|
||||
}
|
||||
popupCloseTimeoutRef.current = null
|
||||
}, 50)
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -185,15 +214,9 @@ export function UtopiaMapInner({
|
||||
clusterRef?.zoomToShowLayer(ref.marker, () => {
|
||||
ref.marker.openPopup()
|
||||
})
|
||||
let title = ''
|
||||
if (ref.item.name) title = ref.item.name
|
||||
document.title = `${document.title.split('-')[0]} - ${title}`
|
||||
document
|
||||
.querySelector('meta[property="og:title"]')
|
||||
?.setAttribute('content', ref.item.name ?? '')
|
||||
document
|
||||
.querySelector('meta[property="og:description"]')
|
||||
?.setAttribute('content', ref.item.text ?? '')
|
||||
if (ref.item.name) {
|
||||
updateMetaTags(ref.item.name, ref.item.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,18 +228,10 @@ export function UtopiaMapInner({
|
||||
}, [leafletRefs, location])
|
||||
|
||||
const resetMetaTags = () => {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
if (!containsUUID(window.location.pathname)) {
|
||||
window.history.pushState({}, '', '/' + `${params.toString() !== '' ? `?${params}` : ''}`)
|
||||
if (containsUUID(window.location.pathname)) {
|
||||
removeItemFromUrl()
|
||||
}
|
||||
document.title = document.title.split('-')[0]
|
||||
document.querySelector('meta[property="og:title"]')?.setAttribute('content', document.title)
|
||||
document
|
||||
.querySelector('meta[property="og:description"]')
|
||||
?.setAttribute(
|
||||
'content',
|
||||
`${document.querySelector('meta[name="description"]')?.getAttribute('content')}`,
|
||||
)
|
||||
resetMetaTagsUtil()
|
||||
}
|
||||
|
||||
const onEachFeature = (feature: Feature<GeoJSONGeometry, any>, layer: L.Layer) => {
|
||||
|
||||
@ -17,6 +17,7 @@ import { ActionButton } from '#components/Profile/Subcomponents/ActionsButton'
|
||||
import { LinkedItemsHeaderView } from '#components/Profile/Subcomponents/LinkedItemsHeaderView'
|
||||
import { TagView } from '#components/Templates/TagView'
|
||||
import { timeAgo } from '#utils/TimeAgo'
|
||||
import { setUrlParam } from '#utils/UrlHelper'
|
||||
|
||||
import type { Item } from '#types/Item'
|
||||
import type { Tag } from '#types/Tag'
|
||||
@ -67,11 +68,7 @@ export const TabsView = ({
|
||||
const updateActiveTab = useCallback(
|
||||
(id: number) => {
|
||||
setActiveTab(id)
|
||||
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
params.set('tab', `${id}`)
|
||||
const newUrl = location.pathname + '?' + params.toString()
|
||||
window.history.pushState({}, '', newUrl)
|
||||
setUrlParam('tab', `${id}`)
|
||||
},
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[location.pathname],
|
||||
|
||||
@ -14,6 +14,7 @@ import { toast } from 'react-toastify'
|
||||
import { encodeTag } from '#utils/FormatTags'
|
||||
import { hashTagRegex } from '#utils/HashTagRegex'
|
||||
import { randomColor } from '#utils/RandomColor'
|
||||
import { removeItemFromUrl } from '#utils/UrlHelper'
|
||||
|
||||
import type { FormState } from '#types/FormState'
|
||||
import type { Item } from '#types/Item'
|
||||
@ -185,8 +186,7 @@ export const handleDelete = async (
|
||||
toast.success('Item deleted')
|
||||
|
||||
map.closePopup()
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
window.history.pushState({}, '', '/' + `${params ? `?${params}` : ''}`)
|
||||
removeItemFromUrl()
|
||||
navigate('/')
|
||||
} catch (error) {
|
||||
toast.error(error instanceof Error ? error.message : String(error))
|
||||
@ -273,7 +273,7 @@ export const onUpdateItem = async (
|
||||
setLoading(true)
|
||||
|
||||
state.text
|
||||
.toLocaleLowerCase()
|
||||
?.toLocaleLowerCase()
|
||||
.match(hashTagRegex)
|
||||
?.map((tag) => {
|
||||
if (!tags.find((t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase())) {
|
||||
|
||||
74
lib/src/Utils/UrlHelper.ts
Normal file
74
lib/src/Utils/UrlHelper.ts
Normal file
@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Utility functions for managing browser URL and history
|
||||
*/
|
||||
|
||||
/**
|
||||
* Updates the browser URL with an item ID while preserving query parameters
|
||||
* @param itemId - The item UUID to add to the URL
|
||||
*/
|
||||
export function setItemInUrl(itemId: string): void {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
const paramsString = params.toString()
|
||||
const newUrl = `/${itemId}${paramsString !== '' ? `?${paramsString}` : ''}`
|
||||
window.history.pushState({}, '', newUrl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the item ID from the browser URL while preserving query parameters
|
||||
*/
|
||||
export function removeItemFromUrl(): void {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
const paramsString = params.toString()
|
||||
const newUrl = `/${paramsString !== '' ? `?${paramsString}` : ''}`
|
||||
window.history.pushState({}, '', newUrl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a specific query parameter in the URL while preserving the path
|
||||
* @param key - The parameter key
|
||||
* @param value - The parameter value
|
||||
*/
|
||||
export function setUrlParam(key: string, value: string): void {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
params.set(key, value)
|
||||
const newUrl = window.location.pathname + '?' + params.toString()
|
||||
window.history.pushState({}, '', newUrl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a specific query parameter from the URL
|
||||
* @param key - The parameter key to remove
|
||||
*/
|
||||
export function removeUrlParam(key: string): void {
|
||||
const params = new URLSearchParams(window.location.search)
|
||||
params.delete(key)
|
||||
const paramsString = params.toString()
|
||||
const newUrl = window.location.pathname + (paramsString !== '' ? `?${paramsString}` : '')
|
||||
window.history.pushState({}, '', newUrl)
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets page title and OpenGraph meta tags to default values
|
||||
*/
|
||||
export function resetMetaTags(): void {
|
||||
document.title = document.title.split('-')[0].trim()
|
||||
document.querySelector('meta[property="og:title"]')?.setAttribute('content', document.title)
|
||||
const description = document.querySelector('meta[name="description"]')?.getAttribute('content')
|
||||
if (description) {
|
||||
document.querySelector('meta[property="og:description"]')?.setAttribute('content', description)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates page title and OpenGraph meta tags with item information
|
||||
* @param itemName - The name of the item
|
||||
* @param itemText - The text/description of the item
|
||||
*/
|
||||
export function updateMetaTags(itemName: string, itemText?: string): void {
|
||||
const baseTitle = document.title.split('-')[0].trim()
|
||||
document.title = `${baseTitle} - ${itemName}`
|
||||
document.querySelector('meta[property="og:title"]')?.setAttribute('content', itemName)
|
||||
if (itemText) {
|
||||
document.querySelector('meta[property="og:description"]')?.setAttribute('content', itemText)
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,8 @@ import 'react-image-crop/dist/ReactCrop.css'
|
||||
import 'react-photo-album/rows.css'
|
||||
import 'react-toastify/dist/ReactToastify.css'
|
||||
import 'yet-another-react-lightbox/styles.css'
|
||||
import 'react-leaflet-cluster/dist/assets/MarkerCluster.css'
|
||||
import 'react-leaflet-cluster/dist/assets/MarkerCluster.Default.css'
|
||||
|
||||
import '#assets/css/tailwind.css'
|
||||
import '#assets/css/masonry.css'
|
||||
|
||||
1
lib/src/types/LayerProps.d.ts
vendored
1
lib/src/types/LayerProps.d.ts
vendored
@ -26,4 +26,5 @@ export interface LayerProps {
|
||||
listed?: boolean
|
||||
item_presets?: Record<string, unknown>
|
||||
item_default_name?: string
|
||||
showPastItems?: boolean
|
||||
}
|
||||
|
||||
1720
package-lock.json
generated
1720
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user