Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quick mockup of inline dropdowns for slot scope #788

Draft
wants to merge 1 commit into
base: feature/FAC-preparation
Choose a base branch
from
Draft
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 @@ -29,6 +29,7 @@ import {
import { SlotLayout } from '../layout/SlotLayout';
import { SurfaceEditor } from './surface-editor';
import { CustomEditorTypes } from './custom-editor-types';
import { SlotScope } from './slot-scope';

type SlotEditorProps = {
slot: SiteSlot;
Expand Down Expand Up @@ -317,11 +318,11 @@ export const SlotEditor: React.FC<SlotEditorProps> = props => {
{props.small ? null : (
<ModalButton
as={SlotEditorWhy}
title="Why am I seeing this slot?"
title="See slot scope"
modalSize={'md'}
render={({ close }) => <ExplainSlot context={props.context} slot={props.slot} />}
render={({ close }) => <SlotScope context={props.context} slot={props.slot} />}
>
Why am I seeing this slot?
See slot scope
</ModalButton>
)}
</SlotEditorContainer>
Expand Down
69 changes: 69 additions & 0 deletions services/madoc-ts/src/frontend/shared/page-blocks/slot-scope.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React from 'react';
import { EditorialContext, SiteSlot } from '../../../types/schemas/site-page';
import { Heading2 } from '../typography/Heading2';
import { EditShorthandCaptureModel } from '../capture-models/EditorShorthandCaptureModel';
import { CaptureModelShorthand } from '../../../extensions/projects/types';

export const SlotScope: React.FC<{ slot: SiteSlot; context?: EditorialContext }> = ({ slot, context }) => {
const existingFilters = slot.filters;
const options = [
{
text: 'None',
value: 'none',
},
{
text: 'All',
value: 'all',
},
{
text: 'Exact',
value: 'exact',
},
];
const slotScopeShorthand: CaptureModelShorthand<any> = {
project: {
label: 'project',
type: 'dropdown-field',
inline: true,
value: existingFilters?.project || 'none',
options,
},
collection: {
label: 'collection',
type: 'dropdown-field',
inline: true,
value: existingFilters?.collection || 'none',
options,
},
manifest: {
label: 'manifest',
type: 'dropdown-field',
inline: true,
value: existingFilters?.manifest || 'none',
options,
},
canvas: {
label: 'canvas',
type: 'dropdown-field',
inline: true,
value: existingFilters?.canvas || 'none',
options,
},
};

const data = {
canvas: existingFilters?.canvas?.exact ? 'exact' : existingFilters?.canvas?.all ? 'all' : 'none',
collection: existingFilters?.collection?.exact ? 'exact' : existingFilters?.collection?.all ? 'all' : 'none',
manifest: existingFilters?.manifest?.exact ? 'exact' : existingFilters?.manifest?.all ? 'all' : 'none',
project: existingFilters?.project?.exact ? 'exact' : existingFilters?.project?.all ? 'all' : 'none',
};

return (
<div style={{ display: 'flex' }}>
<div>
<Heading2>Scope</Heading2>
<EditShorthandCaptureModel template={slotScopeShorthand} data={data} />
</div>
</div>
);
};
3 changes: 2 additions & 1 deletion services/madoc-ts/src/frontend/site/pages/user-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function UserSettings() {
} catch (e) {
// ignore.
}

const fields: UserInformationRequest['fields'] = {};
const extraVisibility: UserInformationRequest['extraVisibility'] = {};
const userInfo = ref.current?.getData();
Expand Down Expand Up @@ -78,6 +77,8 @@ export function UserSettings() {

const profileEnabled = !!data.model?.properties.gravitar;

console.log(data);
console.log('hihi');
return (
<div key={updatedAt}>
{saveSettingsStatus.isSuccess ? <SuccessMessage $margin>Settings saved</SuccessMessage> : null}
Expand Down
16 changes: 16 additions & 0 deletions services/madoc-ts/translations/en/madoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"All of the contributions to this canvas will be deleted": "All of the contributions to this canvas will be deleted",
"All of your work on these images will be lost if you continue and you will be taken back to the project homepage": "All of your work on these images will be lost if you continue and you will be taken back to the project homepage",
"All projects": "All projects",
"All projects in this site": "All projects in this site",
"All reviews completed": "All reviews completed",
"All sites": "All sites",
"All sub-tasks have been completed": "All sub-tasks have been completed",
Expand Down Expand Up @@ -96,6 +97,7 @@
"Automatically publish manifest after importing": "Automatically publish manifest after importing",
"Available": "Available",
"Available translations": "Available translations",
"Awards": "Awards",
"Back": "Back",
"Back to choices": "Back to choices",
"Back to import": "Back to import",
Expand Down Expand Up @@ -215,6 +217,7 @@
"Contribute to random canvas": "Contribute to random canvas",
"Contribute to the next image": "Contribute to the next image",
"Contribution Panel": "Contribution Panel",
"Contribution Statistics": "Contribution Statistics",
"Contribution expired": "Contribution expired",
"Contribution mode": "Contribution mode",
"Contribution page": "Contribution page",
Expand Down Expand Up @@ -350,6 +353,7 @@
"Error - Unable to save your submission": "Error - Unable to save your submission",
"Errored": "Errored",
"Errored / Rejected": "Errored / Rejected",
"Exact": "Exact",
"Exit edit mode": "Exit edit mode",
"Expand to fill available space": "Expand to fill available space",
"Export": "Export",
Expand Down Expand Up @@ -620,6 +624,7 @@
"No notifications": "No notifications",
"No options": "No options",
"No project updates": "No project updates",
"No projects in this site": "No projects in this site",
"No region has been selected. Draw a box on the image to define a region.": "No region has been selected. Draw a box on the image to define a region.",
"No results": "No results",
"No reviews": "No reviews",
Expand All @@ -629,6 +634,7 @@
"No users assigned": "No users assigned",
"No values exist for this": "No values exist for this",
"Non-latin fulltext": "Non-latin fulltext",
"None": "None",
"Not started": "Not started",
"Notes for this image": "Notes for this image",
"Nothing contributed yet": "Nothing contributed yet",
Expand All @@ -640,11 +646,13 @@
"Only one submission per user, per resource": "Only one submission per user, per resource",
"Only one submission per user, per resource (comes from list ‘contribution page’)": "Only one submission per user, per resource (comes from list ‘contribution page’)",
"Only show manifests": "Only show manifests",
"Only this project": "Only this project",
"Only users who have made their emails accessible are listed": "Only users who have made their emails accessible are listed",
"Only visible to admins": "Only visible to admins",
"Opacity": "Opacity",
"Open": "Open",
"Open in mirador": "Open in mirador",
"Options for displaying slot instance": "Options for displaying slot instance",
"Options for review listing and pages": "Options for review listing and pages",
"Override the hero title": "Override the hero title",
"Overview": "Overview",
Expand Down Expand Up @@ -689,6 +697,7 @@
"Preview as list": "Preview as list",
"Previous": "Previous",
"Previous page": "Previous page",
"Primary Email": "Primary Email",
"Prioritise canvases sequentially": "Prioritise canvases sequentially",
"Profile": "Profile",
"Profiles": "Profiles",
Expand All @@ -698,6 +707,7 @@
"Project feedback": "Project feedback",
"Project landing page": "Project landing page",
"Project not found": "Project not found",
"Project options": "Project options",
"Project page options": "Project page options",
"Project progress": "Project progress",
"Project published feed (not yet implemented)": "Project published feed (not yet implemented)",
Expand Down Expand Up @@ -885,6 +895,7 @@
"This manifest is currently in review": "This manifest is currently in review",
"This manifest is not available to browse": "This manifest is not available to browse",
"This merge may be corrupted": "This merge may be corrupted. Would you like to remove it?",
"This one": "This one",
"This page is complete": "This page is complete",
"This task is complete.": "This task is complete.",
"This task is complete. You can make another contribution from the": "This task is complete. You can make another contribution from the",
Expand Down Expand Up @@ -1036,7 +1047,9 @@
"breadcrumbs__Projects": "Projects",
"button background color": "button background color",
"cancel": "cancel",
"canvas": "canvas",
"choose": "choose",
"collection": "collection",
"collections": "collections",
"completed": "completed",
"component size": "component size",
Expand Down Expand Up @@ -1090,14 +1103,17 @@
"loading": "loading",
"loading...": "loading...",
"madoc-manifest-import": "madoc-manifest-import",
"manifest": "manifest",
"manifests": "manifests",
"max contributors": "max contributors",
"migrate-capture-model-task": "migrate-capture-model-task",
"none": "none",
"not found": "not found",
"not started": "not started",
"paused": "paused",
"pending": "pending",
"preview": "preview",
"project": "project",
"projects": "projects",
"rejected": "rejected",
"remove": "remove",
Expand Down