@riboseinc/paneron-registry-kit 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -3
- package/types/views.d.ts +6 -0
- package/types/views.js.map +1 -1
- package/views/change-request/ChangeProposalContext.d.ts +3 -0
- package/views/change-request/ChangeProposalContext.js +4 -0
- package/views/change-request/ChangeProposalContext.js.map +1 -0
- package/views/change-request/Proposals.js +9 -3
- package/views/change-request/Proposals.js.map +1 -1
- package/views/detail/ChangeRequest/index.js +1 -2
- package/views/detail/ChangeRequest/index.js.map +1 -1
- package/views/hooks/useCustomView.d.ts +2 -2
- package/views/hooks/useCustomView.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riboseinc/paneron-registry-kit",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "Ribose Inc. <open.source@ribose.com>",
|
|
6
6
|
"scripts": {
|
|
@@ -28,9 +28,8 @@
|
|
|
28
28
|
"@blueprintjs/select": "~4.9.10",
|
|
29
29
|
"@emotion/react": "^11.10.6",
|
|
30
30
|
"@emotion/styled": "^11.10.6",
|
|
31
|
-
"@riboseinc/paneron-extension-kit": "2.1.
|
|
31
|
+
"@riboseinc/paneron-extension-kit": "2.1.1",
|
|
32
32
|
"@types/node": "^16.11.7",
|
|
33
|
-
"@types/object-hash": "~3.0.2",
|
|
34
33
|
"@types/react": "17.0.53",
|
|
35
34
|
"@types/react-dom": "^17.0.2",
|
|
36
35
|
"@types/react-helmet": "^6.1.2",
|
package/types/views.d.ts
CHANGED
|
@@ -43,6 +43,12 @@ export declare type ItemClassConfigurationSet = {
|
|
|
43
43
|
export interface ExportFormatConfiguration<P extends Payload> {
|
|
44
44
|
/** The name of the export format. */
|
|
45
45
|
label: string;
|
|
46
|
+
/**
|
|
47
|
+
* Trailing part of the filename to save export as;
|
|
48
|
+
* must include at least extension (with separator),
|
|
49
|
+
* must not include any path prefix.
|
|
50
|
+
*/
|
|
51
|
+
filenameExtension: string;
|
|
46
52
|
/**
|
|
47
53
|
* The function that takes register item data and some helper functions
|
|
48
54
|
* and is expected to return a blob.
|
package/types/views.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views.js","sourceRoot":"","sources":["../../src/types/views.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { ButtonProps, MenuItemProps } from '@blueprintjs/core';\nimport type { ObjectDatasetRequest, ObjectDatasetResponse, ValueHook } from '@riboseinc/paneron-extension-kit/types';\nimport type { InternalItemReference, Payload, RegisterItem, RegisterItemClass } from './item';\nimport type { CriteriaGroup } from '../views/FilterCriteria/models';\n\n\n// Hooks\n\n/**\n * Mostly a wrapper around useObjectData, but coerces value type\n * (TODO: validate!) and takes into account change request from any\n * wrapping change request context. If a change request is present,\n * will substitute proposed item data unless `ignoreActiveCR` is set.\n *\n * NOTE: Despite the name, returns the entire RegisterItem,\n * not just the `.data` property with item payload.\n */\nexport type RegisterItemDataHook<P extends Payload = Payload> =\n (opts: { itemPaths: string[], ignoreActiveCR?: true }) => ValueHook<Record<string, RegisterItem<P> | null>>;\n\n\n// Extension configuration\n\n// TODO: Obsolete?\n// export interface ExtensionContext {\n// getRelatedItemClassConfiguration: (classID: string) => RelatedItemClassConfiguration\n// useRegisterItemData: RegisterItemDataHook\n// onJump?: () => void\n// }\n\nexport interface RegisterConfiguration\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>> {\n /**\n * Configuration for all items in this register.\n * This includes items in subregisters.\n */\n itemClassConfiguration: Items\n\n /**\n * Default expression used to sort an item.\n * Passed to useFilteredIndex().\n */\n keyExpression?: string\n\n /** Subregister information. */\n subregisters?: Subregisters<Items>\n}\n\nexport type Subregisters\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>> = {\n [subregisterID: string]: {\n title: string\n\n /** Names of item classes that go in this subregister. */\n itemClasses: (keyof Items)[]\n }\n};\n\nexport type ItemClassConfigurationSet = {\n [itemClassID: string]: ItemClassConfiguration<any>\n};\n\n\n\nexport interface ExportFormatConfiguration<P extends Payload> {\n /** The name of the export format. */\n label: string\n\n /**\n * The function that takes register item data and some helper functions\n * and is expected to return a blob.\n */\n exportItem: (\n itemData: RegisterItem<P>,\n opts: {\n getObjectData: (opts: ObjectDatasetRequest) => Promise<ObjectDatasetResponse>,\n getBlob: (val: string) => Promise<Uint8Array>,\n logger?: { log: Console[\"log\"], error: Console[\"error\"], debug: Console[\"debug\"] },\n },\n ) => Promise<Uint8Array>\n}\n\n\nexport interface ItemClassConfiguration<P extends Payload/*, F extends Field*/> {\n meta: RegisterItemClass\n\n itemCanBeSuperseded?: boolean\n // If false, items of this class cannot be superseded, only retired.\n // Default is true.\n\n defaults?: RegistryItemPayloadDefaults<P>\n // Used to pre-populate item data e.g. when a new item is created.\n\n validatePayload?: (item: P) => Promise<boolean>\n sanitizePayload?: (item: P) => Promise<P>\n\n // XXX: Confirm if obsolete and remove\n itemSorter?: (a: P, b: P) => number\n\n /**\n * Expression used to sort an item of this class.\n * Passed to useFilteredIndex().\n */\n keyExpression?: string\n\n exportFormats?: ExportFormatConfiguration<P>[]\n\n views: {\n listItemView: ItemListView<P>\n editView: ItemEditView<P>\n detailView?: ItemDetailView<P>\n }\n}\n\n\nexport interface RegistryViewProps\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>>\nextends RegisterConfiguration<Items> {\n /**\n * When search is initially opened, have this query pre-defined.\n * Not very useful since there are also preset searches in the browser now.\n */\n // TODO: Obsoluete?\n defaultSearchCriteria?: CriteriaGroup\n\n customViews?: CustomViewConfiguration[]\n}\n\nexport interface CustomViewConfiguration {\n id: string\n label: string\n description: string\n view: React.FC<{\n /** View can support optional path for custom state/inner navigation (provisional). */\n path: string\n }>\n icon?: JSX.Element\n}\n\n\n// Item views\n\nexport interface ItemAction {\n getButtonProps:\n (item: RegisterItem<any>, itemClass: ItemClassConfiguration<any>, subregisterID?: string) =>\n ButtonProps | MenuItemProps\n}\n\nexport type RegistryView = React.FC<RegistryViewProps>\n\ntype RegistryItemPayloadDefaults<P extends Payload> =\n Partial<Omit<P, 'id'>>;\n\n/**\n * A small part of item class configuration,\n * useful e.g. for formatting related items.\n */\nexport type RelatedItemClassConfiguration = {\n title: string\n itemView: ItemListView<any>\n}\n\n\nexport interface RegistryItemViewProps<P extends Payload> {\n /**\n * Item reference.\n * Glossarist, for example, uses it to determine language subregister and set appropriate writing direction.\n */\n itemRef: Omit<InternalItemReference, 'itemID'> & { itemID?: InternalItemReference['itemID'] }\n\n /** Item data (payload). */\n itemData: P\n\n className?: string\n //subregisterID?: string\n\n /** Deprecated */\n useRegisterItemData?: any\n /** Deprecated */\n getRelatedItemClassConfiguration?: any\n}\n\nexport interface GenericRelatedItemViewProps {\n /** Currently selected item’s ref. */\n itemRef?: InternalItemReference\n\n /**\n * By default, clicking the item will spawn a tab via TabbedWorkspace context.\n * This prop can customize that behavior.\n */\n onJump?: () => void\n\n className?: string\n //useRegisterItemData: RegisterItemDataHook\n //getRelatedItemClassConfiguration: ExtensionContext[\"getRelatedItemClassConfiguration\"]\n availableClassIDs?: string[]\n availableSubregisterIDs?: string[]\n\n // XXX: Check if obsolete, remove if unused\n itemSorter?: ItemClassConfiguration<any>[\"itemSorter\"]\n\n /** Called to auto-create an item (can’t auto-create if not provided) */\n onCreateNew?: () => Promise<InternalItemReference>\n\n /** Called when current item is cleared (can’t clear if not provided) */\n onClear?: () => void\n\n /** Called when a new item is selected (can’t change if not provided) */\n onChange?: (newRef: InternalItemReference) => void\n\n /** Deprecated */\n useRegisterItemData?: any\n /** Deprecated */\n getRelatedItemClassConfiguration?: any\n}\n\n\nexport type ItemEditView<P extends Payload> = React.FC<RegistryItemViewProps<P> & {\n onChange?: (newData: P) => void\n onCreateRelatedItem?:\n (classID: string, subregisterID?: string) => Promise<InternalItemReference>\n}>;\n\nexport interface ItemDetailViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n //useRegisterItemData: RegisterItemDataHook\n}\n\nexport type ItemDetailView<P extends Payload> = React.FC<ItemDetailViewProps<P>>;\n\nexport interface ItemListViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n}\n\nexport type ItemListView<P extends Payload> = React.FC<ItemListViewProps<P>>;\n\nexport type LazyItemView = React.FC<{ itemID: string }>;\n"]}
|
|
1
|
+
{"version":3,"file":"views.js","sourceRoot":"","sources":["../../src/types/views.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { ButtonProps, MenuItemProps } from '@blueprintjs/core';\nimport type { ObjectDatasetRequest, ObjectDatasetResponse, ValueHook } from '@riboseinc/paneron-extension-kit/types';\nimport type { InternalItemReference, Payload, RegisterItem, RegisterItemClass } from './item';\nimport type { CriteriaGroup } from '../views/FilterCriteria/models';\n\n\n// Hooks\n\n/**\n * Mostly a wrapper around useObjectData, but coerces value type\n * (TODO: validate!) and takes into account change request from any\n * wrapping change request context. If a change request is present,\n * will substitute proposed item data unless `ignoreActiveCR` is set.\n *\n * NOTE: Despite the name, returns the entire RegisterItem,\n * not just the `.data` property with item payload.\n */\nexport type RegisterItemDataHook<P extends Payload = Payload> =\n (opts: { itemPaths: string[], ignoreActiveCR?: true }) => ValueHook<Record<string, RegisterItem<P> | null>>;\n\n\n// Extension configuration\n\n// TODO: Obsolete?\n// export interface ExtensionContext {\n// getRelatedItemClassConfiguration: (classID: string) => RelatedItemClassConfiguration\n// useRegisterItemData: RegisterItemDataHook\n// onJump?: () => void\n// }\n\nexport interface RegisterConfiguration\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>> {\n /**\n * Configuration for all items in this register.\n * This includes items in subregisters.\n */\n itemClassConfiguration: Items\n\n /**\n * Default expression used to sort an item.\n * Passed to useFilteredIndex().\n */\n keyExpression?: string\n\n /** Subregister information. */\n subregisters?: Subregisters<Items>\n}\n\nexport type Subregisters\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>> = {\n [subregisterID: string]: {\n title: string\n\n /** Names of item classes that go in this subregister. */\n itemClasses: (keyof Items)[]\n }\n};\n\nexport type ItemClassConfigurationSet = {\n [itemClassID: string]: ItemClassConfiguration<any>\n};\n\n\n\nexport interface ExportFormatConfiguration<P extends Payload> {\n /** The name of the export format. */\n label: string\n\n /**\n * Trailing part of the filename to save export as;\n * must include at least extension (with separator),\n * must not include any path prefix.\n */\n filenameExtension: string\n\n /**\n * The function that takes register item data and some helper functions\n * and is expected to return a blob.\n */\n exportItem: (\n itemData: RegisterItem<P>,\n opts: {\n getObjectData: (opts: ObjectDatasetRequest) => Promise<ObjectDatasetResponse>,\n getBlob: (val: string) => Promise<Uint8Array>,\n logger?: { log: Console[\"log\"], error: Console[\"error\"], debug: Console[\"debug\"] },\n },\n ) => Promise<Uint8Array>\n}\n\n\nexport interface ItemClassConfiguration<P extends Payload/*, F extends Field*/> {\n meta: RegisterItemClass\n\n itemCanBeSuperseded?: boolean\n // If false, items of this class cannot be superseded, only retired.\n // Default is true.\n\n defaults?: RegistryItemPayloadDefaults<P>\n // Used to pre-populate item data e.g. when a new item is created.\n\n validatePayload?: (item: P) => Promise<boolean>\n sanitizePayload?: (item: P) => Promise<P>\n\n // XXX: Confirm if obsolete and remove\n itemSorter?: (a: P, b: P) => number\n\n /**\n * Expression used to sort an item of this class.\n * Passed to useFilteredIndex().\n */\n keyExpression?: string\n\n exportFormats?: ExportFormatConfiguration<P>[]\n\n views: {\n listItemView: ItemListView<P>\n editView: ItemEditView<P>\n detailView?: ItemDetailView<P>\n }\n}\n\n\nexport interface RegistryViewProps\n<Items extends ItemClassConfigurationSet = Record<string, ItemClassConfiguration<any>>>\nextends RegisterConfiguration<Items> {\n /**\n * When search is initially opened, have this query pre-defined.\n * Not very useful since there are also preset searches in the browser now.\n */\n // TODO: Obsoluete?\n defaultSearchCriteria?: CriteriaGroup\n\n customViews?: CustomViewConfiguration[]\n}\n\nexport interface CustomViewConfiguration {\n id: string\n label: string\n description: string\n view: React.FC<{\n /** View can support optional path for custom state/inner navigation (provisional). */\n path: string\n }>\n icon?: JSX.Element\n}\n\n\n// Item views\n\nexport interface ItemAction {\n getButtonProps:\n (item: RegisterItem<any>, itemClass: ItemClassConfiguration<any>, subregisterID?: string) =>\n ButtonProps | MenuItemProps\n}\n\nexport type RegistryView = React.FC<RegistryViewProps>\n\ntype RegistryItemPayloadDefaults<P extends Payload> =\n Partial<Omit<P, 'id'>>;\n\n/**\n * A small part of item class configuration,\n * useful e.g. for formatting related items.\n */\nexport type RelatedItemClassConfiguration = {\n title: string\n itemView: ItemListView<any>\n}\n\n\nexport interface RegistryItemViewProps<P extends Payload> {\n /**\n * Item reference.\n * Glossarist, for example, uses it to determine language subregister and set appropriate writing direction.\n */\n itemRef: Omit<InternalItemReference, 'itemID'> & { itemID?: InternalItemReference['itemID'] }\n\n /** Item data (payload). */\n itemData: P\n\n className?: string\n //subregisterID?: string\n\n /** Deprecated */\n useRegisterItemData?: any\n /** Deprecated */\n getRelatedItemClassConfiguration?: any\n}\n\nexport interface GenericRelatedItemViewProps {\n /** Currently selected item’s ref. */\n itemRef?: InternalItemReference\n\n /**\n * By default, clicking the item will spawn a tab via TabbedWorkspace context.\n * This prop can customize that behavior.\n */\n onJump?: () => void\n\n className?: string\n //useRegisterItemData: RegisterItemDataHook\n //getRelatedItemClassConfiguration: ExtensionContext[\"getRelatedItemClassConfiguration\"]\n availableClassIDs?: string[]\n availableSubregisterIDs?: string[]\n\n // XXX: Check if obsolete, remove if unused\n itemSorter?: ItemClassConfiguration<any>[\"itemSorter\"]\n\n /** Called to auto-create an item (can’t auto-create if not provided) */\n onCreateNew?: () => Promise<InternalItemReference>\n\n /** Called when current item is cleared (can’t clear if not provided) */\n onClear?: () => void\n\n /** Called when a new item is selected (can’t change if not provided) */\n onChange?: (newRef: InternalItemReference) => void\n\n /** Deprecated */\n useRegisterItemData?: any\n /** Deprecated */\n getRelatedItemClassConfiguration?: any\n}\n\n\nexport type ItemEditView<P extends Payload> = React.FC<RegistryItemViewProps<P> & {\n onChange?: (newData: P) => void\n onCreateRelatedItem?:\n (classID: string, subregisterID?: string) => Promise<InternalItemReference>\n}>;\n\nexport interface ItemDetailViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n //useRegisterItemData: RegisterItemDataHook\n}\n\nexport type ItemDetailView<P extends Payload> = React.FC<ItemDetailViewProps<P>>;\n\nexport interface ItemListViewProps<P extends Payload> extends RegistryItemViewProps<P> {\n}\n\nexport type ItemListView<P extends Payload> = React.FC<ItemListViewProps<P>>;\n\nexport type LazyItemView = React.FC<{ itemID: string }>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangeProposalContext.js","sourceRoot":"","sources":["../../../src/views/change-request/ChangeProposalContext.tsx"],"names":[],"mappings":";AACA;;GAEG","sourcesContent":["\n/**\n * Context pertaining to given register item changes within active proposal, if any.\n */\n"]}
|
|
@@ -76,7 +76,7 @@ const Proposals = function ({
|
|
|
76
76
|
|
|
77
77
|
(0, _react.useEffect)(() => {
|
|
78
78
|
if (firstProposal && (_selectedProposal === null || !proposals[_selectedProposal])) {
|
|
79
|
-
selectProposal(firstProposal);
|
|
79
|
+
selectProposal(firstProposal !== null && firstProposal !== void 0 ? firstProposal : null);
|
|
80
80
|
}
|
|
81
81
|
}, [firstProposal, _selectedProposal, JSON.stringify(proposals)]);
|
|
82
82
|
const selectedItemRef = selectedProposal ? (0, _itemPathUtils.itemPathToItemRef)(subregisters !== undefined, selectedProposal) : null; // Data for proposed items
|
|
@@ -113,7 +113,7 @@ const Proposals = function ({
|
|
|
113
113
|
const selectedItemProposedData = getProposedItemData(selectedProposal);
|
|
114
114
|
|
|
115
115
|
if (selectedProposal && selectedItemRef && proposals[selectedProposal] && !currentItemDataReq.isUpdating && !proposedItemDataReq.isUpdating) {
|
|
116
|
-
if (selectedItemCurrentData || selectedItemProposedData) {
|
|
116
|
+
if (selectedItemCurrentData || selectedItemProposedData || true) {
|
|
117
117
|
const selectedItemSummary = (0, _react2.jsx)(ProposalSummary, {
|
|
118
118
|
itemRef: selectedItemRef,
|
|
119
119
|
itemData: selectedItemProposedData !== null && selectedItemProposedData !== void 0 ? selectedItemProposedData : selectedItemCurrentData,
|
|
@@ -197,7 +197,13 @@ const Proposals = function ({
|
|
|
197
197
|
title: "Unable to retrieve proposed item data",
|
|
198
198
|
description: (0, _react2.jsx)("div", {
|
|
199
199
|
css: (0, _react2.css)`text-align: left;`
|
|
200
|
-
}, "
|
|
200
|
+
}, "Attempted to retrieve data for ", (0, _react2.jsx)("code", null, selectedProposal), ", but failed.", (0, _react2.jsx)("br", null), "Perhaps selected item was removed, or there is a data integrity issue.", (0, _react2.jsx)("br", null), "This might be caused by a problem in the application, or repository contents having been edited outside of the application.", (0, _react2.jsx)("br", null), "The data should be recoverable by inspecting version control system commit history.", (0, _react2.jsx)("br", null), (0, _react2.jsx)("br", null), (0, _react2.jsx)(_core.ButtonGroup, null, (0, _react2.jsx)(_core.Button, {
|
|
201
|
+
onClick: () => selectProposal(firstProposal !== null && firstProposal !== void 0 ? firstProposal : null)
|
|
202
|
+
}, firstProposal ? "Go to first proposed item" : "Unselect proposal"), (0, _react2.jsx)(_core.Button, {
|
|
203
|
+
intent: "danger",
|
|
204
|
+
onClick: () => selectProposal(firstProposal !== null && firstProposal !== void 0 ? firstProposal : null),
|
|
205
|
+
title: "This should help if there\u2019s an addition or clarification proposal with missing proposed item data. NOTE: It removes the proposal, so you may need to create it again."
|
|
206
|
+
}, "Delete phantom proposal item")))
|
|
201
207
|
});
|
|
202
208
|
}
|
|
203
209
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Proposals.js","sourceRoot":"","sources":["../../../src/views/change-request/Proposals.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAA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AEH;IACH,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,yCAAiB;CAChE,CAAA;AAGD,MAAM,uBAAuB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;;;CAGrD,CAAC;AAQF,MAAM,cAAc,GAAmE;IACrF,aAAa;IACb,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,YAAY;CACb,CAAC;AAGF,SAAS,eAAe,CAAC,QAAwB;IAC/C,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU;QAC/B,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,eAAe;YACjC,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,YAAY,CAAA;AACtB,CAAC;AAGD,eAAe,SAAS,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext, useEffect, useState, useCallback } from 'react';\nimport { ClassNames, jsx, css } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport {\n ControlGroup,\n ButtonGroup,\n Switch,\n Button,\n Classes,\n MenuItem,\n NonIdealState,\n IconName,\n} from '@blueprintjs/core';\nimport { ItemRenderer, Select2 as Select } from '@blueprintjs/select';\nimport HelpTooltip from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';\nimport type {\n Addition,\n ChangeProposal,\n Clarification,\n InternalItemReference,\n Retirement,\n Supersession,\n Invalidation,\n Payload,\n} from '../../types';\nimport type { Drafted } from '../../types/cr';\nimport { Protocols, type Protocol } from '../protocolRegistry';\nimport { PROPOSAL_TYPES, AMENDMENT_TYPES } from '../../types/proposal';\nimport { BrowserCtx, type BrowserCtx as BrowserCtxType } from '../BrowserCtx';\nimport { itemPathToItemRef, itemRefToItemPath } from '../itemPathUtils';\nimport StructuredDiff from '../diffing/StructuredDiff';\nimport registerItemDetailView from '../detail/RegisterItem';\n\n\ninterface ChangeProposalItem {\n itemPath: string\n itemRef: InternalItemReference\n proposal: ChangeProposal\n itemData: Payload\n itemDataBefore: Payload | undefined\n}\n\n\nconst Proposals: React.FC<{\n proposals: Drafted['items']\n className?: string\n}> = function ({ proposals, className }) {\n const [ _selectedProposal, selectProposal ] = useState<string | null>(null);\n const [ showDiff, setShowDiff ] = useState(false);\n const [ showOnlyChanged, setShowOnlyChanged ] = useState(true);\n\n const outerBrowserCtx = useContext(BrowserCtx);\n const { jumpTo, subregisters, useRegisterItemData } = outerBrowserCtx;\n\n /**\n * When jumping to an item affected by current CR,\n * jump in-CR instead of spawning tab.\n */\n const handleCRJump = useCallback(function _handleCRJump(uri: `${Protocol}:${string}`): void {\n if (uri.startsWith(Protocols.ITEM_DETAILS)) {\n const itemPath = uri.split(':')[1];\n if (proposals[itemPath]) {\n selectProposal(itemPath);\n } else {\n jumpTo?.(uri);\n }\n }\n }, [Object.keys(proposals), jumpTo]);\n\n const proposalBrowserCtx: BrowserCtxType = {\n ...outerBrowserCtx,\n jumpTo: handleCRJump,\n };\n\n const firstProposal: string | undefined = Object.keys(proposals)[0];\n\n // Effective selected proposal\n const selectedProposal: string | undefined =\n ((_selectedProposal && proposals[_selectedProposal]) ? _selectedProposal : null)\n ?? firstProposal\n ?? undefined;\n\n // Force select available proposal\n useEffect(() => {\n if (firstProposal && (_selectedProposal === null || !proposals[_selectedProposal])) {\n selectProposal(firstProposal);\n }\n }, [firstProposal, _selectedProposal, JSON.stringify(proposals)]);\n\n const selectedItemRef = selectedProposal\n ? itemPathToItemRef(subregisters !== undefined, selectedProposal)\n : null;\n\n\n // Data for proposed items\n const proposedItemPaths = Object.entries(proposals).map(([itemPath, proposal]) => {\n if (proposal.type === 'clarification' || proposal.type === 'addition') {\n return itemPath;\n } else {\n return undefined;\n }\n }).filter(s => s !== undefined) as string[];\n const proposedItemDataReq = useRegisterItemData({\n itemPaths: proposedItemPaths,\n });\n\n // Data for pre-existing items\n const currentItemDataReq = useRegisterItemData({\n itemPaths: Object.keys(proposals),\n ignoreActiveCR: true,\n });\n\n const getCurrentItemData = (itemPath: string) => currentItemDataReq.value[itemPath]?.data ?? null;\n const getProposedItemData = (itemPath: string) => proposedItemDataReq.value[itemPath]?.data ?? null;\n\n const selectedItemCurrentData = getCurrentItemData(selectedProposal);\n const selectedItemProposedData = getProposedItemData(selectedProposal);\n\n if (\n selectedProposal\n && selectedItemRef\n && proposals[selectedProposal]\n && !currentItemDataReq.isUpdating\n && !proposedItemDataReq.isUpdating\n ) {\n if (selectedItemCurrentData || selectedItemProposedData) {\n const selectedItemSummary = <ProposalSummary\n itemRef={selectedItemRef}\n itemData={(selectedItemProposedData ?? selectedItemCurrentData)!}\n itemDataBefore={selectedItemCurrentData ?? undefined}\n proposal={proposals[selectedProposal]}\n />\n\n return (\n <div css={css`display: flex; flex-flow: column nowrap;`} className={className}>\n <div>\n <ControlGroup>\n <Switch\n checked={showDiff}\n onChange={evt => setShowDiff(evt.currentTarget.checked)}\n label=\"View source\"\n css={css`margin-right: 1em !important`}\n />\n <Switch\n checked={showDiff && showOnlyChanged}\n disabled={!showDiff}\n onChange={evt => setShowOnlyChanged(evt.currentTarget.checked)}\n label=\"Show clarified properties only\"\n />\n </ControlGroup>\n <ButtonGroup>\n <Button\n disabled={!jumpTo || proposals[selectedProposal]?.type === 'addition'}\n icon='locate'\n onClick={() => jumpTo?.(`${Protocols.ITEM_DETAILS}:${selectedProposal}`)}\n title=\"Open selected item in a new tab (not applicable to proposed additions)\">\n Reveal in registry\n </Button>\n {Object.keys(proposals).length > 1\n ? <ClassNames>\n {(({ css: css2 }) =>\n <Select<ChangeProposalItem>\n filterable={false}\n itemsEqual={(i1, i2) => JSON.stringify(i1) === JSON.stringify(i2)}\n menuProps={{ className: css2(`height: 50vh; overflow-y: auto;`) }}\n activeItem={{\n itemPath: selectedProposal,\n proposal: proposals[selectedProposal],\n itemData: (selectedItemProposedData ?? selectedItemCurrentData)!,\n itemDataBefore: selectedItemCurrentData ?? undefined,\n itemRef: itemPathToItemRef(subregisters !== undefined, selectedProposal),\n }} // TODO: First time selection is broken\n items={\n Object.entries(proposals).map(([itemPath, proposal]) => ({\n itemPath,\n proposal,\n itemData: (getProposedItemData(itemPath) ?? getCurrentItemData(itemPath))! ?? null,\n itemDataBefore: undefined,\n itemRef: itemPathToItemRef(subregisters !== undefined, itemPath),\n })).filter(item => item.itemData !== null)}\n popoverProps={{ minimal: true }}\n fill\n itemRenderer={ChangeProposalItemView}\n onItemSelect={(item) => selectProposal(item.itemPath)}>\n <Button rightIcon=\"chevron-down\" icon={getProposalIcon(proposals[selectedProposal])}>\n {selectedItemSummary}\n </Button>\n </Select>\n )}\n </ClassNames>\n : <Button\n fill\n alignText=\"left\"\n icon={getProposalIcon(proposals[selectedProposal])}\n rightIcon=\"chevron-down\">\n {selectedItemSummary}\n </Button>}\n </ButtonGroup>\n </div>\n <div css={css`position: relative; flex: 1;`}>\n <BrowserCtx.Provider value={proposalBrowserCtx}>\n <ProposalDetail\n itemRef={selectedItemRef}\n showDiff={showDiff}\n showOnlyChanged={showOnlyChanged}\n itemData={(selectedItemProposedData ?? selectedItemCurrentData)!}\n itemDataBefore={selectedItemCurrentData ?? undefined}\n proposal={proposals[selectedProposal]}\n />\n </BrowserCtx.Provider>\n </div>\n </div>\n );\n } else {\n return <NonIdealState\n icon='warning-sign'\n className={className}\n title=\"Unable to retrieve proposed item data\"\n description={<div css={css`text-align: left;`}>\n There appears to be a data integrity issue.\n <br />\n This might be caused by a problem in the application, or repository contents having been edited outside of the application.\n <br />\n The data should be recoverable by inspecting version control system commit history.\n </div>}\n />;\n }\n } else {\n return <NonIdealState\n icon='clean'\n className={className}\n title=\"Nothing is proposed here yet.\"\n />;\n }\n};\n\n\nconst ChangeProposalItemView: ItemRenderer<ChangeProposalItem> =\n(item, { handleClick, modifiers, query }) => {\n const proposalConfig = \n item.proposal.type === 'amendment'\n ? PROPOSAL_VIEWS[item.proposal.amendmentType]\n : PROPOSAL_VIEWS[item.proposal.type];\n const ProposalTypeLabel: React.FC<ProposalProps<any>> = proposalConfig.summary;\n return (\n <MenuItem\n active={modifiers.active}\n disabled={modifiers.disabled}\n labelElement={<>\n <ProposalTypeLabel {...item} />\n {\" \"}\n <HelpTooltip content={<>Proposed to be {proposalConfig.hint}</>} />\n </>}\n key={item.itemPath}\n onClick={handleClick}\n icon={getProposalIcon(item.proposal)}\n text={<ProposalSummary {...item} />} />\n );\n}\n\n\ninterface ProposalProps<P extends ChangeProposal> {\n proposal: P\n showDiff?: boolean\n showOnlyChanged?: boolean\n itemRef: InternalItemReference\n itemData: Payload\n itemDataBefore: P extends Clarification ? Payload : undefined\n onChange?: (newProposal: P) => void\n}\nexport const ProposalDetail: React.FC<ProposalProps<ChangeProposal>> =\nfunction ({ proposal, showDiff, showOnlyChanged, itemRef, itemData, itemDataBefore, onChange }) {\n const ItemView = registerItemDetailView.main;\n\n const view: JSX.Element = showDiff\n ? <MaximizedStructuredDiff\n item1={itemDataBefore ?? {}}\n item2={itemData}\n showUnchanged={!showOnlyChanged}\n css={css`background: white; border-radius: 2.5px; padding: 10px 0; margin: 10px 0;`}\n className={Classes.ELEVATION_2}\n />\n : <ItemView uri={itemRefToItemPath(itemRef)} key={JSON.stringify(itemRef)} />\n\n return <div css={css`position: absolute; inset: 0; display: flex; flex-flow: column;`}>\n {view}\n </div>;\n};\nexport const ProposalSummary: React.FC<ProposalProps<ChangeProposal>> =\nfunction ({ proposal, itemRef, itemData, itemDataBefore, onChange }) {\n const { itemClasses } = useContext(BrowserCtx);\n const { classID } = itemRef;\n const ListItemView = itemClasses[classID].views.listItemView;\n\n return <ListItemView\n itemRef={itemRef}\n itemData={itemData}\n />;\n};\n\n\ninterface ProposalViewConfig<P extends ChangeProposal> {\n summary: React.FC<ProposalProps<P>>\n hint: JSX.Element | string\n}\n\n\nconst clarification: ProposalViewConfig<Clarification> = {\n hint: <>\n altered to represent the same concept more clearly.\n </>,\n summary: ({ proposal, itemData, itemRef }) => <>Clarification</>,\n};\n\n\nconst addition: ProposalViewConfig<Addition> = {\n hint: <>added to this register.</>,\n summary: ({ proposal, itemData, itemRef }) => <>Addition</>,\n};\n\n\nconst retirement: ProposalViewConfig<Retirement> = {\n hint: <>\n marked as no longer current.\n (Note that this register is append-only, so the item cannot be removed altogether.)\n </>,\n summary: ({ proposal, itemRef, itemData }) => <>Retirement</>,\n};\n\n\nconst supersession: ProposalViewConfig<Supersession> = {\n hint: <>\n removed from the register with another item recommended for use in its place.\n A relation between the superseding and superseded item will be created,\n though the exact semantics of that relation depend on the register.\n </>,\n summary: ({ proposal, itemRef, itemData }) => <>Supersession</>,\n};\n\n\nconst invalidation: ProposalViewConfig<Invalidation> = {\n hint: <>\n marked as invalid. The exact semantics of invalidation depend on the register.\n </>,\n summary: ({ proposal, itemRef, itemData }) => <>Invalidation</>,\n}\n\n\nconst MaximizedStructuredDiff = styled(StructuredDiff)`\n position: absolute;\n inset: 0;\n`;\n\n\ntype ProposalOrAmendmentType =\n | Exclude<typeof PROPOSAL_TYPES[number], 'amendment'>\n | typeof AMENDMENT_TYPES[number];\n\n\nconst PROPOSAL_VIEWS: { [type in ProposalOrAmendmentType]: ProposalViewConfig<any> } = {\n clarification,\n addition,\n retirement,\n supersession,\n invalidation,\n};\n\n\nfunction getProposalIcon(proposal: ChangeProposal): IconName {\n return proposal.type === 'addition'\n ? 'add'\n : proposal.type === 'clarification'\n ? 'edit'\n : 'ban-circle'\n}\n\n\nexport default Proposals;\n"]}
|
|
1
|
+
{"version":3,"file":"Proposals.js","sourceRoot":"","sources":["../../../src/views/change-request/Proposals.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,WAAW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AE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,uCAAe;CAC9D,CAAC;AAGF,MAAM,YAAY,GAAqC;IACrD,IAAI,EAAE,sPAIH;IACH,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,yCAAiB;CAChE,CAAC;AAGF,MAAM,YAAY,GAAqC;IACrD,IAAI,EAAE,2GAEH;IACH,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,yCAAiB;CAChE,CAAA;AAGD,MAAM,uBAAuB,GAAG,MAAM,CAAC,cAAc,CAAC,CAAA;;;CAGrD,CAAC;AAQF,MAAM,cAAc,GAAmE;IACrF,aAAa;IACb,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,YAAY;CACb,CAAC;AAGF,SAAS,eAAe,CAAC,QAAwB;IAC/C,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU;QAC/B,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,eAAe;YACjC,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,YAAY,CAAA;AACtB,CAAC;AAGD,eAAe,SAAS,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext, useEffect, useState, useCallback } from 'react';\nimport { ClassNames, jsx, css } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport {\n ControlGroup,\n ButtonGroup,\n Switch,\n Button,\n Classes,\n MenuItem,\n NonIdealState,\n IconName,\n} from '@blueprintjs/core';\nimport { ItemRenderer, Select2 as Select } from '@blueprintjs/select';\nimport HelpTooltip from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';\nimport type {\n Addition,\n ChangeProposal,\n Clarification,\n InternalItemReference,\n Retirement,\n Supersession,\n Invalidation,\n Payload,\n} from '../../types';\nimport type { Drafted } from '../../types/cr';\nimport { Protocols, type Protocol } from '../protocolRegistry';\nimport { PROPOSAL_TYPES, AMENDMENT_TYPES } from '../../types/proposal';\nimport { BrowserCtx, type BrowserCtx as BrowserCtxType } from '../BrowserCtx';\nimport { itemPathToItemRef, itemRefToItemPath } from '../itemPathUtils';\nimport StructuredDiff from '../diffing/StructuredDiff';\nimport registerItemDetailView from '../detail/RegisterItem';\n\n\ninterface ChangeProposalItem {\n itemPath: string\n itemRef: InternalItemReference\n proposal: ChangeProposal\n itemData: Payload\n itemDataBefore: Payload | undefined\n}\n\n\nconst Proposals: React.FC<{\n proposals: Drafted['items']\n className?: string\n}> = function ({ proposals, className }) {\n const [ _selectedProposal, selectProposal ] = useState<string | null>(null);\n const [ showDiff, setShowDiff ] = useState(false);\n const [ showOnlyChanged, setShowOnlyChanged ] = useState(true);\n\n const outerBrowserCtx = useContext(BrowserCtx);\n const { jumpTo, subregisters, useRegisterItemData } = outerBrowserCtx;\n\n /**\n * When jumping to an item affected by current CR,\n * jump in-CR instead of spawning tab.\n */\n const handleCRJump = useCallback(function _handleCRJump(uri: `${Protocol}:${string}`): void {\n if (uri.startsWith(Protocols.ITEM_DETAILS)) {\n const itemPath = uri.split(':')[1];\n if (proposals[itemPath]) {\n selectProposal(itemPath);\n } else {\n jumpTo?.(uri);\n }\n }\n }, [Object.keys(proposals), jumpTo]);\n\n const proposalBrowserCtx: BrowserCtxType = {\n ...outerBrowserCtx,\n jumpTo: handleCRJump,\n };\n\n const firstProposal: string | undefined = Object.keys(proposals)[0];\n\n // Effective selected proposal\n const selectedProposal: string | undefined =\n ((_selectedProposal && proposals[_selectedProposal]) ? _selectedProposal : null)\n ?? firstProposal\n ?? undefined;\n\n // Force select available proposal\n useEffect(() => {\n if (firstProposal && (_selectedProposal === null || !proposals[_selectedProposal])) {\n selectProposal(firstProposal ?? null);\n }\n }, [firstProposal, _selectedProposal, JSON.stringify(proposals)]);\n\n const selectedItemRef = selectedProposal\n ? itemPathToItemRef(subregisters !== undefined, selectedProposal)\n : null;\n\n\n // Data for proposed items\n const proposedItemPaths = Object.entries(proposals).map(([itemPath, proposal]) => {\n if (proposal.type === 'clarification' || proposal.type === 'addition') {\n return itemPath;\n } else {\n return undefined;\n }\n }).filter(s => s !== undefined) as string[];\n const proposedItemDataReq = useRegisterItemData({\n itemPaths: proposedItemPaths,\n });\n\n // Data for pre-existing items\n const currentItemDataReq = useRegisterItemData({\n itemPaths: Object.keys(proposals),\n ignoreActiveCR: true,\n });\n\n const getCurrentItemData = (itemPath: string) => currentItemDataReq.value[itemPath]?.data ?? null;\n const getProposedItemData = (itemPath: string) => proposedItemDataReq.value[itemPath]?.data ?? null;\n\n const selectedItemCurrentData = getCurrentItemData(selectedProposal);\n const selectedItemProposedData = getProposedItemData(selectedProposal);\n\n if (\n selectedProposal\n && selectedItemRef\n && proposals[selectedProposal]\n && !currentItemDataReq.isUpdating\n && !proposedItemDataReq.isUpdating\n ) {\n if (selectedItemCurrentData || selectedItemProposedData || true) {\n const selectedItemSummary = <ProposalSummary\n itemRef={selectedItemRef}\n itemData={(selectedItemProposedData ?? selectedItemCurrentData)!}\n itemDataBefore={selectedItemCurrentData ?? undefined}\n proposal={proposals[selectedProposal]}\n />\n\n return (\n <div css={css`display: flex; flex-flow: column nowrap;`} className={className}>\n <div>\n <ControlGroup>\n <Switch\n checked={showDiff}\n onChange={evt => setShowDiff(evt.currentTarget.checked)}\n label=\"View source\"\n css={css`margin-right: 1em !important`}\n />\n <Switch\n checked={showDiff && showOnlyChanged}\n disabled={!showDiff}\n onChange={evt => setShowOnlyChanged(evt.currentTarget.checked)}\n label=\"Show clarified properties only\"\n />\n </ControlGroup>\n <ButtonGroup>\n <Button\n disabled={!jumpTo || proposals[selectedProposal]?.type === 'addition'}\n icon='locate'\n onClick={() => jumpTo?.(`${Protocols.ITEM_DETAILS}:${selectedProposal}`)}\n title=\"Open selected item in a new tab (not applicable to proposed additions)\">\n Reveal in registry\n </Button>\n {Object.keys(proposals).length > 1\n ? <ClassNames>\n {(({ css: css2 }) =>\n <Select<ChangeProposalItem>\n filterable={false}\n itemsEqual={(i1, i2) => JSON.stringify(i1) === JSON.stringify(i2)}\n menuProps={{ className: css2(`height: 50vh; overflow-y: auto;`) }}\n activeItem={{\n itemPath: selectedProposal,\n proposal: proposals[selectedProposal],\n itemData: (selectedItemProposedData ?? selectedItemCurrentData)!,\n itemDataBefore: selectedItemCurrentData ?? undefined,\n itemRef: itemPathToItemRef(subregisters !== undefined, selectedProposal),\n }} // TODO: First time selection is broken\n items={\n Object.entries(proposals).map(([itemPath, proposal]) => ({\n itemPath,\n proposal,\n itemData: (getProposedItemData(itemPath) ?? getCurrentItemData(itemPath))! ?? null,\n itemDataBefore: undefined,\n itemRef: itemPathToItemRef(subregisters !== undefined, itemPath),\n })).filter(item => item.itemData !== null)}\n popoverProps={{ minimal: true }}\n fill\n itemRenderer={ChangeProposalItemView}\n onItemSelect={(item) => selectProposal(item.itemPath)}>\n <Button rightIcon=\"chevron-down\" icon={getProposalIcon(proposals[selectedProposal])}>\n {selectedItemSummary}\n </Button>\n </Select>\n )}\n </ClassNames>\n : <Button\n fill\n alignText=\"left\"\n icon={getProposalIcon(proposals[selectedProposal])}\n rightIcon=\"chevron-down\">\n {selectedItemSummary}\n </Button>}\n </ButtonGroup>\n </div>\n <div css={css`position: relative; flex: 1;`}>\n <BrowserCtx.Provider value={proposalBrowserCtx}>\n <ProposalDetail\n itemRef={selectedItemRef}\n showDiff={showDiff}\n showOnlyChanged={showOnlyChanged}\n itemData={(selectedItemProposedData ?? selectedItemCurrentData)!}\n itemDataBefore={selectedItemCurrentData ?? undefined}\n proposal={proposals[selectedProposal]}\n />\n </BrowserCtx.Provider>\n </div>\n </div>\n );\n } else {\n return <NonIdealState\n icon='warning-sign'\n className={className}\n title=\"Unable to retrieve proposed item data\"\n description={<div css={css`text-align: left;`}>\n Attempted to retrieve data for <code>{selectedProposal}</code>,\n but failed.\n <br />\n Perhaps selected item was removed, or there is a data integrity issue.\n <br />\n This might be caused by a problem in the application, or repository contents having been edited outside of the application.\n <br />\n The data should be recoverable by inspecting version control system commit history.\n <br />\n <br />\n <ButtonGroup>\n <Button onClick={() => selectProposal(firstProposal ?? null)}>\n {firstProposal\n ? \"Go to first proposed item\"\n : \"Unselect proposal\"}\n </Button>\n <Button\n intent=\"danger\"\n onClick={() => selectProposal(firstProposal ?? null)}\n title=\"This should help if there’s an addition or clarification proposal with missing proposed item data. NOTE: It removes the proposal, so you may need to create it again.\">\n Delete phantom proposal item\n </Button>\n </ButtonGroup>\n </div>}\n />;\n }\n } else {\n return <NonIdealState\n icon='clean'\n className={className}\n title=\"Nothing is proposed here yet.\"\n />;\n }\n};\n\n\nconst ChangeProposalItemView: ItemRenderer<ChangeProposalItem> =\n(item, { handleClick, modifiers, query }) => {\n const proposalConfig = \n item.proposal.type === 'amendment'\n ? PROPOSAL_VIEWS[item.proposal.amendmentType]\n : PROPOSAL_VIEWS[item.proposal.type];\n const ProposalTypeLabel: React.FC<ProposalProps<any>> = proposalConfig.summary;\n return (\n <MenuItem\n active={modifiers.active}\n disabled={modifiers.disabled}\n labelElement={<>\n <ProposalTypeLabel {...item} />\n {\" \"}\n <HelpTooltip content={<>Proposed to be {proposalConfig.hint}</>} />\n </>}\n key={item.itemPath}\n onClick={handleClick}\n icon={getProposalIcon(item.proposal)}\n text={<ProposalSummary {...item} />} />\n );\n}\n\n\ninterface ProposalProps<P extends ChangeProposal> {\n proposal: P\n showDiff?: boolean\n showOnlyChanged?: boolean\n itemRef: InternalItemReference\n itemData: Payload\n itemDataBefore: P extends Clarification ? Payload : undefined\n onChange?: (newProposal: P) => void\n}\nexport const ProposalDetail: React.FC<ProposalProps<ChangeProposal>> =\nfunction ({ proposal, showDiff, showOnlyChanged, itemRef, itemData, itemDataBefore, onChange }) {\n const ItemView = registerItemDetailView.main;\n\n const view: JSX.Element = showDiff\n ? <MaximizedStructuredDiff\n item1={itemDataBefore ?? {}}\n item2={itemData}\n showUnchanged={!showOnlyChanged}\n css={css`background: white; border-radius: 2.5px; padding: 10px 0; margin: 10px 0;`}\n className={Classes.ELEVATION_2}\n />\n : <ItemView uri={itemRefToItemPath(itemRef)} key={JSON.stringify(itemRef)} />\n\n return <div css={css`position: absolute; inset: 0; display: flex; flex-flow: column;`}>\n {view}\n </div>;\n};\nexport const ProposalSummary: React.FC<ProposalProps<ChangeProposal>> =\nfunction ({ proposal, itemRef, itemData, itemDataBefore, onChange }) {\n const { itemClasses } = useContext(BrowserCtx);\n const { classID } = itemRef;\n const ListItemView = itemClasses[classID].views.listItemView;\n\n return <ListItemView\n itemRef={itemRef}\n itemData={itemData}\n />;\n};\n\n\ninterface ProposalViewConfig<P extends ChangeProposal> {\n summary: React.FC<ProposalProps<P>>\n hint: JSX.Element | string\n}\n\n\nconst clarification: ProposalViewConfig<Clarification> = {\n hint: <>\n altered to represent the same concept more clearly.\n </>,\n summary: ({ proposal, itemData, itemRef }) => <>Clarification</>,\n};\n\n\nconst addition: ProposalViewConfig<Addition> = {\n hint: <>added to this register.</>,\n summary: ({ proposal, itemData, itemRef }) => <>Addition</>,\n};\n\n\nconst retirement: ProposalViewConfig<Retirement> = {\n hint: <>\n marked as no longer current.\n (Note that this register is append-only, so the item cannot be removed altogether.)\n </>,\n summary: ({ proposal, itemRef, itemData }) => <>Retirement</>,\n};\n\n\nconst supersession: ProposalViewConfig<Supersession> = {\n hint: <>\n removed from the register with another item recommended for use in its place.\n A relation between the superseding and superseded item will be created,\n though the exact semantics of that relation depend on the register.\n </>,\n summary: ({ proposal, itemRef, itemData }) => <>Supersession</>,\n};\n\n\nconst invalidation: ProposalViewConfig<Invalidation> = {\n hint: <>\n marked as invalid. The exact semantics of invalidation depend on the register.\n </>,\n summary: ({ proposal, itemRef, itemData }) => <>Invalidation</>,\n}\n\n\nconst MaximizedStructuredDiff = styled(StructuredDiff)`\n position: absolute;\n inset: 0;\n`;\n\n\ntype ProposalOrAmendmentType =\n | Exclude<typeof PROPOSAL_TYPES[number], 'amendment'>\n | typeof AMENDMENT_TYPES[number];\n\n\nconst PROPOSAL_VIEWS: { [type in ProposalOrAmendmentType]: ProposalViewConfig<any> } = {\n clarification,\n addition,\n retirement,\n supersession,\n invalidation,\n};\n\n\nfunction getProposalIcon(proposal: ChangeProposal): IconName {\n return proposal.type === 'addition'\n ? 'add'\n : proposal.type === 'clarification'\n ? 'edit'\n : 'ban-circle'\n}\n\n\nexport default Proposals;\n"]}
|
|
@@ -147,8 +147,7 @@ const ChangeRequestDetails = function ({
|
|
|
147
147
|
icon: "clean",
|
|
148
148
|
title: "Nothing is proposed here yet.",
|
|
149
149
|
description: authorIsCurrentUser && updateTree && !cr.timeProposed && !isActive ? (0, _react2.jsx)(_core.Button, {
|
|
150
|
-
onClick: performOperation('deleting proposal', handleDelete)
|
|
151
|
-
intent: "danger"
|
|
150
|
+
onClick: performOperation('deleting proposal', handleDelete)
|
|
152
151
|
}, "Delete this CR draft") : undefined
|
|
153
152
|
})), (0, _react2.jsx)(_core.Card, {
|
|
154
153
|
elevation: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/detail/ChangeRequest/index.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,MAAM,EACN,IAAI,EACJ,SAAS,EACT,MAAM,EACN,aAAa,EACb,OAAO,EACP,EAAE,EACF,EAAE,EACF,GAAG,EACH,OAAO,EACP,OAAO,GACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kEAAkE,CAAC;AAC1G,OAAO,EAAE,UAAU,EA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AAI,uBAAuB,CACrC,CAAC;AAChB,CAAC,CAAC;AAGF,MAAM,OAAO,GAA8B,UAAU,EAAE,GAAG,EAAE;;IAC1D,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,MAAA,MAAA,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,0CAAG,GAAG,CAAC,0CAAE,aAAa,CAAC;IAC7F,OAAO;;QAAa,oBAAoB,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,GAAG,CAAC;iBAAK,CAAC;AACtE,CAAC,CAAA;AAED,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE,CAAC,YAAY,GAAG,EAAE,EAAE,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext } from 'react';\nimport { jsx, css } from '@emotion/react';\nimport {\n Button,\n Card,\n FormGroup,\n Colors,\n NonIdealState,\n Spinner,\n H5,\n UL,\n Tag,\n Divider,\n Classes,\n} from '@blueprintjs/core';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport HelpTooltip from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';\nimport { TabbedWorkspaceContext } from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace/context';\nimport { BrowserCtx } from '../../BrowserCtx';\nimport { crPathToCRID, crIDToCRPath } from '../../itemPathUtils';\nimport {\n ChangeRequestContextProvider,\n ChangeRequestContext,\n} from '../../change-request/ChangeRequestContext';\nimport Proposals from '../../change-request/Proposals';\nimport { Proposed, hadBeenProposed, isDisposed } from '../../../types/cr';\nimport { RegisterStakeholderListItem } from '../../RegisterStakeholder';\nimport { Protocols } from '../../protocolRegistry';\nimport {\n TabContentsWithActions,\n RegisterHelmet as Helmet,\n maybeEllipsizeString,\n Datestamp,\n} from '../../util';\nimport { TransitionOptions, getPastTransitions, getTransitions } from './transitions';\n\n\nconst View: React.FC<{ uri: string }> = function ({ uri }) {\n const crID = crPathToCRID(uri);\n const { closeTabWithURI } = useContext(TabbedWorkspaceContext);\n\n return (\n <ChangeRequestContextProvider changeRequestID={crID}>\n <ChangeRequestDetails\n css={css`\n position: absolute;\n inset: 0;\n overflow-y: auto;\n `}\n afterDelete={() => {\n closeTabWithURI(`${Protocols.CHANGE_REQUEST}:${uri}`);\n }}\n />\n </ChangeRequestContextProvider>\n );\n};\n\n\nconst ChangeRequestDetails:\nReact.VoidFunctionComponent<{ afterDelete?: () => void, className?: string }> =\nfunction ({ afterDelete, className }) {\n const { changeRequest: cr, canEdit } = useContext(ChangeRequestContext);\n const { performOperation, updateTree } = useContext(DatasetContext);\n const {\n registerMetadata,\n stakeholder,\n activeChangeRequestID,\n setActiveChangeRequestID,\n } = useContext(BrowserCtx);\n\n const helmet = \n <Helmet>\n <title>Viewing proposal: {cr?.justification ?? \"N/A\"}</title>\n </Helmet>;\n\n if (cr) {\n const isActive = activeChangeRequestID === cr.id;\n const anotherIsActive = activeChangeRequestID && activeChangeRequestID !== cr.id;\n const canTransition = stakeholder && getTransitions(cr, stakeholder).length > 0;\n\n const crStakeholder = (registerMetadata?.stakeholders ?? []).\n find(s => s.gitServerUsername === cr.submittingStakeholderGitServerUsername);\n\n const authorIsCurrentUser = (\n stakeholder?.gitServerUsername &&\n cr.submittingStakeholderGitServerUsername === stakeholder.gitServerUsername);\n\n async function handleDelete() {\n if (authorIsCurrentUser && cr && updateTree && !isActive && Object.keys(cr.items).length < 1) {\n const subtreeRoot = crIDToCRPath(cr.id).replace('/main.yaml', '');\n await updateTree({ subtreeRoot, newSubtreeRoot: null, commitMessage: 'remove CR draft' });\n afterDelete?.();\n }\n }\n\n return (\n <TabContentsWithActions\n className={className}\n actions={<>\n <FormGroup\n inline\n labelInfo={<HelpTooltip\n icon='info-sign'\n content={<UL><li>Proposal ID: {cr.id}</li></UL>}\n />}\n label={<strong>Proposal</strong>}\n css={css`margin: 0; .bp4-form-content { display: flex; flex-flow: row wrap; gap: 10px; }`}>\n <CRActivation\n isActive={isActive}\n htmlTitle={anotherIsActive\n ? \"You are in another proposal so you can’t enter this one. \"\n : canEdit && !isActive\n ? \"Enter proposal to preview or add to proposed changes. \"\n : !isActive\n ? \"Enter proposal to preview the register as proposed.\"\n : \"You’re previewing the register with this proposal applied.\"}\n onChangeActiveStatus={!anotherIsActive && setActiveChangeRequestID\n ? ((active) => active\n ? setActiveChangeRequestID?.(cr.id)\n : setActiveChangeRequestID?.(null)\n )\n : undefined}\n />\n </FormGroup>\n </>}\n main={\n <div\n css={css`\n display: flex;\n flex-flow: row wrap;\n padding: 10px;\n gap: 10px;\n align-content: flex-start;\n align-items: flex-start;\n `}\n className={className}>\n {helmet}\n\n <Card elevation={0} css={css`\n flex: 100%;\n background: ${Colors.LIGHT_GRAY3};\n padding: 11px;\n display: flex;\n min-height: 70vh;\n `}>\n {Object.keys(cr.items).length > 0\n ? <Proposals proposals={cr.items} css={css`flex: 1;`} />\n : <NonIdealState\n icon=\"clean\"\n title=\"Nothing is proposed here yet.\"\n description={authorIsCurrentUser && updateTree && !(cr as Proposed).timeProposed && !isActive\n ? <Button onClick={performOperation('deleting proposal', handleDelete)} intent=\"danger\">\n Delete this CR draft\n </Button>\n : undefined}\n />}\n </Card>\n\n <Card elevation={1} css={css`flex: 30%; padding: 11px;`}>\n\n {crStakeholder\n ? <div>\n Author: <RegisterStakeholderListItem\n stakeholder={crStakeholder}\n isCurrentUser={authorIsCurrentUser || undefined}\n />\n </div>\n : null}\n\n <Divider />\n <div>\n Register version before proposal: <strong>{cr.registerVersion ?? 'N/A'}</strong>\n  \n {cr.registerVersion === registerMetadata?.version?.id\n ? <Tag css={css`display: inline;`} intent='success' minimal round>\n current\n {\" \"}\n <HelpTooltip intent='success' content={<>\n Published version of the register\n {\" \"}\n had not changed since this proposal started.\n </>} />\n </Tag>\n : <Tag css={css`display: inline;`} intent='warning' minimal round>\n not current\n {\" \"}\n <HelpTooltip intent='warning' icon='warning-sign' content={<>\n Register is currently at version <strong>{registerMetadata?.version?.id ?? 'N/A'}</strong>,\n {\" \"}\n which is different from version proposal author may have had in mind.\n {\" \"}\n It is recommended that proposed changes are reviewed to avoid unintentionally\n {\" \"}\n undoing a prior change.\n </>} />\n </Tag>}\n </div>\n <Divider />\n <div>Edited: <Datestamp date={cr.timeEdited} /></div>\n <Divider />\n <div>Proposed: {hadBeenProposed(cr) ? <Datestamp date={cr.timeProposed} /> : 'not yet'}</div>\n <Divider />\n <div>Disposed: {isDisposed(cr) ? <Datestamp date={cr.timeDisposed} /> : 'not yet'}</div>\n <Divider />\n\n <H5>\n {cr.state?.replaceAll('-', ' ') || 'N/A'}\n </H5>\n </Card>\n\n <Card elevation={1} css={css`flex: 30%; padding: 11px;`}>\n {getPastTransitions(cr).map(([key, el], idx) =>\n <React.Fragment key={key}>\n {idx !== 0 ? <Divider /> : null}\n <FormGroup label={`${key}:`}>\n <div\n css={css`white-space: pre-wrap;`}\n className={Classes.RUNNING_TEXT}>\n {el}\n </div>\n </FormGroup>\n </React.Fragment>\n )}\n </Card>\n\n {canTransition\n ? <Card elevation={3} css={css`flex: 30%; padding: 11px;`}>\n <TransitionOptions cr={cr} />\n </Card>\n : null}\n </div>}\n />\n );\n } else {\n return <NonIdealState\n icon={<Spinner />}\n className={className}\n description={helmet}\n />;\n }\n};\n\n\nconst CRActivation: React.FC<{\n isActive: boolean;\n htmlTitle?: string;\n\n /** Labels for the “activate” and “deactivate” buttons. */\n labels?: { activate?: string, deactivate?: string };\n\n onChangeActiveStatus?: (newStatus: boolean) => void;\n}> = function ({ isActive, htmlTitle, labels, onChangeActiveStatus }) {\n return onChangeActiveStatus && isActive\n ? <Button\n title={htmlTitle}\n intent=\"warning\"\n disabled={!onChangeActiveStatus}\n onClick={() => onChangeActiveStatus?.(false)}>\n {labels?.deactivate ?? \"Exit proposal\"}\n </Button>\n : <Button\n title={htmlTitle}\n intent={onChangeActiveStatus ? 'primary' : undefined}\n disabled={!onChangeActiveStatus}\n onClick={() => onChangeActiveStatus?.(true)}>\n {labels?.activate ?? \"Work on this proposal\"}\n </Button>;\n};\n\n\nconst CRTitle: React.FC<{ uri: string }> = function ({ uri }) {\n const { useObjectData } = useContext(DatasetContext);\n const justification = useObjectData({ objectPaths: [uri] }).value.data?.[uri]?.justification;\n return <>Proposal “{maybeEllipsizeString(justification ?? uri)}”</>;\n}\n\nexport default { main: View, title: CRTitle, plainTitle: async (uri: string) => `proposal ${uri}` };\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/detail/ChangeRequest/index.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,8BAA8B;AAE9B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,MAAM,EACN,IAAI,EACJ,SAAS,EACT,MAAM,EACN,aAAa,EACb,OAAO,EACP,EAAE,EACF,EAAE,EACF,GAAG,EACH,OAAO,EACP,OAAO,GACR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,WAAW,MAAM,sDAAsD,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,kEAAkE,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,2CAA2C,CAAC;AACnD,OAAO,SAAS,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAY,eAAe,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO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,CAAC,0CAAE,aAAa,CAAC;IAC7F,OAAO;;QAAa,oBAAoB,CAAC,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,GAAG,CAAC;iBAAK,CAAC;AACtE,CAAC,CAAA;AAED,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE,CAAC,YAAY,GAAG,EAAE,EAAE,CAAC","sourcesContent":["/** @jsx jsx */\n/** @jsxFrag React.Fragment */\n\nimport React, { useContext } from 'react';\nimport { jsx, css } from '@emotion/react';\nimport {\n Button,\n Card,\n FormGroup,\n Colors,\n NonIdealState,\n Spinner,\n H5,\n UL,\n Tag,\n Divider,\n Classes,\n} from '@blueprintjs/core';\nimport { DatasetContext } from '@riboseinc/paneron-extension-kit/context';\nimport HelpTooltip from '@riboseinc/paneron-extension-kit/widgets/HelpTooltip';\nimport { TabbedWorkspaceContext } from '@riboseinc/paneron-extension-kit/widgets/TabbedWorkspace/context';\nimport { BrowserCtx } from '../../BrowserCtx';\nimport { crPathToCRID, crIDToCRPath } from '../../itemPathUtils';\nimport {\n ChangeRequestContextProvider,\n ChangeRequestContext,\n} from '../../change-request/ChangeRequestContext';\nimport Proposals from '../../change-request/Proposals';\nimport { Proposed, hadBeenProposed, isDisposed } from '../../../types/cr';\nimport { RegisterStakeholderListItem } from '../../RegisterStakeholder';\nimport { Protocols } from '../../protocolRegistry';\nimport {\n TabContentsWithActions,\n RegisterHelmet as Helmet,\n maybeEllipsizeString,\n Datestamp,\n} from '../../util';\nimport { TransitionOptions, getPastTransitions, getTransitions } from './transitions';\n\n\nconst View: React.FC<{ uri: string }> = function ({ uri }) {\n const crID = crPathToCRID(uri);\n const { closeTabWithURI } = useContext(TabbedWorkspaceContext);\n\n return (\n <ChangeRequestContextProvider changeRequestID={crID}>\n <ChangeRequestDetails\n css={css`\n position: absolute;\n inset: 0;\n overflow-y: auto;\n `}\n afterDelete={() => {\n closeTabWithURI(`${Protocols.CHANGE_REQUEST}:${uri}`);\n }}\n />\n </ChangeRequestContextProvider>\n );\n};\n\n\nconst ChangeRequestDetails:\nReact.VoidFunctionComponent<{ afterDelete?: () => void, className?: string }> =\nfunction ({ afterDelete, className }) {\n const { changeRequest: cr, canEdit } = useContext(ChangeRequestContext);\n const { performOperation, updateTree } = useContext(DatasetContext);\n const {\n registerMetadata,\n stakeholder,\n activeChangeRequestID,\n setActiveChangeRequestID,\n } = useContext(BrowserCtx);\n\n const helmet = \n <Helmet>\n <title>Viewing proposal: {cr?.justification ?? \"N/A\"}</title>\n </Helmet>;\n\n if (cr) {\n const isActive = activeChangeRequestID === cr.id;\n const anotherIsActive = activeChangeRequestID && activeChangeRequestID !== cr.id;\n const canTransition = stakeholder && getTransitions(cr, stakeholder).length > 0;\n\n const crStakeholder = (registerMetadata?.stakeholders ?? []).\n find(s => s.gitServerUsername === cr.submittingStakeholderGitServerUsername);\n\n const authorIsCurrentUser = (\n stakeholder?.gitServerUsername &&\n cr.submittingStakeholderGitServerUsername === stakeholder.gitServerUsername);\n\n async function handleDelete() {\n if (authorIsCurrentUser && cr && updateTree && !isActive && Object.keys(cr.items).length < 1) {\n const subtreeRoot = crIDToCRPath(cr.id).replace('/main.yaml', '');\n await updateTree({ subtreeRoot, newSubtreeRoot: null, commitMessage: 'remove CR draft' });\n afterDelete?.();\n }\n }\n\n return (\n <TabContentsWithActions\n className={className}\n actions={<>\n <FormGroup\n inline\n labelInfo={<HelpTooltip\n icon='info-sign'\n content={<UL><li>Proposal ID: {cr.id}</li></UL>}\n />}\n label={<strong>Proposal</strong>}\n css={css`margin: 0; .bp4-form-content { display: flex; flex-flow: row wrap; gap: 10px; }`}>\n <CRActivation\n isActive={isActive}\n htmlTitle={anotherIsActive\n ? \"You are in another proposal so you can’t enter this one. \"\n : canEdit && !isActive\n ? \"Enter proposal to preview or add to proposed changes. \"\n : !isActive\n ? \"Enter proposal to preview the register as proposed.\"\n : \"You’re previewing the register with this proposal applied.\"}\n onChangeActiveStatus={!anotherIsActive && setActiveChangeRequestID\n ? ((active) => active\n ? setActiveChangeRequestID?.(cr.id)\n : setActiveChangeRequestID?.(null)\n )\n : undefined}\n />\n </FormGroup>\n </>}\n main={\n <div\n css={css`\n display: flex;\n flex-flow: row wrap;\n padding: 10px;\n gap: 10px;\n align-content: flex-start;\n align-items: flex-start;\n `}\n className={className}>\n {helmet}\n\n <Card elevation={0} css={css`\n flex: 100%;\n background: ${Colors.LIGHT_GRAY3};\n padding: 11px;\n display: flex;\n min-height: 70vh;\n `}>\n {Object.keys(cr.items).length > 0\n ? <Proposals proposals={cr.items} css={css`flex: 1;`} />\n : <NonIdealState\n icon=\"clean\"\n title=\"Nothing is proposed here yet.\"\n description={authorIsCurrentUser && updateTree && !(cr as Proposed).timeProposed && !isActive\n ? <Button onClick={performOperation('deleting proposal', handleDelete)}>\n Delete this CR draft\n </Button>\n : undefined}\n />}\n </Card>\n\n <Card elevation={1} css={css`flex: 30%; padding: 11px;`}>\n\n {crStakeholder\n ? <div>\n Author: <RegisterStakeholderListItem\n stakeholder={crStakeholder}\n isCurrentUser={authorIsCurrentUser || undefined}\n />\n </div>\n : null}\n\n <Divider />\n <div>\n Register version before proposal: <strong>{cr.registerVersion ?? 'N/A'}</strong>\n  \n {cr.registerVersion === registerMetadata?.version?.id\n ? <Tag css={css`display: inline;`} intent='success' minimal round>\n current\n {\" \"}\n <HelpTooltip intent='success' content={<>\n Published version of the register\n {\" \"}\n had not changed since this proposal started.\n </>} />\n </Tag>\n : <Tag css={css`display: inline;`} intent='warning' minimal round>\n not current\n {\" \"}\n <HelpTooltip intent='warning' icon='warning-sign' content={<>\n Register is currently at version <strong>{registerMetadata?.version?.id ?? 'N/A'}</strong>,\n {\" \"}\n which is different from version proposal author may have had in mind.\n {\" \"}\n It is recommended that proposed changes are reviewed to avoid unintentionally\n {\" \"}\n undoing a prior change.\n </>} />\n </Tag>}\n </div>\n <Divider />\n <div>Edited: <Datestamp date={cr.timeEdited} /></div>\n <Divider />\n <div>Proposed: {hadBeenProposed(cr) ? <Datestamp date={cr.timeProposed} /> : 'not yet'}</div>\n <Divider />\n <div>Disposed: {isDisposed(cr) ? <Datestamp date={cr.timeDisposed} /> : 'not yet'}</div>\n <Divider />\n\n <H5>\n {cr.state?.replaceAll('-', ' ') || 'N/A'}\n </H5>\n </Card>\n\n <Card elevation={1} css={css`flex: 30%; padding: 11px;`}>\n {getPastTransitions(cr).map(([key, el], idx) =>\n <React.Fragment key={key}>\n {idx !== 0 ? <Divider /> : null}\n <FormGroup label={`${key}:`}>\n <div\n css={css`white-space: pre-wrap;`}\n className={Classes.RUNNING_TEXT}>\n {el}\n </div>\n </FormGroup>\n </React.Fragment>\n )}\n </Card>\n\n {canTransition\n ? <Card elevation={3} css={css`flex: 30%; padding: 11px;`}>\n <TransitionOptions cr={cr} />\n </Card>\n : null}\n </div>}\n />\n );\n } else {\n return <NonIdealState\n icon={<Spinner />}\n className={className}\n description={helmet}\n />;\n }\n};\n\n\nconst CRActivation: React.FC<{\n isActive: boolean;\n htmlTitle?: string;\n\n /** Labels for the “activate” and “deactivate” buttons. */\n labels?: { activate?: string, deactivate?: string };\n\n onChangeActiveStatus?: (newStatus: boolean) => void;\n}> = function ({ isActive, htmlTitle, labels, onChangeActiveStatus }) {\n return onChangeActiveStatus && isActive\n ? <Button\n title={htmlTitle}\n intent=\"warning\"\n disabled={!onChangeActiveStatus}\n onClick={() => onChangeActiveStatus?.(false)}>\n {labels?.deactivate ?? \"Exit proposal\"}\n </Button>\n : <Button\n title={htmlTitle}\n intent={onChangeActiveStatus ? 'primary' : undefined}\n disabled={!onChangeActiveStatus}\n onClick={() => onChangeActiveStatus?.(true)}>\n {labels?.activate ?? \"Work on this proposal\"}\n </Button>;\n};\n\n\nconst CRTitle: React.FC<{ uri: string }> = function ({ uri }) {\n const { useObjectData } = useContext(DatasetContext);\n const justification = useObjectData({ objectPaths: [uri] }).value.data?.[uri]?.justification;\n return <>Proposal “{maybeEllipsizeString(justification ?? uri)}”</>;\n}\n\nexport default { main: View, title: CRTitle, plainTitle: async (uri: string) => `proposal ${uri}` };\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ValueHook } from '@riboseinc/paneron-extension-kit/types';
|
|
2
|
-
import { CustomViewConfiguration } from '../../types';
|
|
1
|
+
import type { ValueHook } from '@riboseinc/paneron-extension-kit/types';
|
|
2
|
+
import type { CustomViewConfiguration } from '../../types';
|
|
3
3
|
export default function useCustomView(viewID: string): ValueHook<CustomViewConfiguration | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCustomView.js","sourceRoot":"","sources":["../../../src/views/hooks/useCustomView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,MAAc;IAElD,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;IACpD,OAAO;QACL,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC;QACrB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,CAAC;KACf,CAAC;AACJ,CAAC","sourcesContent":["import { useContext } from 'react';\nimport { ValueHook } from '@riboseinc/paneron-extension-kit/types';\nimport { BrowserCtx } from '../BrowserCtx';\nimport { CustomViewConfiguration } from '../../types';\n\n\nexport default function useCustomView(viewID: string):\nValueHook<CustomViewConfiguration | undefined> {\n const { customViews } = useContext(BrowserCtx);\n const view = customViews.find(v => v.id === viewID);\n return {\n value: view,\n errors: [],\n refresh: () => void 0,\n isUpdating: false,\n _reqCounter: 0,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useCustomView.js","sourceRoot":"","sources":["../../../src/views/hooks/useCustomView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,MAAc;IAElD,MAAM,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC;IACpD,OAAO;QACL,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC;QACrB,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,CAAC;KACf,CAAC;AACJ,CAAC","sourcesContent":["import { useContext } from 'react';\nimport type { ValueHook } from '@riboseinc/paneron-extension-kit/types';\nimport { BrowserCtx } from '../BrowserCtx';\nimport type { CustomViewConfiguration } from '../../types';\n\n\nexport default function useCustomView(viewID: string):\nValueHook<CustomViewConfiguration | undefined> {\n const { customViews } = useContext(BrowserCtx);\n const view = customViews.find(v => v.id === viewID);\n return {\n value: view,\n errors: [],\n refresh: () => void 0,\n isUpdating: false,\n _reqCounter: 0,\n };\n}\n"]}
|