Merge branch 'preview' of github.com:makeplane/plane into develop

This commit is contained in:
sriram veeraghanta 2024-02-12 19:12:26 +05:30
commit 7651640e29
3 changed files with 17 additions and 9 deletions

View File

@ -6,10 +6,16 @@ import { scrollSummary } from "src/utils/editor-summary-utils";
interface ContentBrowserProps { interface ContentBrowserProps {
editor: Editor; editor: Editor;
markings: IMarking[]; markings: IMarking[];
setSidePeekVisible?: (sidePeekState: boolean) => void;
} }
export const ContentBrowser = (props: ContentBrowserProps) => { export const ContentBrowser = (props: ContentBrowserProps) => {
const { editor, markings } = props; const { editor, markings, setSidePeekVisible } = props;
const handleOnClick = (marking: IMarking) => {
scrollSummary(editor, marking);
if (setSidePeekVisible) setSidePeekVisible(false);
}
return ( return (
<div className="flex h-full flex-col overflow-hidden"> <div className="flex h-full flex-col overflow-hidden">
@ -18,11 +24,11 @@ export const ContentBrowser = (props: ContentBrowserProps) => {
{markings.length !== 0 ? ( {markings.length !== 0 ? (
markings.map((marking) => markings.map((marking) =>
marking.level === 1 ? ( marking.level === 1 ? (
<HeadingComp onClick={() => scrollSummary(editor, marking)} heading={marking.text} /> <HeadingComp onClick={() => handleOnClick(marking)} heading={marking.text} />
) : marking.level === 2 ? ( ) : marking.level === 2 ? (
<SubheadingComp onClick={() => scrollSummary(editor, marking)} subHeading={marking.text} /> <SubheadingComp onClick={() => handleOnClick(marking)} subHeading={marking.text} />
) : ( ) : (
<HeadingThreeComp heading={marking.text} onClick={() => scrollSummary(editor, marking)} /> <HeadingThreeComp heading={marking.text} onClick={() => handleOnClick(marking)} />
) )
) )
) : ( ) : (

View File

@ -33,9 +33,8 @@ export const SummaryPopover: React.FC<Props> = (props) => {
<button <button
type="button" type="button"
ref={setReferenceElement} ref={setReferenceElement}
className={`grid h-7 w-7 place-items-center rounded ${ className={`grid h-7 w-7 place-items-center rounded ${sidePeekVisible ? "bg-custom-primary-100/20 text-custom-primary-100" : "text-custom-text-300"
sidePeekVisible ? "bg-custom-primary-100/20 text-custom-primary-100" : "text-custom-text-300" }`}
}`}
onClick={() => setSidePeekVisible(!sidePeekVisible)} onClick={() => setSidePeekVisible(!sidePeekVisible)}
> >
<List className="h-4 w-4" /> <List className="h-4 w-4" />
@ -48,7 +47,7 @@ export const SummaryPopover: React.FC<Props> = (props) => {
style={summaryPopoverStyles.popper} style={summaryPopoverStyles.popper}
{...summaryPopoverAttributes.popper} {...summaryPopoverAttributes.popper}
> >
<ContentBrowser editor={editor} markings={markings} /> <ContentBrowser setSidePeekVisible={setSidePeekVisible} editor={editor} markings={markings} />
</div> </div>
)} )}
</div> </div>

View File

@ -12,7 +12,7 @@ import { ProjectSidebarList } from "components/project";
import { useApplication } from "hooks/store"; import { useApplication } from "hooks/store";
import useOutsideClickDetector from "hooks/use-outside-click-detector"; import useOutsideClickDetector from "hooks/use-outside-click-detector";
export interface IAppSidebar {} export interface IAppSidebar { }
export const AppSidebar: FC<IAppSidebar> = observer(() => { export const AppSidebar: FC<IAppSidebar> = observer(() => {
// store hooks // store hooks
@ -32,6 +32,9 @@ export const AppSidebar: FC<IAppSidebar> = observer(() => {
if (window.innerWidth <= 768) { if (window.innerWidth <= 768) {
themStore.toggleSidebar(true); themStore.toggleSidebar(true);
} }
if (window.innerWidth > 768) {
themStore.toggleSidebar(false);
}
}; };
handleResize(); handleResize();
window.addEventListener("resize", handleResize); window.addEventListener("resize", handleResize);