Skip to content

Commit 19491b3

Browse files
authored
hide progress popover after 10 seconds (#2410)
1 parent 46d4ca2 commit 19491b3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

frontend/src/components/ProgressCard.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,25 @@ const { t } = useI18n({
4141
useScope: 'local',
4242
});
4343
44+
const POPOVER_TIMEOUT = 10000; // 10 seconds
4445
const popoverRef = ref();
45-
function togglePopover(event: Event) {
46+
const popoverTimeout = ref<ReturnType<typeof setTimeout> | null>(null);
47+
function togglePopover(event: MouseEvent) {
48+
if (!popoverRef.value) return;
49+
4650
popoverRef.value.toggle(event);
51+
52+
if (popoverTimeout.value) {
53+
clearTimeout(popoverTimeout.value);
54+
popoverTimeout.value = null;
55+
}
56+
57+
popoverTimeout.value = setTimeout(() => {
58+
popoverRef.value?.hide();
59+
popoverTimeout.value = null;
60+
}, POPOVER_TIMEOUT);
4761
}
62+
4863
const MIN_PROGRESS_FOR_ESTIMATION = 0.05; // wait 5% progress for estimation
4964
const MIN_ELAPSED_FOR_ESTIMATION = 5 * 1000; // wait 5 seconds for estimation
5065
const SUFFICIENT_ITEMS_FOR_ESTIMATION = 100; // estimate right away if >=100 items treated

0 commit comments

Comments
 (0)