mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 07:53:09 +00:00
refactor(files): keep each view's id rules in the shared link toggle
The shared toggle had mixed the two views. Desktop again treats any empty column as free and finds a link record by comparing ids as they come. The phone link sheet again treats only a null column as free and compares the numeric value of a record id. Starring stays per view. It is a single filesApi call with different error handling and refresh on each side, so a shared wrapper would add a layer without removing any logic.
This commit is contained in:
@@ -2,7 +2,7 @@ import { useRef, useState } from 'react'
|
||||
import { Check, Link2, Loader2, MapPin, Ticket, TrainFront } from 'lucide-react'
|
||||
import type { LucideIcon } from 'lucide-react'
|
||||
import MSheet from '../../../components/MSheet'
|
||||
import { toggleFileLink, type FileLinkField } from '../../../../components/Files/fileActions'
|
||||
import { PHONE_FILE_LINK_RULES, toggleFileLink, type FileLinkField } from '../../../../components/Files/fileActions'
|
||||
import type { TripFile } from '../../../../types'
|
||||
import type { TripPlanner } from '../MTripShell'
|
||||
import { Eyebrow, TileHeader } from '../sheets/MTripSheetUi'
|
||||
@@ -48,7 +48,7 @@ export default function MFileLinkSheet({ planner, file, onClose }: MFileLinkShee
|
||||
const key = `${field === 'place_id' ? 'p' : 'r'}${targetId}`
|
||||
setBusyKey(key)
|
||||
try {
|
||||
await toggleFileLink(tripId, shown, field, targetId)
|
||||
await toggleFileLink(tripId, shown, field, targetId, PHONE_FILE_LINK_RULES)
|
||||
refresh()
|
||||
} catch {
|
||||
toast.error(t('files.toast.assignError'))
|
||||
|
||||
Reference in New Issue
Block a user