Skip to content

Commit

Permalink
Improve language in collection builders...
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Dec 3, 2024
1 parent f5e146d commit 02406ba
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 14 deletions.
21 changes: 12 additions & 9 deletions client/src/components/Collections/CollectionCreatorModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,25 @@ watch(
}
);
const extensionInTitle = computed<string>(() => {
const extensions = props.extensions;
if (!extensions || extensions.length == 0 || extensions.indexOf("data") >= 0) {
return "";
} else {
return orList(extensions);
}
});
const modalTitle = computed(() => {
if (props.collectionType === "list") {
return localize(
`Create a collection from a list of ${fromSelection.value ? "selected" : ""} ${
props.extensions?.length ? orList(props.extensions) : ""
} datasets`
);
return localize(`Create a list of ${fromSelection.value ? "selected" : ""} ${extensionInTitle.value} datasets`);
} else if (props.collectionType === "list:paired") {
return localize(
`Create a collection of ${fromSelection.value ? "selected" : ""} ${
props.extensions?.length ? orList(props.extensions) : ""
} dataset pairs`
`Create a list of ${fromSelection.value ? "selected" : ""} ${extensionInTitle.value} paired datasets`
);
} else if (props.collectionType === "paired") {
return localize(
`Create a ${props.extensions?.length ? orList(props.extensions) : ""} dataset pair collection ${
`Create a ${extensionInTitle.value} paired dataset collection ${
fromSelection.value ? "from selected items" : ""
}`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ function renameElement(element: any, name: string) {
:history-id="props.historyId"
:hide-source-items="hideSourceItems"
:extensions="extensions"
collectionType="list"
@add-uploaded-files="addUploadedFiles"
@on-update-datatype-toggle="changeDatatypeFilter"
@onUpdateHideSourceItems="onUpdateHideSourceItems"
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Collections/PairCollectionCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
:suggested-name="initialSuggestedName"
:extensions="props.extensions"
:extensions-toggle="removeExtensions"
collection-type="paired"
@add-uploaded-files="addUploadedFiles"
@onUpdateHideSourceItems="onUpdateHideSourceItems"
@clicked-create="clickedCreate"
Expand Down Expand Up @@ -481,7 +482,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
<i data-target=".collection-name"> {{ localize("name") }}</i>
{{ localize("and click ") }}
<i data-target=".create-collection">
{{ localize("Create list") }}
{{ localize("Create dataset pair") }}
</i>
{{ localize(".") }}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
:history-id="props.historyId"
:hide-source-items="hideSourceItems"
render-extensions-toggle
collection-type="list:paired"
:extensions-toggle="removeExtensions"
:extensions="extensions"
@add-uploaded-files="addUploadedFiles"
Expand Down Expand Up @@ -1066,7 +1067,7 @@ function _naiveStartingAndEndingLCS(s1: string, s2: string) {
</i>
{{ localize("and click ") }}
<i data-target=".create-collection">
{{ localize("Create list") }}
{{ localize("Create list of pairs") }}
</i>
{{ localize(". (Note: you do not have to pair all unpaired datasets to finish.)") }}
</p>
Expand Down
18 changes: 16 additions & 2 deletions client/src/components/Collections/common/CollectionCreator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ interface Props {
renderExtensionsToggle?: boolean;
extensions?: string[];
extensionsToggle?: boolean;
collectionType?: string;
}
const props = withDefaults(defineProps<Props>(), {
Expand Down Expand Up @@ -101,6 +102,19 @@ const defaultExtension = computed(() => {
}
});
const shortWhatIsBeingCreated = computed<string>(() => {
// plain language for what is being created
if (props.collectionType === "list") {
return "list";
} else if (props.collectionType === "list:paired") {
return "list of pairs";
} else if (props.collectionType == "paired") {
return "dataset pair";
} else {
return "collection";
}
});
function addUploadedFiles(value: HDASummary[]) {
// TODO: We really need to wait for each of these items to get `state = 'ok'`
// before we can add them to the collection.
Expand Down Expand Up @@ -211,7 +225,7 @@ watch(
id="collection-name"
v-model="collectionName"
class="collection-name"
:placeholder="localize('Enter a name for your new collection')"
:placeholder="localize('Enter a name for your new ' + shortWhatIsBeingCreated)"
size="sm"
required
:state="!collectionName ? false : null" />
Expand All @@ -229,7 +243,7 @@ watch(
variant="primary"
:disabled="!validInput"
@click="emit('clicked-create', collectionName)">
{{ localize("Create collection") }}
{{ localize("Create " + shortWhatIsBeingCreated) }}
</BButton>
</div>
</div>
Expand Down
12 changes: 11 additions & 1 deletion client/src/components/Form/Elements/FormData/FormData.vue
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,20 @@ watch(
const formatsVisible = ref(false);
const formatsButtonId = useUid("form-data-formats-");
function collectionTypeToText(collectionType: string): string {
if (collectionType == "list:paired") {
return "list of pairs";
} else {
return collectionType;
}
}
const warningListAmount = 4;
const noOptionsWarningMessage = computed(() => {
const itemType = props.type === "data" ? "datasets" : "dataset collections";
const collectionTypeLabel = props.collectionTypes?.length ? `${orList(props.collectionTypes)} ` : "";
const collectionTypeLabel = props.collectionTypes?.length
? `${orList(props.collectionTypes.map(collectionTypeToText))} `
: "";
if (!props.extensions || props.extensions.length === 0 || props.extensions.includes("data")) {
return `No ${collectionTypeLabel}${itemType} available`;
} else if (props.extensions.length <= warningListAmount) {
Expand Down

0 comments on commit 02406ba

Please sign in to comment.