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

Release 2024-12-31_2 #9919

Merged
merged 5 commits into from
Dec 31, 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
25 changes: 10 additions & 15 deletions front/app/components/admin/PostManager/InputManager.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Suspense, lazy, useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';

import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
Expand All @@ -13,6 +13,7 @@ import { getTopicIds } from 'api/project_allowed_input_topics/util/getProjectTop
import { IProjectData } from 'api/projects/types';
import useTopics from 'api/topics/useTopics';

import PostPreview from 'components/admin/PostManager/components/PostPreview';
import Outlet from 'components/Outlet';
import SearchInput from 'components/UI/SearchInput';

Expand All @@ -37,10 +38,6 @@ import {
TopActionBar,
} from '.';

const LazyPostPreview = lazy(
() => import('components/admin/PostManager/components/PostPreview')
);

interface Props {
// When the PostManager is used in /admin/projects, we pass down the current project id as a prop
projectId?: string | null;
Expand Down Expand Up @@ -357,16 +354,14 @@ const InputManager = ({
/>
</MiddleColumn>
</ThreeColumns>
<Suspense fallback={null}>
<LazyPostPreview
type={type}
postId={previewPostId}
selectedPhaseId={selectedPhaseId}
mode={previewMode}
onClose={closePreview}
onSwitchPreviewMode={switchPreviewMode}
/>
</Suspense>
<PostPreview
type={type}
postId={previewPostId}
selectedPhaseId={selectedPhaseId}
mode={previewMode}
onClose={closePreview}
onSwitchPreviewMode={switchPreviewMode}
/>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';

import { PreviewMode } from 'components/admin/PostManager';
import AdminIdeaContent from 'components/admin/PostManager/components/PostPreview/Idea/AdminIdeaContent';
import AdminIdeaEdit from 'components/admin/PostManager/components/PostPreview/Idea/AdminIdeaEdit';

import AdminIdeaContent from './AdminIdeaContent';
import AdminIdeaEdit from './AdminIdeaEdit';

export interface Props {
onClose: () => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useState, lazy, Suspense } from 'react';

import { colors } from '@citizenlab/cl2-component-library';
import styled from 'styled-components';

import FullPageSpinner from 'components/UI/FullPageSpinner';
import SideModal from 'components/UI/SideModal';

import { ManagerType, PreviewMode } from '../..';

import IdeaPostPreview from './Idea/IdeaPostPreview';
const IdeaPostPreview = lazy(() => import('./Idea/IdeaPostPreview'));

export const Container = styled.div`
min-height: 100%;
Expand Down Expand Up @@ -75,13 +76,15 @@ const PostPreview = ({

return (
<SideModal opened={opened} close={handleOnClose}>
<IdeaPostPreview
onClose={handleOnClose}
ideaId={postId}
onSwitchPreviewMode={onSwitchPreviewMode}
mode={mode}
selectedPhaseId={selectedPhaseId}
/>
<Suspense fallback={<FullPageSpinner />}>
<IdeaPostPreview
onClose={handleOnClose}
ideaId={postId}
onSwitchPreviewMode={onSwitchPreviewMode}
mode={mode}
selectedPhaseId={selectedPhaseId}
/>
</Suspense>
</SideModal>
);
};
Expand Down
Loading