Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tan 3247/projectsshowpage content simplified #9645

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions front/app/containers/ProjectsShowPage/ProjectCTABar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ import { isNilOrError } from 'utils/helperUtils';
type ProjectCTABarProps = {
projectId: string;
};

const ProjectCTABar = ({ projectId }: ProjectCTABarProps) => {
const isSmallerThanTablet = useBreakpoint('tablet');
const isSmallerThanPhone = useBreakpoint('phone');
const [isVisible, setIsVisible] = useState(false);
// TODO: Fix this the next time the file is edited.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const portalElement = document?.getElementById('topbar-portal');
const portalElement = document.getElementById('topbar-portal');
const { data: phases } = usePhases(projectId);
const { data: project } = useProjectById(projectId);

Expand Down
100 changes: 51 additions & 49 deletions front/app/containers/ProjectsShowPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,54 +118,6 @@ const ProjectsShowPage = ({ project }: Props) => {
}
}, [mounted, loading, scrollToStatusModule, scrollToIdeas]);

let content: JSX.Element | null = null;

if (loading) {
content = <FullPageSpinner />;
} else {
content = (
<ContentWrapper id="e2e-project-page">
<ProjectHeader projectId={projectId} />
<ProjectCTABar projectId={projectId} />

<div id="participation-detail">
<TimelineContainer projectId={projectId} />
</div>
{!!events?.data.length && (
<Box
id="e2e-events-section-project-page"
display="flex"
flexDirection="column"
gap="48px"
mx="auto"
my="48px"
maxWidth={`${maxPageWidth}px`}
padding={isSmallerThanTablet ? '20px' : '0px'}
>
<EventsViewer
showProjectFilter={false}
projectId={projectId}
eventsTime="currentAndFuture"
title={formatMessage(messages.upcomingAndOngoingEvents)}
fallbackMessage={messages.noUpcomingOrOngoingEvents}
projectPublicationStatuses={['published', 'draft', 'archived']}
/>
<EventsViewer
showProjectFilter={false}
projectId={projectId}
eventsTime="past"
title={formatMessage(messages.pastEvents)}
fallbackMessage={messages.noPastEvents}
projectPublicationStatuses={['published', 'draft', 'archived']}
showDateFilter={false}
/>
</Box>
)}
<SuccessModal projectId={projectId} />
</ContentWrapper>
);
}

return (
<main>
<Container
Expand All @@ -175,7 +127,57 @@ const ProjectsShowPage = ({ project }: Props) => {
events && events?.data.length > 0 ? colors.white : colors.background
}
>
{content}
{loading ? (
<FullPageSpinner />
) : (
<ContentWrapper id="e2e-project-page">
<ProjectHeader projectId={projectId} />
<ProjectCTABar projectId={projectId} />

<div id="participation-detail">
<TimelineContainer projectId={projectId} />
</div>
{!!events?.data.length && (
<Box
id="e2e-events-section-project-page"
display="flex"
flexDirection="column"
gap="48px"
mx="auto"
my="48px"
maxWidth={`${maxPageWidth}px`}
padding={isSmallerThanTablet ? '20px' : '0px'}
>
<EventsViewer
showProjectFilter={false}
projectId={projectId}
eventsTime="currentAndFuture"
title={formatMessage(messages.upcomingAndOngoingEvents)}
fallbackMessage={messages.noUpcomingOrOngoingEvents}
projectPublicationStatuses={[
'published',
'draft',
'archived',
]}
/>
<EventsViewer
showProjectFilter={false}
projectId={projectId}
eventsTime="past"
title={formatMessage(messages.pastEvents)}
fallbackMessage={messages.noPastEvents}
projectPublicationStatuses={[
'published',
'draft',
'archived',
]}
showDateFilter={false}
/>
</Box>
)}
<SuccessModal projectId={projectId} />
</ContentWrapper>
)}
</Container>
</main>
);
Expand Down