a tool for shared writing and social publishing

add permissions check for HelpPopover and tweak for sidebar + footer

+19 -14
+4 -2
components/HelpPopover.tsx
··· 4 4 import { Media } from "./Media"; 5 5 import { Popover } from "./Popover"; 6 6 import { metaKey } from "src/utils/metaKey"; 7 + import { useEntitySetContext } from "./EntitySetProvider"; 7 8 8 9 export const HelpPopover = () => { 9 - return ( 10 + let entity_set = useEntitySetContext(); 11 + return entity_set.permissions.write ? ( 10 12 <Popover 11 13 className="max-w-xs w-full" 12 14 trigger={ ··· 96 98 </Media> 97 99 </div> 98 100 </Popover> 99 - ); 101 + ) : null; 100 102 }; 101 103 102 104 const KeyboardShortcut = (props: { name: string; keys: string[] }) => {
+2 -2
components/MobileFooter.tsx
··· 28 28 blockID={focusedBlock.entityID} 29 29 /> 30 30 </div> 31 - ) : ( 31 + ) : entity_set.permissions.write ? ( 32 32 <div className="z-10 pb-2 px-2 flex justify-between"> 33 33 <HomeButton /> 34 34 <div className="flex flex-row gap-[6px] items-center "> ··· 37 37 <ShareOptions rootEntity={props.entityID} /> 38 38 </div> 39 39 </div> 40 - )} 40 + ) : null} 41 41 </Media> 42 42 ); 43 43 }
+13 -10
components/Pages.tsx
··· 37 37 }, [openPage, props.rootPage]); 38 38 let pages = [...openPages]; 39 39 if (openPage && !pages.includes(openPage)) pages.push(openPage); 40 + let entity_set = useEntitySetContext(); 40 41 41 42 return ( 42 43 <div ··· 53 54 e.currentTarget === e.target && blurPage(); 54 55 }} 55 56 > 56 - <Media mobile={false} className="h-full"> 57 - <div className="flex flex-col h-full justify-between mr-4 mt-1"> 58 - <div className="flex flex-col justify-center gap-2 "> 59 - <ShareOptions rootEntity={props.rootPage} /> 60 - <LeafletOptions entityID={props.rootPage} /> 61 - <HelpPopover /> 62 - <hr className="text-border my-3" /> 63 - <HomeButton /> 57 + {entity_set.permissions.write ? ( 58 + <Media mobile={false} className="h-full"> 59 + <div className="flex flex-col h-full justify-between mr-4 mt-1"> 60 + <div className="flex flex-col justify-center gap-2 "> 61 + <ShareOptions rootEntity={props.rootPage} /> 62 + <LeafletOptions entityID={props.rootPage} /> 63 + <HelpPopover /> 64 + <hr className="text-border my-3" /> 65 + <HomeButton /> 66 + </div> 64 67 </div> 65 - </div> 66 - </Media> 68 + </Media> 69 + ) : null} 67 70 </div> 68 71 <div className="flex items-stretch"> 69 72 <Page entityID={props.rootPage} first />