Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
width: 100%;
margin-top: var(--theme-spacing-Full);
line-height: 1.5;
border-collapse: separate;
border-spacing: 0;
}

.usageTable th {
Expand All @@ -18,17 +20,13 @@

.usageTable td,
.usageTable th {
padding: var(--theme-spacing-Quarter);
padding: 0 var(--theme-spacing-Half);
height: var(--theme-unit);
}

.usageTable td:first-child,
.usageTable th:first-child {
padding-left: 0;
}

.usageTable td:last-child,
.usageTable th:last-child {
padding-right: 0;
.usageTable td {
border-top: 1px solid var(--theme-colors-ContrastDarker);
background-color: var(--theme-colors-ContrastNeutral);
}

/* This is for specificity; otherwise `.neos.neos-module a` would override this link style in the backend module */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.assetUsageBadge {
color: var(--theme-blue);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the blue on white for the badge fits well with the rest of the module.
I would rather use white on one of our grey colors.

}
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
import React from 'react';
import { useRecoilState } from 'recoil';

import { Button, Icon } from '@neos-project/react-ui-components';
import { Badge, Button, Icon } from '@neos-project/react-ui-components';

import { useIntl } from '@media-ui/core';
import { useSelectedAsset } from '@media-ui/core/src/hooks';

import assetUsageDetailsModalState from '../state/assetUsageDetailsModalState';
import useAssetUsagesQuery from '@media-ui/feature-asset-usage/src/hooks/useAssetUsages';

import classes from './AssetUsagesToggleButton.module.css';

const AssetUsagesToggleButton: React.FC = () => {
const { isInUse } = useSelectedAsset();
const asset = useSelectedAsset();
const { assetUsageDetails, loading } = useAssetUsagesQuery(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally didn't do this due to performance reasons with the default usage strategy implementation. You could do it though if you check for the feature flag queryAssetUsage first before you query the usageDetails.
For that you could put the Badge also into a small component and only load it if the feature flag is active.

asset ? { assetId: asset.id, assetSourceId: asset.assetSource.id } : null
);
const [assetUsagesModalOpen, setAssetUsagesModalOpen] = useRecoilState(assetUsageDetailsModalState);
const { translate } = useIntl();

return (
<Button
disabled={isInUse === false}
disabled={asset.isInUse === false}
size="regular"
style={assetUsagesModalOpen ? 'brand' : 'lighter'}
hoverStyle="brand"
onClick={() => setAssetUsagesModalOpen(true)}
>
<Icon icon="link" />
{translate('assetUsageList.toggle', 'Show usages')}
{assetUsageDetails?.[0]?.usages ? (
<Badge label={assetUsageDetails[0].usages.length} className={classes.assetUsageBadge} />
) : (
<></>
)}
</Button>
);
};
Expand Down