import Link from 'next/link' import { Fragment } from 'react' import { cn } from 'ui' import { TroubleshootingFilter } from './Troubleshooting.ui.client' import { type ITroubleshootingEntry, type ITroubleshootingMetadata, getArticleSlug, getTroubleshootingUpdatedDates, } from './Troubleshooting.utils' import { formatError, TROUBLESHOOTING_DATA_ATTRIBUTES, TROUBLESHOOTING_CONTAINER_ID, } from './Troubleshooting.utils.shared' export async function TroubleshootingPreview({ entry }: { entry: ITroubleshootingEntry }) { const dateUpdated = entry.data.database_id.startsWith('pseudo-') ? new Date() : (await getTroubleshootingUpdatedDates()).get(entry.data.database_id) const keywords = [...entry.data.topics, ...(entry.data.keywords ?? [])] const attributes = { [TROUBLESHOOTING_DATA_ATTRIBUTES.QUERY_ATTRIBUTE]: TROUBLESHOOTING_DATA_ATTRIBUTES.QUERY_VALUE_ENTRY, [TROUBLESHOOTING_DATA_ATTRIBUTES.PRODUCTS_LIST_ATTRIBUTE]: entry.data.topics.join(','), [TROUBLESHOOTING_DATA_ATTRIBUTES.KEYWORDS_LIST_ATTRIBUTE]: keywords.join(','), [TROUBLESHOOTING_DATA_ATTRIBUTES.ERRORS_LIST_ATTRIBUTE]: entry.data.errors ?.map((error) => formatError(error)) .join(','), } return (
{error}
{index < (entry.data.errors?.length || 0) - 1 ? ', ' : ''}
{description}
No troubleshooting guides available for {name} yet.