Skip to content

Commit eaefc7d

Browse files
committed
Implement some of the code review comments for PR #1598
- Explicitly check array lengths in conditional statements in template - Add computed property for unknownProfileModNames - Remove cancel button as they really aren't used elsewhere in the app
1 parent 4c8f91c commit eaefc7d

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

Diff for: src/components/profiles-modals/ImportProfileModal.vue

+16-21
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
7676
return {known, unknown};
7777
}
7878
79+
get unknownProfileModNames(): string {
80+
return this.profileMods.unknown.join(', ');
81+
}
82+
7983
// Fired when user selects to import either from file or code.
8084
async onFileOrCodeSelect(mode: 'FILE' | 'CODE') {
8185
if (mode === 'FILE') {
@@ -309,17 +313,17 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
309313
</template>
310314
<template v-slot:body>
311315
<OnlineModList :paged-mod-list="profileMods.known" :read-only="true" />
312-
<div v-if="!profileMods.known.length || profileMods.unknown.length" class="notification is-warning margin-top">
313-
<p v-if="!profileMods.known.length">
316+
<div v-if="profileMods.known.length === 0 || profileMods.unknown.length > 0" class="notification is-warning margin-top">
317+
<p v-if="profileMods.known.length === 0">
314318
None of the packages in the profile were found on Thunderstore:
315319
</p>
316320
<p v-else>
317321
Some of the packages in the profile were not found on Thunderstore:
318322
</p>
319323

320-
<p class="margin-top">{{ profileMods.unknown.join(", ") }}</p>
324+
<p class="margin-top">{{ unknownProfileModNames }}</p>
321325

322-
<p v-if="profileMods.known.length" class="margin-top">
326+
<p v-if="profileMods.known.length > 0" class="margin-top">
323327
These packages will not be installed.
324328
</p>
325329
<p v-else class="margin-top">
@@ -351,23 +355,14 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
351355
</div>
352356
</template>
353357
<template v-slot:footer>
354-
<div class="container is-flex is-justify-content-space-between">
355-
<button
356-
id="modal-no-mods-to-import"
357-
class="button is-danger"
358-
@click="closeModal"
359-
>
360-
Cancel import
361-
</button>
362-
<button
363-
id="modal-review-confirmed"
364-
class="button is-info"
365-
:disabled="!profileMods.known.length"
366-
@click="onProfileReviewConfirmed"
367-
>
368-
Import
369-
</button>
370-
</div>
358+
<button
359+
id="modal-review-confirmed"
360+
class="button is-info"
361+
:disabled="profileMods.known.length === 0"
362+
@click="onProfileReviewConfirmed"
363+
>
364+
Import
365+
</button>
371366
</template>
372367
</ModalCard>
373368

0 commit comments

Comments
 (0)