Files
plane/space/ee/components/pages/main-content.tsx
Aaryan Khandelwal b9ce8ea8b1 fix: merge conflicts and build errors (#1469)
* dev: private bucket implementation (#1339)

* chore: migrations and backmigration to move attachments to file asset

* chore: move attachments to file assets

* chore: update migration file to include created by and updated by and size

* chore: remove uninmport errors

* chore: make size as float field

* fix: file asset uploads

* chore: asset uploads migration changes

* chore: v2 assets endpoint

* chore: remove unused imports

* chore: issue attachments

* chore: issue attachments

* chore: workspace logo endpoints

* chore: private bucket changes

* chore: user asset endpoint

* chore: add logo_url validation

* chore: cover image urlk

* chore: change asset max length

* chore: pages endpoint

* chore: store the storage_metadata only when none

* chore: attachment asset apis

* chore: update create private bucket

* chore: make bucket private

* chore: fix response of user uploads

* fix: response of user uploads

* fix: job to fix file asset uploads

* fix: user asset endpoints

* chore: avatar for user profile

* chore: external apis user url endpoint

* chore: upload workspace and user asset actions updated

* chore: analytics endpoint

* fix: analytics export

* chore: avatar urls

* chore: update user avatar instances

* chore: avatar urls for assignees and creators

* chore: bucket permission script

* fix: all user avatr instances in the web app

* chore: update project cover image logic

* fix: issue attachment endpoint

* chore: patch endpoint for issue attachment

* chore: attachments

* chore: change attachment storage class

* chore: update issue attachment endpoints

* fix: issue attachment

* chore: update issue attachment implementation

* chore: page asset endpoints

* fix: web build errors

* chore: attachments

* chore: page asset urls

* chore: comment and issue asset endpoints

* chore: asset endpoints

* chore: attachment endpoints

* chore: bulk asset endpoint

* chore: restore endpoint

* chore: project assets endpoints

* chore: asset url

* chore: add delete asset endpoints

* chore: fix asset upload endpoint

* chore: update patch endpoints

* chore: update patch endpoint

* chore: update editor image handling

* chore: asset restore endpoints

* chore: avatar url for space assets

* chore: space app assets migration

* fix: space app urls

* chore: space endpoints

* fix: old editor images rendering logic

* fix: issue archive and attachment activity

* chore: asset deletes

* chore: update images

* chore: attachment delete

* fix: issue attachment

* fix: issue attachment get

* chore: cover image url for projects

* chore: remove duplicate py file

* fix: url check function

* chore: chore project cover asset delete

* fix: migrations

* chore: delete migration files

---------

Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>

* fix: private bucket build errors (#1347)

* fix: private bucket build errors

* fix: build errors

* revert: issue type select changes. (#1355)

* chore: private bucket implementation for workspace level pages (#1371)

* chore: update project modal

* chore: update rich-text read-only editor

* chore: update workspace pages' components

* chore: remove entity identifier in favour of multiple columns of entities (#1405)

* fix: issue attachments (#1411)

* fix: issue attachments (#1422)

* chore: file size limit for pro workspaces (#1437)

* chore: file size limit for pro

* chore: update maximum file size logic

* chore: update editor max file size logic

* chore: update max file size limit logic

* chore: add comments

* fix: close modal after removing workspace logo

* chore: update uploaded asstes' status post issue creation

* chore: memoize max file size var

* chore: check for pro file size limits

* chore: added file size limit to the space app

---------

Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>

* chore: add max file size limit to workspace pages (#1440)

* fix: remove old workspace logo and user avatar (#1445)

* fix: intake exception error (#5810)

* chore: filtered active cycles for guest (#1468)

* fix: build error

---------

Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
Co-authored-by: Nikhil <118773738+pablohashescobar@users.noreply.github.com>
Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com>
Co-authored-by: Anmol Singh Bhatia <121005188+anmolsinghbhatia@users.noreply.github.com>
Co-authored-by: Bavisetti Narayan <72156168+NarayanBavisetti@users.noreply.github.com>
2024-10-12 01:47:13 +05:30

85 lines
2.8 KiB
TypeScript

import { useRef } from "react";
import { observer } from "mobx-react-lite";
import useSWR from "swr";
import { FileText } from "lucide-react";
// editor
import { DocumentReadOnlyEditorWithRef, EditorRefApi } from "@plane/editor";
// ui
import { Logo } from "@plane/ui";
// helpers
import { getReadOnlyEditorFileHandlers } from "@/helpers/editor.helper";
// hooks
import { usePublish } from "@/hooks/store";
import { useMention } from "@/hooks/use-mention";
// plane web components
import { IssueEmbedCard } from "@/plane-web/components/pages";
// plane web hooks
import { usePage, usePagesList } from "@/plane-web/hooks/store";
type Props = {
anchor: string;
};
export const PageDetailsMainContent: React.FC<Props> = observer((props) => {
const { anchor } = props;
// refs
const editorRef = useRef<EditorRefApi>(null);
// store hooks
const publishSettings = usePublish(anchor);
const { fetchPageDetails } = usePagesList();
const pageDetails = usePage(anchor);
// mention hook
const { mentionHighlights } = useMention();
useSWR(anchor ? `PAGE_DETAILS_${anchor}` : null, anchor ? () => fetchPageDetails(anchor) : null, {
revalidateIfStale: false,
revalidateOnFocus: false,
});
useSWR(
anchor && pageDetails ? `PAGE_ISSUE_EMBEDS_${anchor}` : null,
anchor && pageDetails ? () => pageDetails.fetchPageIssueEmbeds?.(anchor) : null,
{
revalidateIfStale: false,
revalidateOnFocus: false,
}
);
if (!publishSettings || !pageDetails || !pageDetails.id) return null;
return (
<div className="size-full flex justify-center overflow-y-auto vertical-scrollbar scrollbar-md">
<div className="xl:w-1/2 mt-6 xl:mt-20 px-5 md:px-10 xl:p-0 space-y-4">
<div className="space-y-2">
<div className="size-[60px] bg-custom-background-80 rounded grid place-items-center">
{pageDetails.logo_props?.in_use ? (
<Logo logo={pageDetails.logo_props} size={36} type="lucide" />
) : (
<FileText className="size-9 text-custom-text-300" />
)}
</div>
<h1 className="text-4xl font-semibold break-words">{pageDetails.name}</h1>
</div>
<div className="ml-5">
<DocumentReadOnlyEditorWithRef
ref={editorRef}
id={pageDetails.id}
initialValue={pageDetails.description_html ?? "<p></p>"}
containerClassName="p-0 pb-64 border-none"
fileHandler={getReadOnlyEditorFileHandlers({
anchor,
})}
mentionHandler={{
highlights: mentionHighlights,
}}
embedHandler={{
issue: {
widgetCallback: ({ issueId }) => <IssueEmbedCard anchor={anchor} issueId={issueId} />,
},
}}
/>
</div>
</div>
</div>
);
});