import React, { createElement } from 'react' import { Plus, Layers, Users, Upload, Globe2 } from 'lucide-react' import type { Collection } from '@trek/shared' import type { TranslationFn } from '../../types' import { ALL_SAVED } from '../../store/collectionStore' import type { ActiveCollectionId, IncomingCollectionInvite } from '../../store/collectionStore' import CollectionInviteCard from './CollectionInviteCard' import { Tooltip } from '../shared/Tooltip' import { listIcon } from './listIcons' interface ListsRailProps { ownedLists: Collection[] sharedLists: Collection[] activeId: ActiveCollectionId /** How many places the lists hold together, beside "All saved". */ savedCount?: number /** The overview of every place is open (PLC-07); it sits above the lists. */ libraryActive?: boolean onSelectLibrary?: () => void incomingInvites: IncomingCollectionInvite[] onSelect: (id: ActiveCollectionId) => void onNewList: () => void /** Read a list file as a new list (#2198). */ onImportList: () => void onAcceptInvite: (id: number) => void onDeclineInvite: (id: number) => void t: TranslationFn } function ListRow({ list, active, onSelect }: { list: Collection; active: boolean; onSelect: (id: number) => void }): React.ReactElement { const ListIcon = listIcon(list.icon) return (
) } /** * Left rail of the user's lists: "New list" and "Import list" actions, the "All saved" union * pseudo-list, owned lists (colour dot + count), a shared section, and an * incoming-invites block. Selecting a list makes it active; editing / deleting * happens from the Edit button in the hero of the active list. */ export default function ListsRail(props: ListsRailProps): React.ReactElement { const { ownedLists, sharedLists, activeId, incomingInvites, libraryActive = false, onSelectLibrary, savedCount = 0, onSelect, onNewList, onImportList, onAcceptInvite, onDeclineInvite, t, } = props return ( <>
{/* Import sits beside New rather than in the hero: a file becomes a NEW list, so it belongs where lists are made, not on the one open. */}
{onSelectLibrary && (
)}
{ownedLists.length > 0 &&
{t('collections.myLists')}
} {ownedLists.map(list => ( ))} {sharedLists.length > 0 && ( <>
{t('collections.shared')}
{sharedLists.map(list => ( ))} )} {incomingInvites.length > 0 && ( <>
{t('collections.invites.title')} {incomingInvites.length}
{incomingInvites.map(inv => ( ))} )} ) }