Skip to content

Commit 915bf6c

Browse files
committed
fix imports
1 parent 3c87517 commit 915bf6c

File tree

2 files changed

+39
-57
lines changed

2 files changed

+39
-57
lines changed

packages/platform-ui/src/components/Edit/BulkImport/CardPreviewList.vue

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
<v-card-title class="text-h5">Remove Card</v-card-title>
77
<v-card-text>
88
<p>Are you sure you want to remove this card?</p>
9-
<v-checkbox
10-
v-model="dontAskAgain"
11-
label="Don't ask me again"
12-
hide-details
13-
class="mt-2"
14-
></v-checkbox>
9+
<v-checkbox v-model="dontAskAgain" label="Don't ask me again" hide-details class="mt-2"></v-checkbox>
1510
</v-card-text>
1611
<v-card-actions>
1712
<v-spacer></v-spacer>
@@ -20,7 +15,7 @@
2015
</v-card-actions>
2116
</v-card>
2217
</v-dialog>
23-
18+
2419
<v-card v-if="parsedCards.length > 0" class="mb-4">
2520
<v-card-title class="d-flex align-center justify-space-between">
2621
<span>Card Preview</span>
@@ -108,9 +103,7 @@
108103
</template>
109104

110105
<script lang="ts">
111-
import { SkldrMouseTrap, HotKey } from '@vue-skuilder/common-ui/src/utils/SkldrMouseTrap';
112-
import type { ViewComponent } from '@vue-skuilder/common-ui/src/composables';
113-
import SkMouseTrap from '@vue-skuilder/common-ui/src/components/SkMouseTrap.vue';
106+
import { ViewComponent, SkldrMouseTrap, HotKey, SkMouseTrap } from '@vue-skuilder/common-ui';
114107
import { DataShape, ParsedCard, ViewData } from '@vue-skuilder/common';
115108
import { defineComponent, PropType } from 'vue';
116109
import CardBrowser from '../CardBrowser.vue';
@@ -202,7 +195,7 @@ export default defineComponent({
202195
this.currentIndex = index;
203196
}
204197
},
205-
198+
206199
setupKeyBindings() {
207200
// Define key bindings for navigation
208201
this.keyBindings = [
@@ -245,7 +238,7 @@ export default defineComponent({
245238
SkldrMouseTrap.bind(this.keyBindings);
246239
}
247240
},
248-
241+
249242
enableShortcuts() {
250243
if (!this.shortcutsEnabled) {
251244
this.shortcutsEnabled = true;
@@ -261,7 +254,7 @@ export default defineComponent({
261254
console.log('[CardPreviewList] Keyboard shortcuts disabled');
262255
}
263256
},
264-
257+
265258
toggleShortcuts(enable: boolean) {
266259
if (enable) {
267260
this.enableShortcuts();
@@ -272,27 +265,27 @@ export default defineComponent({
272265
273266
promptDelete() {
274267
if (!this.currentCard) return;
275-
268+
276269
if (this.skipDeleteConfirmation) {
277270
this.deleteCurrentCard();
278271
} else {
279272
this.showDeleteConfirm = true;
280273
}
281274
},
282-
275+
283276
cancelDelete() {
284277
this.showDeleteConfirm = false;
285278
},
286-
279+
287280
confirmDelete() {
288281
if (this.dontAskAgain) {
289282
this.skipDeleteConfirmation = true;
290283
}
291-
284+
292285
this.showDeleteConfirm = false;
293286
this.deleteCurrentCard();
294287
},
295-
288+
296289
deleteCurrentCard() {
297290
if (!this.currentCard) return;
298291
@@ -319,7 +312,6 @@ export default defineComponent({
319312
this.$emit('edit-card', this.currentCard, this.currentIndex);
320313
},
321314
},
322-
323315
});
324316
</script>
325317

packages/platform-ui/src/components/Edit/BulkImportView.vue

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ tags: tagC"
7676
variant="outlined"
7777
@keydown.ctrl.enter="saveEditedCard"
7878
></v-textarea>
79-
79+
8080
<div class="my-4">
8181
<div class="d-flex align-center mb-2">
8282
<h3 class="text-subtitle-1 mr-2">Tags</h3>
@@ -87,24 +87,18 @@ tags: tagC"
8787
placeholder="Add a tag"
8888
variant="outlined"
8989
class="mr-2"
90-
@keydown.enter.prevent="addTag"
90+
@keydown.enter.prevent="addTag"
9191
@keydown.esc="closeEditDialog"
9292
></v-text-field>
9393
<v-btn size="small" color="primary" variant="text" @click="addTag">Add</v-btn>
9494
</div>
9595
<div class="d-flex flex-wrap">
96-
<v-chip
97-
v-for="tag in editedTags"
98-
:key="tag"
99-
closable
100-
class="mr-1 mb-1"
101-
@click:close="removeTag(tag)"
102-
>
96+
<v-chip v-for="tag in editedTags" :key="tag" closable class="mr-1 mb-1" @click:close="removeTag(tag)">
10397
{{ tag }}
10498
</v-chip>
10599
</div>
106100
</div>
107-
101+
108102
<v-text-field
109103
v-model.number="editedElo"
110104
label="ELO Rating (optional)"
@@ -128,7 +122,7 @@ tags: tagC"
128122
</v-card-actions>
129123
</v-card>
130124
</v-dialog>
131-
125+
132126
<v-row>
133127
<v-col cols="12">
134128
<!-- Button for initial parsing -->
@@ -166,7 +160,7 @@ tags: tagC"
166160
@click="resetToInputStage"
167161
>
168162
<v-icon start>mdi-pencil</v-icon>
169-
Edit Again
163+
Back to bulk-editor.
170164
</v-btn>
171165
<v-btn
172166
v-if="importAttempted"
@@ -230,8 +224,7 @@ import {
230224
isValidBulkFormat,
231225
} from '@vue-skuilder/common';
232226
import { BlanksCardDataShapes, allCourses } from '@vue-skuilder/courses';
233-
import { ViewComponent } from '@vue-skuilder/common-ui/src/composables';
234-
import { getCurrentUser, alertUser } from '@vue-skuilder/common-ui/src/index';
227+
import { ViewComponent, getCurrentUser, alertUser } from '@vue-skuilder/common-ui';
235228
import {
236229
getDataLayer,
237230
CourseDBInterface,
@@ -314,91 +307,88 @@ export default defineComponent({
314307
// The card is already removed from the parsedCards array via v-model
315308
// This method can be used for additional processing if needed
316309
console.log(`[BulkImportView] Card at index ${index} was deleted`);
317-
310+
318311
// Show alert to confirm deletion
319312
alertUser({
320313
text: 'Card removed from import list',
321-
status: Status.warning, // Use warning instead of info
314+
status: Status.info,
322315
});
323316
},
324-
317+
325318
handleEditCard(card: ParsedCard, index: number) {
326319
// Disable keyboard shortcuts while editing
327320
if (this.$refs.cardPreviewList) {
328-
const previewComp = this.$refs.cardPreviewList as { toggleShortcuts: (enable: boolean) => void };
329-
previewComp.toggleShortcuts(false);
321+
(this.$refs.cardPreviewList as any).toggleShortcuts(false);
330322
}
331-
323+
332324
this.editingCard = { ...card }; // Create a copy
333325
this.editingCardIndex = index;
334326
this.editedMarkdown = card.markdown;
335327
this.editedTags = [...card.tags];
336328
this.editedElo = card.elo;
337329
this.showEditDialog = true;
338-
330+
339331
// Focus the text area after dialog opens
340332
this.$nextTick(() => {
341333
if (this.$refs.markdownTextarea) {
342-
const textareaComp = this.$refs.markdownTextarea as { $el: HTMLElement; focus?: () => void };
343-
textareaComp.$el.querySelector('textarea')?.focus();
334+
(this.$refs.markdownTextarea as any).$el.querySelector('textarea')?.focus();
344335
}
345336
});
346337
},
347-
338+
348339
saveEditedCard() {
349340
if (this.editingCardIndex < 0 || !this.editingCard) return;
350-
341+
351342
// Create updated card
352343
const updatedCard: ParsedCard = {
353344
markdown: this.editedMarkdown,
354345
tags: this.editedTags,
355346
elo: this.editedElo,
356347
};
357-
348+
358349
// Update the card in the array
359350
const updatedCards = [...this.parsedCards];
360351
updatedCards[this.editingCardIndex] = updatedCard;
361352
this.parsedCards = updatedCards;
362-
353+
363354
// Reset editing state
364355
this.closeEditDialog();
365-
356+
366357
// Show alert to confirm edit
367358
alertUser({
368359
text: 'Card updated successfully',
369-
status: Status.ok,
360+
status: Status.success,
370361
});
371362
},
372-
363+
373364
closeEditDialog() {
374365
this.showEditDialog = false;
375366
this.editingCard = null;
376367
this.editingCardIndex = -1;
377368
this.editedMarkdown = '';
378369
this.editedTags = [];
379370
this.editedElo = undefined;
380-
371+
381372
// Re-enable keyboard shortcuts after editing
382373
setTimeout(() => {
383374
if (this.$refs.cardPreviewList) {
384-
const previewComp = this.$refs.cardPreviewList as { toggleShortcuts: (enable: boolean) => void };
385-
previewComp.toggleShortcuts(true);
375+
(this.$refs.cardPreviewList as any).toggleShortcuts(true);
386376
}
387377
}, 100);
388378
},
389-
379+
390380
addTag() {
391381
const newTag = this.newTagText.trim();
392382
if (newTag && !this.editedTags.includes(newTag)) {
393383
this.editedTags.push(newTag);
394384
this.newTagText = '';
395385
}
396386
},
397-
387+
398388
removeTag(tag: string) {
399-
this.editedTags = this.editedTags.filter(t => t !== tag);
389+
this.editedTags = this.editedTags.filter((t) => t !== tag);
400390
},
401-
391+
402392
initializeCardPreviewComponents() {
403393
// Use the first data shape from the course config
404394
const configDataShape = this.courseCfg?.dataShapes?.[0];
@@ -592,7 +582,7 @@ export default defineComponent({
592582
// this.bulkText = ''; // Clear input text
593583
// this.parsingComplete = false; // Go back to input stage
594584
// this.parsedCards = [];
595-
alertUser({ text: `${this.results.length} card(s) imported successfully!`, status: Status.ok });
585+
alertUser({ text: `${this.results.length} card(s) imported successfully!`, status: Status.success });
596586
} else if (this.results.some((r) => r.status === 'error')) {
597587
alertUser({ text: 'Some cards failed to import. Please review the results below.', status: Status.warning });
598588
}

0 commit comments

Comments
 (0)