mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 09:54:14 +00:00
fix(ci): keep the place editor below the function limit
Move the day label formatter out of the editor. Keep the image spacing and the reduced warning count verified in CI.
This commit is contained in:
@@ -36,7 +36,7 @@ import { useTranslation } from '../../../../i18n'
|
||||
import { useAuthStore } from '../../../../store/authStore'
|
||||
import { useSettingsStore } from '../../../../store/settingsStore'
|
||||
import { useSharedImportStore } from '../../../../native/sharedFiles'
|
||||
import type { Assignment, AssignmentsMap, Place } from '../../../../types'
|
||||
import type { Assignment, AssignmentsMap, Day, Place } from '../../../../types'
|
||||
import type { TripPlanner } from '../MTripShell'
|
||||
import { useLocationBias } from '../../../../hooks/useLocationBias'
|
||||
|
||||
@@ -207,10 +207,7 @@ export default function MPlaceEditSheet({ planner, onOpenExpense }: MPlaceEditSh
|
||||
const dayIndex = planner.days.findIndex(day => day.id === targetDayId)
|
||||
const day = planner.days[dayIndex]
|
||||
const dayNumber = day ? day.day_number || dayIndex + 1 : null
|
||||
const dayLabel = day ? [
|
||||
day.title || t('planner.dayN', { n: dayNumber ?? 1 }),
|
||||
day.date ? bookingDayLabel(day.date.slice(0, 10), locale) : null,
|
||||
].filter(Boolean).join(' · ') : undefined
|
||||
const dayLabel = day && placeAssignmentDayLabel(day, dayNumber ?? 1, t, locale)
|
||||
const canUseTripPlaces = !sheetPlace && !prefillCoords && day && planner.can('day_edit', planner.trip)
|
||||
const availableTripPlaces = useMemo(() => {
|
||||
if (!canUseTripPlaces) return []
|
||||
@@ -435,6 +432,13 @@ export default function MPlaceEditSheet({ planner, onOpenExpense }: MPlaceEditSh
|
||||
)
|
||||
}
|
||||
|
||||
function placeAssignmentDayLabel(day: Day, dayNumber: number, t: TripPlanner['t'], locale: string) {
|
||||
return [
|
||||
day.title || t('planner.dayN', { n: dayNumber }),
|
||||
day.date ? bookingDayLabel(day.date.slice(0, 10), locale) : null,
|
||||
].filter(Boolean).join(' · ')
|
||||
}
|
||||
|
||||
type ChangePlaceField = ReturnType<typeof usePlaceForm>['handleChange']
|
||||
|
||||
function PlaceIdentityFields({ planner, form, onChange, nameId, addressId, resolvingPick }: {
|
||||
|
||||
Reference in New Issue
Block a user