Skip to content

Commit

Permalink
fix variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinBeczak committed Oct 15, 2023
1 parent daa376f commit c9539fb
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,10 @@ export class EditChallenge extends Component {
}
}

if (challengeData.widgetLayout) {
const geoJSONFile = this.state.formContext?.root_widgetLayout?.file ?? this.state.formContext?.root?.file ?? null;
if (challengeData.taskWidgetLayout) {
const geoJSONFile = this.state.formContext?.root_taskWidgetLayout?.file ?? this.state.formContext?.root?.file ?? null;
if (geoJSONFile) {
challengeData.widgetLayout = (await AsLineReadableFile(geoJSONFile).allLines()).join("\n")
challengeData.taskWidgetLayout = (await AsLineReadableFile(geoJSONFile).allLines()).join("\n")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ will not be able to make sense of it.
"when managing your challenge.",
},

widgetLayoutReadOnly: {
id: "Admin.EditChallenge.form.widgetLayout.readOnly",
taskWidgetLayoutReadOnly: {
id: "Admin.EditChallenge.form.taskWidgetLayout.readOnly",
defaultMessage:
"Upload a widget layout to be used as a recommendation for the mapper in the task completion workflow.",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export const jsSchema = (intl) => {
],
default: false,
},
widgetLayout: {
taskWidgetLayout: {
title: "Layout File",
type: "string",
description: intl.formatMessage(messages.widgetLayoutReadOnly)
description: intl.formatMessage(messages.taskWidgetLayoutReadOnly)
},
},
dependencies: {
Expand Down Expand Up @@ -133,7 +133,7 @@ export const uiSchema = (intl, user, challengeData, extraErrors, options={}) =>
"ui:widget": "radio",
"ui:help": intl.formatMessage(messages.presetsDescription),
},
widgetLayout: {
taskWidgetLayout: {
"ui:widget": DropzoneTextUpload,
"ui:readonly": sourceReadOnly,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export const TagsInputField = props => {
* and it will be set with the text content of the uploaded file.
*/
export const DropzoneTextUpload = ({id, onChange, readonly, formContext, dropAreaClassName}) => {
const idRequirements = (id !== "root_widgetLayout" && id !== "root")
const idRequirements = (id !== "root_taskWidgetLayout" && id !== "root")

if (readonly && idRequirements) {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/components/WidgetWorkspace/WidgetWorkspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export class WidgetWorkspace extends Component {
}

componentDidUpdate() {
if(!this.state.activeRecommendedLayout && this.props.task?.parent?.widgetLayout) {
if(!this.state.activeRecommendedLayout && this.props.task?.parent?.taskWidgetLayout) {
const { task, workspaceConfigurations, saveWorkspaceConfiguration } = this.props;
let recommendedLayout = task.parent.widgetLayout.workspace
let recommendedLayout = task.parent.taskWidgetLayout.workspace

if (this.props.workspaceConfigurations?.recommendedLayout) {
this.props.deleteWorkspaceConfiguration(this.props.workspaceConfigurations.recommendedLayout.id)
Expand Down
10 changes: 5 additions & 5 deletions src/services/Challenge/Challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,14 +963,14 @@ export const fetchChallenges = function (

// If there is local GeoJSON content being transmitted as a string, parse
// it into JSON first.
if (!challengeData.widgetLayout.workspace && challengeData.widgetLayout) {
if (!challengeData.taskWidgetLayout.workspace && challengeData.taskWidgetLayout) {
try {
if (!JSON.parse(challengeData.widgetLayout).workspace) {
if (!JSON.parse(challengeData.taskWidgetLayout).workspace) {
throw new Error("Widget layout with the wrong format was submitted, it was not included in the save.")
}
challengeData.widgetLayout = JSON.parse(challengeData.widgetLayout)
challengeData.taskWidgetLayout = JSON.parse(challengeData.taskWidgetLayout)
} catch(error) {
challengeData.widgetLayout = "";
challengeData.taskWidgetLayout = "";
console.error(error);
}
}
Expand Down Expand Up @@ -1026,7 +1026,7 @@ export const fetchChallenges = function (
"taskStyles",
"requiresLocal",
"reviewSetting",
"widgetLayout",
"taskWidgetLayout",
]
);

Expand Down
4 changes: 2 additions & 2 deletions src/services/Widget/Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ export const importRecommendedConfiguration = (recommendedLayout) => {
importedConfiguration.widgets =
_map(importedConfiguration.widgetKeys, key => widgetDescriptor(key))
delete importedConfiguration.widgetKeys

_each(importedConfiguration.layout, widgetLayout => widgetLayout.i = generateWidgetId())
debugger
_each(importedConfiguration.layout, taskWidgetLayout => taskWidgetLayout.i = generateWidgetId())
return (importedConfiguration)
}

Expand Down

0 comments on commit c9539fb

Please sign in to comment.