Skip to content

Commit

Permalink
nit re #10541, rewrite multi-line ternaries
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed May 15, 2024
1 parent b0840c9 commit e574324
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
11 changes: 8 additions & 3 deletions arches/app/src/components/ControlledListManager/AddLabel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ const { $gettext } = useGettext();
const slateBlue = "#2d3c4b"; // todo: import from theme somewhere
const buttonLabel = computed(() => {
return props.type === "prefLabel"
? $gettext("Add Preferred Label")
: $gettext("Add Alternate Label");
switch (props.type) {
case "prefLabel":
return $gettext("Add Preferred Label");
case "altLabel":
return $gettext("Add Alternate Label");
default:
throw new Error();
}
});
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ const onSave = () => {
// eslint-disable-next-line vue/no-mutating-props
props.item[props.field] = dirtyFormValue.value;
const saveFn = Object.hasOwn(props.item, "items")
? postListToServer
: postItemToServer;
const isList = Object.hasOwn(props.item, "items");
const saveFn = isList ? postListToServer : postItemToServer;
saveFn(props.item, toast, $gettext);
};
const onCancel = () => {
Expand Down
12 changes: 8 additions & 4 deletions arches/app/src/components/ControlledListManager/LabelRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ const visible = ref(false);
const { $gettext } = useGettext();
const header = computed(() => {
return props.label.valuetype === "prefLabel"
? $gettext("Edit Preferred Label")
: $gettext("Edit Alternate Label");
switch (props.label.valuetype) {
case "prefLabel":
return $gettext("Edit Preferred Label");
case "altLabel":
return $gettext("Edit Alternate Label");
default:
throw new Error();
}
});
</script>

<template>
Expand Down

0 comments on commit e574324

Please sign in to comment.