Skip to content

Commit

Permalink
Merge pull request #468 from digirati-co-uk/feature/bug-fixes-2
Browse files Browse the repository at this point in the history
Bug fixes
  • Loading branch information
stephenwf authored Oct 29, 2021
2 parents 51490b9 + 59a1bce commit 08686c7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { Button } from '../../../shared/navigation/Button';
const scopeDefinitions = [
{ label: 'Site admin', value: 'site.admin' },
{ label: 'Capture model admin', value: 'model.admin' },
{ label: 'Tasks admin', value: 'tasks.admin' },
];

export const GenerateApiKey: React.FC = () => {
Expand Down
7 changes: 5 additions & 2 deletions services/madoc-ts/src/frontend/site/features/ManifestHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { IIIFHero } from '../../shared/components/IIIFHero';
import { useManifest } from '../hooks/use-manifest';
import { useRelativeLinks } from '../hooks/use-relative-links';

export const ManifestHero: React.FC<{ backgroundColor?: string; hideAsset?: boolean }> = ({
export const ManifestHero: React.FC<{ backgroundColor?: string; hideAsset?: boolean; titleOverride?: string }> = ({
backgroundColor,
hideAsset,
titleOverride,
}) => {
const { data } = useManifest();
const manifest = data?.manifest;
Expand All @@ -18,7 +19,7 @@ export const ManifestHero: React.FC<{ backgroundColor?: string; hideAsset?: bool

return (
<IIIFHero
title={manifest.label}
title={titleOverride ? { none: [titleOverride] } : manifest.label}
description={manifest.summary}
backgroundImage={manifest.items.length ? manifest.items[0].thumbnail : ''}
asset={
Expand All @@ -44,8 +45,10 @@ blockEditorFor(ManifestHero, {
defaultProps: {
backgroundColor: '#000',
hideAsset: false,
titleOverride: '',
},
editor: {
titleOverride: { type: 'text-field', label: 'Override the hero title' },
backgroundColor: { type: 'text-field', label: 'Background color (right side)' },
hideAsset: { type: 'checkbox-field', label: 'Hide asset', inlineLabel: 'Check this to hide asset on the right' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export const ManifestMetadata: React.FC<{ hidden?: boolean; compact?: boolean; s
const { resolvedData: data } = usePaginatedData(ManifestLoader, undefined, { enabled: !!manifestId && !hidden });
const { data: metadataConfig } = useSiteMetadataConfiguration({ enabled: !hidden });
const user = useUser();
const canSuggest = user && user.scope.indexOf('models.contribute') !== -1;
const canSuggest =
user && (user.scope.indexOf('models.contribute') !== -1 || user.scope.indexOf('site.admin') !== -1);

if (!data || !metadataConfig || hidden) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export const SuggestMetadata: React.FC = () => {
const { t } = useTranslation();
const createLink = useRelativeLinks();
const config = useMetadataSuggestionConfiguration();
const canSuggest = user && user.scope.indexOf('models.contribute') !== -1;
const canSuggest =
user && (user.scope.indexOf('models.contribute') !== -1 || user.scope.indexOf('site.admin') !== -1);

const { data: canvasRequest } = apiHooks.getSiteCanvasMetadata(() => (canvasId ? [canvasId] : undefined));
const { data: manifestRequest } = apiHooks.getSiteManifestMetadata(() =>
Expand Down

0 comments on commit 08686c7

Please sign in to comment.