feat: project user preference for pages (#1673)
* feat: project user preference for pages * feat: page block description improvement * fix: create block input box
This commit is contained in:
parent
89e7975821
commit
6769d1139e
5 changed files with 144 additions and 13 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useEffect, useState, useRef } from "react";
|
||||
import React, { useEffect, useState, useRef } from "react";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import Link from "next/link";
|
||||
|
|
@ -19,6 +19,7 @@ import useOutsideClickDetector from "hooks/use-outside-click-detector";
|
|||
// components
|
||||
import { GptAssistantModal } from "components/core";
|
||||
import { CreateUpdateBlockInline } from "components/pages";
|
||||
import RemirrorRichTextEditor, { IRemirrorRichTextEditor } from "components/rich-text-editor";
|
||||
// ui
|
||||
import { CustomMenu, TextArea } from "components/ui";
|
||||
// icons
|
||||
|
|
@ -42,11 +43,25 @@ import { PAGE_BLOCKS_LIST } from "constants/fetch-keys";
|
|||
type Props = {
|
||||
block: IPageBlock;
|
||||
projectDetails: IProject | undefined;
|
||||
showBlockDetails: boolean;
|
||||
index: number;
|
||||
user: ICurrentUserResponse | undefined;
|
||||
};
|
||||
|
||||
export const SinglePageBlock: React.FC<Props> = ({ block, projectDetails, index, user }) => {
|
||||
const WrappedRemirrorRichTextEditor = React.forwardRef<
|
||||
IRemirrorRichTextEditor,
|
||||
IRemirrorRichTextEditor
|
||||
>((props, ref) => <RemirrorRichTextEditor {...props} forwardedRef={ref} />);
|
||||
|
||||
WrappedRemirrorRichTextEditor.displayName = "WrappedRemirrorRichTextEditor";
|
||||
|
||||
export const SinglePageBlock: React.FC<Props> = ({
|
||||
block,
|
||||
projectDetails,
|
||||
showBlockDetails,
|
||||
index,
|
||||
user,
|
||||
}) => {
|
||||
const [isSyncing, setIsSyncing] = useState(false);
|
||||
const [createBlockForm, setCreateBlockForm] = useState(false);
|
||||
const [iAmFeelingLucky, setIAmFeelingLucky] = useState(false);
|
||||
|
|
@ -440,11 +455,21 @@ export const SinglePageBlock: React.FC<Props> = ({ block, projectDetails, index,
|
|||
noPadding
|
||||
/>
|
||||
</div>
|
||||
{block?.description_stripped.length > 0 && (
|
||||
<p className="mt-3 h-5 truncate text-sm font-normal text-custom-text-200">
|
||||
{block.description_stripped}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{showBlockDetails
|
||||
? block.description_html.length > 7 && (
|
||||
<WrappedRemirrorRichTextEditor
|
||||
value={block.description_html}
|
||||
customClassName="text-sm"
|
||||
noBorder
|
||||
borderOnFocus={false}
|
||||
/>
|
||||
)
|
||||
: block.description_stripped.length > 0 && (
|
||||
<p className="mt-3 text-sm font-normal text-custom-text-200 h-5 truncate">
|
||||
{block.description_stripped}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<GptAssistantModal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue