mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 21:54:09 +00:00
refactor: improve empty state for project info
This commit is contained in:
committed by
Carlos Valente
parent
7915cc822d
commit
c1d53b0e55
@@ -1,6 +1,7 @@
|
||||
import { ProjectData } from 'ontime-types';
|
||||
|
||||
import Empty from '../../common/components/state/Empty';
|
||||
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';
|
||||
@@ -16,7 +17,7 @@ interface ProjectInfoProps {
|
||||
isMirrored: boolean;
|
||||
}
|
||||
|
||||
export default function ProjectInfoProps(props: ProjectInfoProps) {
|
||||
export default function ProjectInfo(props: ProjectInfoProps) {
|
||||
const { general, isMirrored } = props;
|
||||
|
||||
useWindowTitle('Project info');
|
||||
@@ -25,6 +26,25 @@ export default function ProjectInfoProps(props: ProjectInfoProps) {
|
||||
return <Empty text='No data found' />;
|
||||
}
|
||||
|
||||
if (!general) {
|
||||
return (
|
||||
<>
|
||||
<ViewParamsEditor viewOptions={projectInfoOptions} />
|
||||
return <EmptyPage text='No data found' />;
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const isEmpty = Object.values(general).every((value) => !value);
|
||||
if (isEmpty) {
|
||||
return (
|
||||
<>
|
||||
<ViewParamsEditor viewOptions={projectInfoOptions} />
|
||||
<EmptyPage text='The project has no data yet' />;
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`project ${isMirrored ? 'mirror' : ''}`} data-testid='project-view'>
|
||||
<ViewParamsEditor viewOptions={projectInfoOptions} />
|
||||
|
||||
Reference in New Issue
Block a user