// @flow import React from "react"; import { Icon } from "~/components/panels/Icon"; import { MapListDialog } from "~/components/dialogs/MapListDialog"; import { Tooltip } from "~/components/panels/Tooltip"; import { ReactElement } from "react"; import classnames from "classnames"; import { toggleRouteStarred } from "~/redux/user/actions"; import { TABS } from "~/constants/dialogs"; interface Props { tab: string; address: string; title: string; distance: number; is_public: boolean; is_admin: boolean; is_published: boolean; openRoute: typeof MapListDialog.openRoute; toggleStarred: typeof MapListDialog.toggleStarred; startEditing: typeof MapListDialog.startEditing; stopEditing: typeof MapListDialog.stopEditing; showMenu: typeof MapListDialog.showMenu; hideMenu: typeof MapListDialog.hideMenu; showDropCard: typeof MapListDialog.showDropCard; } export const RouteRowView = ({ title, distance, address, openRoute, tab, startEditing, showMenu, showDropCard, hideMenu, is_admin, is_published, toggleStarred }: Props): ReactElement => (
{(tab === TABS.PENDING || tab === TABS.STARRED) && is_admin && (
{is_published ? ( ) : ( )}
)}
openRoute(address)}>
{(tab === "my" || !is_admin) && is_published && (
)} {title || address}
{address} {(distance && `${distance} km`) || "0 km"}
{tab === "my" && (
Удалить
Редактировать
)}
);