import React from 'react' import { Plus, Layers, Users, Upload } 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' interface ListsRailProps { ownedLists: Collection[] sharedLists: Collection[] activeId: ActiveCollectionId 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 { 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, 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. */}
{ownedLists.length > 0 &&
} {ownedLists.map(list => ( ))} {sharedLists.length > 0 && ( <>
{t('collections.shared')}
{sharedLists.map(list => ( ))} )} {incomingInvites.length > 0 && ( <>
{t('collections.invites.title')} {incomingInvites.length}
{incomingInvites.map(inv => (
{inv.name}
{t('collections.invites.from')} {inv.from.username}
))} )} ) }