1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-21 21:33:18 +01:00

chore: cleans up logging context (#3136)

This commit is contained in:
Amir Raminfar
2024-07-22 13:57:27 -07:00
committed by GitHub
parent 989a650f12
commit d2015fdebd
11 changed files with 32 additions and 47 deletions

View File

@@ -8,12 +8,11 @@
</header>
<main :data-scrolling="scrollable ? true : undefined" class="snap-y overflow-auto">
<div class="invisible mr-28 text-right md:visible" v-show="paused">
<ScrollProgress :indeterminate="loading" :auto-hide="!loading" class="!fixed top-16 z-10" />
<ScrollProgress :indeterminate="loadingMore" :auto-hide="!loadingMore" class="!fixed top-16 z-10" />
</div>
<div ref="scrollableContent">
<slot :setLoading="setLoading"></slot>
<slot></slot>
</div>
<div ref="scrollObserver" class="h-px"></div>
</main>
@@ -37,12 +36,13 @@ const { scrollable = false } = defineProps<{ scrollable?: boolean }>();
let paused = $ref(false);
let hasMore = $ref(false);
let loading = $ref(false);
const scrollObserver = ref<HTMLElement>();
const scrollableContent = ref<HTMLElement>();
provide("scrollingPaused", $$(paused));
const { loadingMore } = useLoggingContext();
const mutationObserver = new MutationObserver((e) => {
if (!paused) {
scrollToBottom();
@@ -69,10 +69,6 @@ function scrollToBottom(behavior: "auto" | "smooth" = "auto") {
scrollObserver.value?.scrollIntoView({ behavior });
hasMore = false;
}
function setLoading(value: boolean) {
loading = value;
}
</script>
<style scoped lang="postcss">
.fade-enter-active,