Skip to content

Commit

Permalink
wip: leave on esc
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunari8546 committed Jan 21, 2025
1 parent 5471563 commit 99afd18
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pages/live/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<NuxtLink to="/atelier">Return</NuxtLink>
</div>
<div
v-else
@click="prevSlides()"
@contextmenu.prevent="nextSlides()"
@keydown.enter.space.right="nextSlides()"
Expand Down Expand Up @@ -46,6 +47,14 @@ const client = useSupabaseClient<Database>();
const { fetchDeck, fetchAllSlides, nextSlides, prevSlides } = useDeckStore();
const { slides, currentSlidesIndex } = storeToRefs(useDeckStore());
const { isFullscreen } = useFullscreen();
watch(isFullscreen, (isFullscreen) => {
if (!isFullscreen) {
leavePresentation();
}
});
const cursorMoved = ref(false);
function onCursorMoved() {
Expand All @@ -58,6 +67,10 @@ function onCursorMoved() {
}, 5000);
}
function leavePresentation() {
navigateTo(`/atelier/${deck.value?.id}`);
}
let deckRC: RealtimeChannel, slidesRC: RealtimeChannel;
const { data: deck, refresh: refreshDeck } = await useAsyncData(
Expand Down Expand Up @@ -107,8 +120,6 @@ onMounted(() => {
});
onUnmounted(() => {
document.exitFullscreen();
client.removeAllChannels();
});
</script>

0 comments on commit 99afd18

Please sign in to comment.