+ {canDelete && (
+ <>
+
+
+ >
+ )}
+
{Array.isArray(useSentiments) &&
diff --git a/packages/resource-overview/src/gridder-resource-detail.tsx b/packages/resource-overview/src/gridder-resource-detail.tsx
index 522771945..99898e871 100644
--- a/packages/resource-overview/src/gridder-resource-detail.tsx
+++ b/packages/resource-overview/src/gridder-resource-detail.tsx
@@ -23,6 +23,7 @@ import { Icon } from "../../ui/src/icon"
import {Likes, LikeWidgetProps} from '@openstad-headless/likes/src/likes';
import { BaseProps } from '@openstad-headless/types/base-props';
import { ProjectSettingProps } from '@openstad-headless/types/project-setting-props';
+import {hasRole} from "../../lib";
export type GridderResourceDetailProps =
BaseProps &
@@ -30,8 +31,7 @@ export type GridderResourceDetailProps =
{
resource: any;
onRemoveClick?: (resource: any) => void;
- isModerator?: boolean;
- loginUrl?: string;
+ currentUser?: any;
displayDocuments?: boolean;
displayLikeButton?: boolean;
clickableImage?: boolean;
@@ -46,19 +46,21 @@ export type GridderResourceDetailProps =
export const GridderResourceDetail = ({
resource,
onRemoveClick,
- isModerator = false,
- loginUrl = '',
displayDocuments = false,
displayLikeButton = false,
documentsTitle = '',
documentsDesc = '',
clickableImage = false,
+ currentUser,
...props
}: GridderResourceDetailProps) => {
// When resource is correctly typed the we will not need :any
const theme = resource.tags?.filter((t: any) => t.type === 'theme')?.at(0);
const area = resource.tags?.filter((t: any) => t.type === 'area')?.at(0);
+ const resourceUserId = resource?.userId || null;
+ const canDelete = hasRole(currentUser, ['moderator', 'owner'], resourceUserId);
+
type DocumentType = {
name?: string;
url?: string;
@@ -173,19 +175,17 @@ export const GridderResourceDetail = ({
/>
)}
-
+ )}
diff --git a/packages/resource-overview/src/resource-overview.tsx b/packages/resource-overview/src/resource-overview.tsx
index a4b196aa0..2c8934c1f 100644
--- a/packages/resource-overview/src/resource-overview.tsx
+++ b/packages/resource-overview/src/resource-overview.tsx
@@ -479,7 +479,6 @@ function ResourceOverview({
}, [filteredResources]);
const { data: currentUser } = datastore.useCurrentUser({ ...props });
- const isModerator = hasRole(currentUser, 'moderator');
const onResourceClick = useCallback(
(resource: any, index: number) => {
@@ -532,8 +531,7 @@ function ResourceOverview({
itemRenderer={(item) => (