Skip to content

Commit c9c303e

Browse files
committed
fix: rename "Save Current" to "Save Pricessed" button and hide it, when all records are processed.
Make progress bar use primary color https://web.tracklify.com/project/2b7ZVgE5/AdminForth/1499/HFt2cpR4/1)-what-does-current-mean-if-t
1 parent 9a56e83 commit c9c303e

1 file changed

Lines changed: 36 additions & 33 deletions

File tree

custom/VisionAction.vue

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,7 @@
1616
:closable="false"
1717
:askForCloseConfirmation="popupMode === 'generation' ? true : false"
1818
:closeConfirmationText="t('Are you sure you want to close without saving?')"
19-
:buttons="popupMode === 'generation' ? [
20-
{
21-
label: checkedCount > 1 ? t('Save fields') : t('Save field'),
22-
options: {
23-
disabled: isLoading || checkedCount < 1 || isFetchingRecords || isProcessingAny || isGenerationPaused,
24-
loader: isLoading, class: 'w-fit'
25-
},
26-
onclick: async (dialog) => { await saveData(); dialog.hide(); }
27-
},
28-
{
29-
label: t('Save current'),
30-
options: {
31-
disabled: isLoading || isSavingCurrent || completedRecordIds.size < 1,
32-
loader: isSavingCurrent, class: 'w-fit'
33-
},
34-
onclick: async () => { await saveCurrentGenerated(); }
35-
},
36-
{
37-
label: t('Cancel'),
38-
options: {
39-
class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
40-
},
41-
onclick: (dialog) => confirmDialog.tryToHideModal()
42-
},
43-
] : popupMode === 'settings' ? [
19+
:buttons="popupMode === 'generation' ? generationModeButtons : popupMode === 'settings' ? [
4420
{
4521
label: t('Save settings'),
4622
options: {
@@ -50,13 +26,6 @@
5026
},
5127
] :
5228
[
53-
// {
54-
// label: t('Edit prompts'),
55-
// options: {
56-
// class: 'w-fit ml-auto'
57-
// },
58-
// onclick: (dialog) => { clickSettingsButton(); }
59-
// },
6029
{
6130
label: t('Cancel'),
6231
options: {
@@ -105,7 +74,7 @@
10574
:aria-valuemax="totalRecords"
10675
>
10776
<div
108-
class="h-full bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 transition-all duration-200 "
77+
class="h-full bg-gradient-to-r from-lightPrimary/70 via-lightPrimary/80 to-lightPrimary/90 dark:from-darkPrimary/70 dark:via-darkPrimary/80 dark:to-darkPrimary/90 transition-all duration-200 "
10978
:style="{ width: `${displayedProgressPercent}%` }"
11079
></div>
11180
<div class="absolute inset-0 flex items-center justify-center text-sm font-medium text-white drop-shadow">
@@ -328,6 +297,40 @@ const recordsList = computed(() => {
328297
: recordIds.value;
329298
return ids.map(id => getOrCreateRecord(id));
330299
});
300+
301+
const generationModeButtons = computed(() => {
302+
const arrayToReturn = [
303+
{
304+
label: checkedCount.value > 1 ? t('Save fields') : t('Save field'),
305+
options: {
306+
disabled: isLoading.value || checkedCount.value < 1 || isFetchingRecords.value || isProcessingAny.value || isGenerationPaused.value,
307+
loader: isLoading.value, class: 'w-fit'
308+
},
309+
onclick: async (dialog) => { await saveData(); dialog.hide(); }
310+
},
311+
{
312+
label: t('Cancel'),
313+
options: {
314+
class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
315+
},
316+
onclick: (dialog) => confirmDialog.value.tryToHideModal()
317+
},
318+
]
319+
320+
if (isProcessingAny.value) {
321+
arrayToReturn.splice(1, 0, {
322+
label: t('Save processed'),
323+
options: {
324+
disabled: isLoading.value || isSavingCurrent.value || completedRecordIds.value.size < 1,
325+
loader: isSavingCurrent.value, class: 'w-fit'
326+
},
327+
onclick: async () => { await saveCurrentGenerated(); }
328+
})
329+
}
330+
return arrayToReturn;
331+
});
332+
333+
331334
const isSavingCurrent = ref(false);
332335
function checkIfDialogOpen() {
333336
return isDialogOpen.value === true;

0 commit comments

Comments
 (0)