a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

removed delete image button in image block for non-permissioned users

celine f75a8625 720947da

+20 -12
+20 -12
components/ImageBlock.tsx
··· 6 6 import { theme } from "tailwind.config"; 7 7 import { CloseContrastSmall } from "./Icons"; 8 8 import useMeasure from "react-use-measure"; 9 + import { useEntitySetContext } from "./EntitySetProvider"; 9 10 10 11 export function ImageBlock(props: BlockProps) { 11 - let { rep } = useReplicache(); 12 + let { rep, permission_token } = useReplicache(); 13 + let entity_set = useEntitySetContext(); 14 + 15 + let permission = useEntitySetContext().permissions.write; 16 + 12 17 let [ref, { width }] = useMeasure(); 13 18 let image = useEntity(props.entityID, "block/image"); 14 19 let imageHeight = image?.data.height; ··· 30 35 </div> 31 36 ); 32 37 38 + console.log(permission); 33 39 return ( 34 40 <div className="relative group/image flex w-full justify-center"> 35 - <button 36 - className="absolute right-2 top-2 z-10 hidden group-hover/image:block" 37 - onClick={() => { 38 - rep?.mutate.removeBlock({ blockEntity: props.entityID }); 39 - }} 40 - > 41 - <CloseContrastSmall 42 - fill={theme.colors.primary} 43 - stroke={theme.colors["bg-card"]} 44 - /> 45 - </button> 41 + {permission && ( 42 + <button 43 + className="absolute right-2 top-2 z-10 hidden group-hover/image:block" 44 + onClick={() => { 45 + rep?.mutate.removeBlock({ blockEntity: props.entityID }); 46 + }} 47 + > 48 + <CloseContrastSmall 49 + fill={theme.colors.primary} 50 + stroke={theme.colors["bg-card"]} 51 + /> 52 + </button> 53 + )} 46 54 <img 47 55 onClick={() => useUIState.getState().setSelectedBlock(props)} 48 56 alt={""}