running dev environment

This commit is contained in:
Anton Tranelis 2025-06-27 09:31:39 +02:00
parent ab4cfc626e
commit 9b1ba34932
7 changed files with 41 additions and 17 deletions

View File

@ -13,8 +13,12 @@
"noFallthroughCasesInSwitch": true,
"paths": {
"utopia-ui": ["../lib/src"],
"utopia-ui/types": ["../lib/src/types"],
"utopia-ui/types/*": ["../lib/src/types/*"]
"#components/*": ["../lib/src/Components/*"],
"#utils/*": ["../lib/src/Utils/*"],
"#types/*": ["../lib/src/types/*"],
"#assets/*": ["../lib/src/assets/*"],
"#src/*": ["../lib/src/*"],
"#root/*": ["../lib/*"]
}
},
"include": ["src"],

View File

@ -25,7 +25,12 @@ export default defineConfig({
resolve: {
alias: {
'utopia-ui': path.resolve(__dirname, '../lib/src'),
'#components': path.resolve(__dirname, '../lib/src/Components'),
'#utils': path.resolve(__dirname, '../lib/src/Utils'),
'#types': path.resolve(__dirname, '../lib/src/types'),
'#assets': path.resolve(__dirname, '../lib/src/assets'),
'#src': path.resolve(__dirname, '../lib/src'),
'#root': path.resolve(__dirname, '../lib'),
}
}
});

View File

@ -3,3 +3,5 @@ export { LoginPage } from './LoginPage'
export { SignupPage } from './SignupPage'
export { RequestPasswordPage } from './RequestPasswordPage'
export { SetNewPasswordPage } from './SetNewPasswordPage'
export type { UserItem } from '#types/UserItem'
export type { UserApi } from '#types/UserApi'

View File

@ -76,7 +76,9 @@ export const GalleryForm = ({ state, setState }: Props) => {
const images = state.gallery
.map((image) => ({
src: appState.assetsApi.url + `${image.directus_files_id.id}.jpg`,
src:
typeof image.directus_files_id !== 'string' &&
appState.assetsApi.url + `${image.directus_files_id.id}.jpg`,
state: 'uploaded',
}))
.concat(

View File

@ -23,12 +23,21 @@ export const GalleryView = ({ item }: { item: Item }) => {
const [index, setIndex] = useState(-1)
const appState = useAppState()
const images =
item.gallery?.map(({ directus_files_id: { id, type, width, height } }, index) => ({
src: `${appState.assetsApi.url}${id}${getExtension(type)}`,
width,
height,
index,
})) ?? []
item.gallery?.flatMap((g, index) => {
const file = g.directus_files_id
// if it's just a string, skip it
if (typeof file === 'string') return []
// otherwise it's the object you want
const { id, type, width, height } = file
return [
{
src: `${appState.assetsApi.url}${id}${getExtension(type)}`,
width,
height,
index,
},
]
}) ?? []
if (images.length > 0)
return (

View File

@ -200,7 +200,7 @@ export const onUpdateItem = async (
...(state.needs.length > 0 && { needs: needsUpdates }),
...(state.openCollectiveSlug && { openCollectiveSlug: state.openCollectiveSlug }),
gallery: state.gallery.map((i) => ({
directus_files_id: i.directus_files_id.id,
directus_files_id: typeof i.directus_files_id !== 'string' && i.directus_files_id.id,
})),
}

View File

@ -8,12 +8,14 @@ import type { Point } from 'geojson'
type TagIds = { tags_id: string }[]
interface GalleryItem {
directus_files_id: {
id: string
width: number
height: number
type: string
}
directus_files_id:
| {
id: string
width: number
height: number
type: string
}
| string
}
/**