mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 00:43:15 +00:00
fix(journey): refine dialog and gallery controls
This commit is contained in:
@@ -37,7 +37,6 @@ export default function DawarichDayDialog({
|
||||
onClose={onClose}
|
||||
labelledBy={labelId}
|
||||
width="detail"
|
||||
align="top"
|
||||
header={
|
||||
<DialogHeader
|
||||
tile={
|
||||
|
||||
@@ -154,7 +154,7 @@ export default function JourneyDayRecordingButton({
|
||||
className={ROUND}
|
||||
style={{ background: 'var(--vg-surf2)' }}
|
||||
>
|
||||
<DawarichIcon size={15} />
|
||||
<DawarichIcon className="size-3.5 rounded-full" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
<ContextMenu menu={menu.menu} onClose={menu.close} />
|
||||
|
||||
@@ -234,7 +234,7 @@ export function EntryEditor({ entry, journeyId, tripDates, galleryPhotos, trips,
|
||||
<>
|
||||
{/* Pinned at the top: the photo panels, the verdict rows and the photo
|
||||
strip all change the body's height while an entry is being written. */}
|
||||
<DialogShell onClose={handleClose} labelledBy={labelId} width="wide" align="top" blocked={confirmDiscard} header={header} footer={footer}>
|
||||
<DialogShell onClose={handleClose} labelledBy={labelId} width="wide" blocked={confirmDiscard} header={header} footer={footer}>
|
||||
<div className="grid grid-cols-1 items-stretch gap-x-6 gap-y-5 md:grid-cols-2">
|
||||
<div className="flex min-w-0 flex-col gap-5">
|
||||
<div>
|
||||
|
||||
@@ -69,11 +69,6 @@ export function GalleryView({ entries, gallery, journeyId, userId, trips, canEdi
|
||||
// Deleting is final on the server and takes the photo out of every entry that
|
||||
// uses it too, so the tile only asks; the dialog does the deleting (#2593).
|
||||
const [deleteTarget, setDeleteTarget] = useState<GalleryPhoto | null>(null)
|
||||
const [showFromPhotos, setShowFromPhotos] = useState(false)
|
||||
const coverOf = (galleryPhotoId: number) => {
|
||||
const photo = allPhotos.find(p => p.id === galleryPhotoId)
|
||||
return photo && !posterlessVideo(photo) ? photoUrl(photo, 'thumbnail') : null
|
||||
}
|
||||
|
||||
const handleDeletePhoto = async (galleryPhotoId: number) => {
|
||||
const store = useJourneyStore.getState()
|
||||
@@ -90,31 +85,11 @@ export function GalleryView({ entries, gallery, journeyId, userId, trips, canEdi
|
||||
<div>
|
||||
<input ref={galleryFileRef} type="file" accept="image/*,video/*" multiple onChange={handleGalleryUpload} className="hidden" />
|
||||
|
||||
{/* Header — the provider buttons live in the page header next to Upload */}
|
||||
<div className="flex items-center justify-between mb-4 flex-wrap gap-2">
|
||||
<div className="mb-4">
|
||||
<span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-[0.07em]" style={{ background: 'var(--vg-surf2)', color: 'var(--vg-ink3)' }}>
|
||||
<Camera size={11} /> {allPhotos.length} {t('journey.detail.photos', { count: allPhotos.length })}
|
||||
</span>
|
||||
{/* #1920: the gallery's loose photos as drafts, grouped by day and place. */}
|
||||
{canEdit && allPhotos.length > 0 && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setShowFromPhotos(true)}
|
||||
className="inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-caption font-semibold transition-colors hover:bg-surface-hover"
|
||||
style={{ background: 'var(--vg-surf2)', color: 'var(--vg-ink)' }}
|
||||
>
|
||||
<NotebookPen size={13} /> {t('journey.fromPhotos.title')}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{showFromPhotos && (
|
||||
<JourneyFromPhotosDialog
|
||||
journeyId={journeyId}
|
||||
coverOf={coverOf}
|
||||
onCreated={onRefresh}
|
||||
onClose={() => setShowFromPhotos(false)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{allPhotos.length === 0 ? (
|
||||
<EmptyState scene="journey" title={t('journey.detail.noPhotos')} />
|
||||
@@ -212,3 +187,38 @@ export function GalleryView({ entries, gallery, journeyId, userId, trips, canEdi
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function CreateEntriesFromPhotosButton({ journeyId, gallery, onCreated, className }: {
|
||||
journeyId: number
|
||||
gallery: GalleryPhoto[]
|
||||
onCreated: () => void
|
||||
className: string
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const [open, setOpen] = useState(false)
|
||||
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen(true)}
|
||||
className={className}
|
||||
style={{ background: 'var(--vg-surf2)', color: 'var(--vg-ink)' }}
|
||||
>
|
||||
<NotebookPen size={16} strokeWidth={2.4} />
|
||||
{t('journey.fromPhotos.title')}
|
||||
</button>
|
||||
{open && (
|
||||
<JourneyFromPhotosDialog
|
||||
journeyId={journeyId}
|
||||
coverOf={galleryPhotoId => {
|
||||
const photo = gallery.find(p => p.id === galleryPhotoId)
|
||||
return photo && !posterlessVideo(photo) ? photoUrl(photo, 'thumbnail') : null
|
||||
}}
|
||||
onCreated={onCreated}
|
||||
onClose={() => setOpen(false)}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ export default function JourneyMapLayerControl({
|
||||
style={FROSTED_SHELL}
|
||||
role="group"
|
||||
aria-label={t('journey.map.layers')}
|
||||
className="max-w-full gap-0.5 overflow-x-auto"
|
||||
className="max-w-full gap-1 overflow-x-auto"
|
||||
>
|
||||
{layers.controls.map((control) => (
|
||||
<LayerToggle
|
||||
@@ -289,7 +289,7 @@ export default function JourneyMapLayerControl({
|
||||
compact={compact}
|
||||
/>
|
||||
))}
|
||||
<span aria-hidden className="mx-0.5 h-5 w-px flex-none bg-edge" />
|
||||
<span aria-hidden className="h-5 w-px flex-none bg-edge" />
|
||||
<KeyButton />
|
||||
<span role="status" aria-live="polite" className="sr-only">
|
||||
{live}
|
||||
|
||||
Reference in New Issue
Block a user