import { Fragment } from 'react/jsx-runtime'; import { IoOpenOutline } from 'react-icons/io5'; import ViewNavigationMenu from '../../common/components/navigation-menu/ViewNavigationMenu'; import EmptyPage from '../../common/components/state/EmptyPage'; import ViewLogo from '../../common/components/view-logo/ViewLogo'; import ViewParamsEditor from '../../common/components/view-params-editor/ViewParamsEditor'; import { useWindowTitle } from '../../common/hooks/useWindowTitle'; import useProjectData from '../../common/hooks-query/useProjectData'; import { useViewOptionsStore } from '../../common/stores/viewOptions'; import { useTranslation } from '../../translation/TranslationProvider'; import './ProjectInfo.scss'; export default function ProjectInfo() { // persisted app state const isMirrored = useViewOptionsStore((state) => state.mirror); const { data, status } = useProjectData(); const { getLocalizedString } = useTranslation(); useWindowTitle('Project info'); if (status === 'pending' || !data) { return ( <> ; ); } /** * Check if there is data to show at all * We need a special check for the project fields which can be an empty array */ const isEmpty = Object.values(data).every((value) => !value || (value && Array.isArray(value) && value.length === 0)); if (isEmpty) { return ( <> ; ); } return (
{data.logo && }
{data.title && ( <>
{getLocalizedString('project.title')}
{data.title}
)} {data.description && ( <>
{getLocalizedString('project.description')}
{data.description}
)} {data.info && ( <>
{getLocalizedString('project.info')}
{data.info}
)} {data.url && ( <>
{getLocalizedString('project.url')}
{data.url} )} {data.custom.map((info, idx) => { if (!info.title || !info.value) { return null; } return (
{info.title}
{info.value}
); })}
); }