diff --git a/README.md b/README.md index 467eb1a7..798025cd 100644 --- a/README.md +++ b/README.md @@ -204,7 +204,7 @@ const main = () => { - `visualizeAttributes` (optional)(`string[]`): List of attribute names (strings) which should be visualized. Defaults to the first 3 if no value is provided. If an empty list is provided, displays no attributes. - `visualizeUpsetAttributes` (optional)(`boolean`): Whether or not to visualize UpSet generated attributes (`degree` and `deviation`). Defaults to `false`. - `allowAttributeRemoval` (optional)(`boolean`): Whether or not to allow the user to remove attribute columns. This should be enabled only if there is an option within the parent application which allows for attributes to be added after removal. Default attribute removal behavior in UpSet 2.0 is done via context menu on attribute headers. Defaults to `false`. -- `userEditPerms` (optional)(`boolean`): Whether or not the user has plot information edit permissions. +- `canEditPlotInformation` (optional)(`boolean`): Whether or not the user can edit the plot information in the text descriptions sidebar. - `hideSettings` (optional)(`boolean`): Hide the aggregations/filter settings sidebar. - `parentHasHeight` (optional)(`boolean`): Indicates if the parent component has a fixed height. If this is set to `false`, the plot will occupy the full viewport height. When set to `true`, the plot will fit entirely within the parent component. Defaults to `false`. - `extProvenance` (optional): External provenance actions and [TrrackJS](https://github.com/Trrack/trrackjs) object for provenance history tracking and actions. This should only be used if your tool is using TrrackJS and the Trrack object you provide has all the actions used by UpSet 2.0. Provenance is still tracked if nothing is provided. See [App.tsx](https://github.com/visdesignlab/upset2/blob/main/packages/app/src/App.tsx) to see how UpSet 2.0 and Multinet use an external Trrack object. Note that [initializeProvenanceTracking](https://github.com/visdesignlab/upset2/blob/main/packages/upset/src/provenance/index.ts#L300) and [getActions](https://github.com/visdesignlab/upset2/blob/main/packages/upset/src/provenance/index.ts#L322) are used to ensure that the provided provenance object is compatible. The provided provenance object must have a type compatible with the [extProvenance](https://vdl.sci.utah.edu/upset2/interfaces/_visdesignlab_upset2_react.UpsetProps.html#extProvenance) UpSet 2.0 prop type. diff --git a/packages/app/src/components/Body.tsx b/packages/app/src/components/Body.tsx index 5fe11954..11972041 100644 --- a/packages/app/src/components/Body.tsx +++ b/packages/app/src/components/Body.tsx @@ -128,7 +128,7 @@ export const Body = ({ data, config }: Props) => { ({ + key: 'canEditPlotInformationAtom', + default: false, +}); diff --git a/packages/upset/src/atoms/config/userEditPermsAtoms.ts b/packages/upset/src/atoms/config/userEditPermsAtoms.ts deleted file mode 100644 index 311e4787..00000000 --- a/packages/upset/src/atoms/config/userEditPermsAtoms.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { atom } from 'recoil'; - -export const userEditPermsAtom = atom({ - key: 'userEditPermsAtom', - default: false, -}); diff --git a/packages/upset/src/components/AltTextSidebar.tsx b/packages/upset/src/components/AltTextSidebar.tsx index 1ae3119e..def99d65 100644 --- a/packages/upset/src/components/AltTextSidebar.tsx +++ b/packages/upset/src/components/AltTextSidebar.tsx @@ -24,7 +24,7 @@ import '../index.css'; import { PlotInformation } from './custom/PlotInformation'; import { UpsetActions } from '../provenance'; import { plotInformationSelector } from '../atoms/config/plotInformationAtom'; -import { userEditPermsAtom } from '../atoms/config/userEditPermsAtoms'; +import { canEditPlotInformationAtom } from '../atoms/config/canEditPlotInformationAtoms'; /** * Props for the AltTextSidebar component. @@ -67,7 +67,7 @@ export const AltTextSidebar: FC = ({ open, close, generateAltText }) => { const { actions }: {actions: UpsetActions} = useContext(ProvenanceContext); const currState = useRecoilValue(upsetConfigAtom); - const userEditPerms = useRecoilValue(userEditPermsAtom); + const canEditPlotInformation = useRecoilValue(canEditPlotInformationAtom); const [altText, setAltText] = useState(null); const [textGenErr, setTextGenErr] = useState(false); const [textEditing, setTextEditing] = useState(false); @@ -87,7 +87,7 @@ export const AltTextSidebar: FC = ({ open, close, generateAltText }) => { const saveButtonClick: () => void = useCallback(() => { // if the user doesn't have edit permissions, don't allow saving // The user shouldn't be able to edit in this case, but this is a failsafe - if (!userEditPerms) return; + if (!canEditPlotInformation) return; setTextEditing(false); if (!currState.useUserAlt) actions.setUseUserAltText(true); @@ -101,7 +101,7 @@ export const AltTextSidebar: FC = ({ open, close, generateAltText }) => { const enableTextEditing: () => void = useCallback(() => { // if the user doesn't have edit permissions, don't allow editing // The button should be hidden in this case, but this is a failsafe - if (!userEditPerms) return; + if (!canEditPlotInformation) return; setTextEditing(true); if (!currState.userAltText?.shortDescription) setUserShortText(altText?.shortDescription); @@ -217,7 +217,7 @@ export const AltTextSidebar: FC = ({ open, close, generateAltText }) => { /> ) : ( // only show "Add Plot Information" if the user has edit permissions - userEditPerms ? ( + canEditPlotInformation ? (