merged main

This commit is contained in:
Anton Tranelis 2025-07-03 14:51:57 +02:00
commit d6c71a9f9b
48 changed files with 56 additions and 26 deletions

View File

@ -37,7 +37,7 @@ jobs:
build-examples:
if: needs.files-changed.outputs.build == 'true'
name: Test Example Apps
needs: build
needs: [build, files-changed]
runs-on: ubuntu-latest
strategy:
matrix:

View File

@ -1,10 +1,10 @@
name: test:lint:frontend
name: test:lint:app
on: push
jobs:
files-changed:
name: Detect File Changes - lint - frontend
name: Detect File Changes - lint - app
runs-on: ubuntu-latest
outputs:
lint: ${{ steps.filter.outputs.lint }}
@ -16,11 +16,11 @@ jobs:
filters: |
lint:
- '.github/workflows/**/*'
- 'frontend/**/*'
- 'app/**/*'
lint:
if: needs.files-changed.outputs.lint == 'true'
name: Lint - frontend
name: Lint - app
needs: files-changed
runs-on: ubuntu-latest
steps:
@ -30,4 +30,4 @@ jobs:
node-version-file: '.tool-versions'
- name: Lint
run: npm install && npm run test:lint:eslint
working-directory: frontend/
working-directory: app/

View File

@ -30,7 +30,7 @@ jobs:
# Append a scope for each service here
scopes: |
backend
frontend
app
lib
docu
docker

View File

@ -38,7 +38,7 @@ services:
backend:
container_name: backend
build:
context: ./backend
context: ../backend
depends_on:
database:
condition: service_healthy

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 682 KiB

After

Width:  |  Height:  |  Size: 682 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 487 B

After

Width:  |  Height:  |  Size: 487 B

View File

@ -6,6 +6,7 @@ import { createDirectus, rest, authentication } from '@directus/sdk'
import type { AuthenticationData, AuthenticationStorage } from '@directus/sdk'
import type { Point } from 'geojson'
import type { Item } from 'utopia-ui'
export interface Place {
id: string
@ -57,6 +58,10 @@ export interface MyCollections {
tags: Tag[]
projects: Project[]
directus_users: CustomUserFields[]
items: Item[]
team: any[]
features: any[]
attestations: any[]
}
export const authLocalStorage = (mainKey = 'directus_storage') =>

View File

@ -12,14 +12,14 @@ import type { MyCollections } from './directus'
import type { ItemsApi } from 'utopia-ui'
export class itemsApi<T> implements ItemsApi<T> {
collectionName: string
collectionName: keyof MyCollections
filter: any
layerId: string | undefined
mapId: string | undefined
customParameter: any
constructor(
collectionName: string,
collectionName: keyof MyCollections,
layerId?: string | undefined,
mapId?: string | undefined,
filter?: any,
@ -81,7 +81,7 @@ export class itemsApi<T> implements ItemsApi<T> {
async createItem(item: T & { id?: string }): Promise<T> {
try {
const result = await directusClient.request(
createItem(this.collectionName as keyof MyCollections, {
createItem(this.collectionName, {
...item,
...(this.customParameter && this.customParameter),
...(this.layerId && { layer: this.layerId }),
@ -99,9 +99,7 @@ export class itemsApi<T> implements ItemsApi<T> {
async updateItem(item: T & { id?: string }): Promise<T> {
try {
const result = await directusClient.request(
updateItem(this.collectionName as keyof MyCollections, item.id!, item),
)
const result = await directusClient.request(updateItem(this.collectionName, item.id!, item))
return result as T
} catch (error: any) {
console.log(error)
@ -112,9 +110,7 @@ export class itemsApi<T> implements ItemsApi<T> {
async deleteItem(id: string): Promise<boolean> {
try {
const result = await directusClient.request(
deleteItem(this.collectionName as keyof MyCollections, id),
)
const result = await directusClient.request(deleteItem(this.collectionName, id))
return result as unknown as boolean
} catch (error: any) {
console.log(error)

View File

Before

Width:  |  Height:  |  Size: 535 KiB

After

Width:  |  Height:  |  Size: 535 KiB

View File

@ -1,4 +1,4 @@
In order to pull data from your locally running backend (see [docker-compose](../docker-compose.yml)) to your local harddrive, you can run the following command
In order to pull data from your locally running backend (see [docker-compose](../app/docker-compose.yml)) to your local harddrive, you can run the following command
```
npx directus-sync pull \

View File

@ -20,7 +20,7 @@ export const SelectPosition = ({
</label>
<div className='tw:alert tw:bg-base-100 tw:text-base-content'>
<div>
{selectNewItemPosition && 'text' in selectNewItemPosition && (
{selectNewItemPosition && 'layer' in selectNewItemPosition && (
<span className='tw:text-lg'>
Select new position of <b>{selectNewItemPosition.name}</b> on the map!
</span>

View File

@ -69,7 +69,7 @@ function useSelectPositionManager(): {
})
setSelectPosition(null)
}
if ('text' in selectPosition) {
if ('layer' in selectPosition) {
// if selectPosition is an Item
const position =
mapClicked?.position.lng &&
@ -101,9 +101,9 @@ function useSelectPositionManager(): {
success = true
} catch (error: unknown) {
if (error instanceof Error) {
toast.update(toastId, { render: error.message, type: 'error' })
toast.update(toastId, { render: error.message, type: 'error', autoClose: 5000 })
} else if (typeof error === 'string') {
toast.update(toastId, { render: error, type: 'error' })
toast.update(toastId, { render: error, type: 'error', autoClose: 5000 })
} else {
throw error
}
@ -115,6 +115,7 @@ function useSelectPositionManager(): {
render: 'Item position updated',
type: 'success',
isLoading: false,
autoClose: 5000,
})
setSelectPosition(null)
setMarkerClicked(null)
@ -125,6 +126,8 @@ function useSelectPositionManager(): {
render: "you don't have permission to add items to " + markerClicked?.name,
type: 'error',
isLoading: false,
autoClose: 5000,
closeButton: true,
})
}
}
@ -145,9 +148,16 @@ function useSelectPositionManager(): {
type: 'error',
isLoading: false,
autoClose: 5000,
closeButton: true,
})
} else if (typeof error === 'string') {
toast.update(toastId, { render: error, type: 'error', isLoading: false, autoClose: 5000 })
toast.update(toastId, {
render: error,
type: 'error',
isLoading: false,
autoClose: 5000,
closeButton: true,
})
} else {
throw error
}
@ -159,6 +169,7 @@ function useSelectPositionManager(): {
type: 'success',
isLoading: false,
autoClose: 5000,
closeButton: true,
})
}
}
@ -178,16 +189,34 @@ function useSelectPositionManager(): {
success = true
} catch (error: unknown) {
if (error instanceof Error) {
toast.update(toastId, { render: error.message, type: 'error', isLoading: false })
toast.update(toastId, {
render: error.message,
type: 'error',
isLoading: false,
autoClose: 5000,
closeButton: true,
})
} else if (typeof error === 'string') {
toast.update(toastId, { render: error, type: 'error', isLoading: false })
toast.update(toastId, {
render: error,
type: 'error',
isLoading: false,
autoClose: 5000,
closeButton: true,
})
} else {
throw error
}
}
if (success) {
updateItem({ ...markerClicked, relations: newRelations })
toast.update(toastId, { render: 'Item linked', type: 'success', isLoading: false })
toast.update(toastId, {
render: 'Item linked',
type: 'success',
isLoading: false,
autoClose: 5000,
closeButton: true,
})
}
}
}