Skip to content

Commit

Permalink
Merge pull request #34 from Arzte/legacy-build-code-export
Browse files Browse the repository at this point in the history
Add a switch to allow export of legacy build codes
  • Loading branch information
ltouroumov authored Sep 10, 2024
2 parents 7687d75 + a718f57 commit f33941e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/viewer/ViewProjectRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<StyleRow
v-if="row.isPrivateStyling"
:styles="row.styling"
row-id="row.id"
:row-id="row.id"
/>
<div v-show="isVisible" class="project-row">
<img
Expand Down
27 changes: 25 additions & 2 deletions components/viewer/utils/ExportCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@
placeholder="Nothing has been selected yet ..."
:value="exportCode"
/>
<div class="form-check form-switch">
<input
class="form-check-input"
type="checkbox"
role="switch"
id="flexSwitchCheckChecked"
v-model="exportNewCodeStyle"
checked
/>
<label class="form-check-label" for="flexSwitchCheckChecked"
>Use new style of build codes</label
>
</div>
<button
class="btn btn-outline-primary export-code-btn"
:class="{ isCopied: isCodeCopied }"
Expand Down Expand Up @@ -76,10 +89,20 @@ const packRows = computed(() => {
);
});
const exportNewCodeStyle = ref<boolean>(true);
const exportCode = computed<string>(() => {
const join = exportNewCodeStyle.value ? ';' : ',';
return R.pipe(
R.map(([id, amt]) => (amt > 1 ? `${id}:${amt}` : id)),
R.join(';'),
R.map(([id, amt]) => {
if (exportNewCodeStyle.value) {
return amt > 1 ? `${id}:${amt}` : id;
} else {
const object = getObject(id);
return amt > 1 || object.isSelectableMultiple ? `${id}/ON#${amt}` : id;
}
}),
R.join(join),
)(R.toPairs(selected.value));
});
const exportTextHeaders = ref<boolean>(false);
Expand Down

0 comments on commit f33941e

Please sign in to comment.