/** * Copyright (c) 2026-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { observer } from 'mobx-react-lite'; import { useState } from 'react'; import { Chip, IconButton } from '@mui/material'; import { clsx, MarkdownTextViewer, StarIcon, EmptyStarIcon, } from '@finos/legend-art'; import type { LegendServiceCardState } from '../../stores/dataAPIs/LegendMarketplaceDataAPIsStore.js'; import { ServiceOwnershipType } from '@finos/legend-graph'; import { LegendMarketplaceListItem } from '../MarketplaceCard/LegendMarketplaceListItem.js'; const MAX_DESCRIPTION_LENGTH = 250; export const LegendServiceListRow = observer( (props: { serviceCardState: LegendServiceCardState; onClick: () => void; isFavorite: boolean; onToggleFavorite: () => void; }): React.ReactNode => { const { serviceCardState, onClick, isFavorite, onToggleFavorite } = props; const [expanded, setExpanded] = useState(false); const description = serviceCardState.description; const isTruncatable = description.length > MAX_DESCRIPTION_LENGTH; const displayDescription = !expanded && isTruncatable ? `${description.substring(0, MAX_DESCRIPTION_LENGTH)}...` : description; return (
{ e.stopPropagation(); onToggleFavorite(); }} size="small" title={ isFavorite ? 'Remove from favorites' : 'Add to favorites' } > {isFavorite ? : }
{serviceCardState.title}
{serviceCardState.service.pattern}
{serviceCardState.owners.map((owner) => ( ))}
{description && (
{isTruncatable && ( )}
)} } /> ); }, );