import { OntimeView } from 'ontime-types'; import { IoOpenOutline } from 'react-icons/io5'; 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 { useTranslation } from '../../translation/TranslationProvider'; import Loader from '../common/loader/Loader'; import { ProjectInfoData, useProjectInfoData } from './useProjectInfoData'; import './ProjectInfo.scss'; export default function ProjectInfoLoader() { const { data, status } = useProjectInfoData(); useWindowTitle('Project info'); if (status === 'pending') { return ; } if (status === 'error') { return ; } return ; } function ProjectInfo({ projectData, isMirrored }: ProjectInfoData) { const { getLocalizedString } = useTranslation(); /** * 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 = !projectData || Object.values(projectData).every((value) => !value || (value && Array.isArray(value) && value.length === 0)); if (isEmpty) { return ( <> ; ); } return (
{projectData.logo && }
{projectData.title && (
{getLocalizedString('project.title')}
{projectData.title}
)} {projectData.description && (
{getLocalizedString('project.description')}
{projectData.description}
)} {projectData.info && (
{getLocalizedString('project.info')}
{projectData.info}
)} {projectData.url && (
{getLocalizedString('project.url')}
{projectData.url}
)} {projectData.custom.map((info, idx) => { const hasUrl = Boolean(info.url); return ( // oxlint-disable-next-line react/no-array-index-key - we only have the index to go of here
{hasUrl && (
)}
{info.title}
{info.value}
); })}
); }