Skip to content

Commit 653e6f8

Browse files
committed
feat: reset video player state
- Reset adn load when switching videos - Make icon and name clickable to reset
1 parent 4a4423c commit 653e6f8

File tree

1 file changed

+80
-8
lines changed

1 file changed

+80
-8
lines changed

frontend/src/App.vue

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,18 @@
1010

1111
<!-- Logo and title (hidden on mobile when menu closed) -->
1212
<div class="logo-container" :class="{ 'mobile-hidden': !mobileMenuOpen }">
13-
<img src="./assets/logo.svg" alt="Archive Player Logo" class="logo" />
14-
<h1>Archive Player</h1>
13+
<img
14+
src="./assets/logo.svg"
15+
alt="Archive Player Logo"
16+
class="logo clickable"
17+
@click="resetPlayer"
18+
title="Reset player"
19+
/>
20+
<h1
21+
class="clickable"
22+
@click="resetPlayer"
23+
title="Reset player"
24+
>Archive Player</h1>
1525
</div>
1626

1727
<!-- Controls (desktop only) -->
@@ -45,8 +55,18 @@
4555
<div class="mobile-menu" :class="{ 'mobile-menu-open': mobileMenuOpen }">
4656
<!-- Logo and title in mobile menu -->
4757
<div class="mobile-menu-header">
48-
<img src="./assets/logo.svg" alt="Archive Player Logo" class="logo" />
49-
<h1>Archive Player</h1>
58+
<img
59+
src="./assets/logo.svg"
60+
alt="Archive Player Logo"
61+
class="logo clickable"
62+
@click="resetPlayer"
63+
title="Reset player"
64+
/>
65+
<h1
66+
class="clickable"
67+
@click="resetPlayer"
68+
title="Reset player"
69+
>Archive Player</h1>
5070
</div>
5171

5272
<div class="mobile-menu-buttons">
@@ -304,9 +324,44 @@ export default defineComponent({
304324
showIntegrationsMenu.value = false;
305325
};
306326
327+
const resetVideoState = () => {
328+
// Reset video-related state
329+
videoSrc.value = '';
330+
videoLoaded.value = false;
331+
currentTime.value = 0;
332+
333+
// Reset chat-related state
334+
resetChat();
335+
};
336+
337+
const resetPlayer = () => {
338+
// Reset video state
339+
resetVideoState();
340+
341+
// Reset UI states
342+
showSettings.value = false;
343+
showRecentVideos.value = false;
344+
showFanslyBrowser.value = false;
345+
showAnyOtherIntegration.value = false;
346+
theaterMode.value = false;
347+
348+
// Reset video info
349+
videoInfo.value = { filename: '', path: '' };
350+
351+
// Close mobile menu if open
352+
if (mobileMenuOpen.value) {
353+
toggleMobileMenu();
354+
}
355+
356+
console.log('Player state reset');
357+
};
358+
307359
const loadFanslyStream = async (result: any) => {
308360
if (result.success) {
309361
try {
362+
// Reset current video state first
363+
resetVideoState();
364+
310365
// Load the video using the same function as loadRecentVideo
311366
const videoPath = await LoadVideoFromPath(result.videoPath);
312367
videoSrc.value = videoPath;
@@ -445,6 +500,9 @@ export default defineComponent({
445500
446501
const openVideoFile = async () => {
447502
try {
503+
// Reset current video state first
504+
resetVideoState();
505+
448506
const videoUrl = await OpenVideoFile();
449507
if (videoUrl) {
450508
videoSrc.value = videoUrl;
@@ -454,9 +512,6 @@ export default defineComponent({
454512
const info = await GetVideoFileInfo();
455513
videoInfo.value = info;
456514
457-
// Reset chat when loading a new video
458-
resetChat();
459-
460515
// Add to recent videos
461516
addToRecentVideos(info);
462517
}
@@ -609,6 +664,9 @@ export default defineComponent({
609664
// Function to load a video from recent videos
610665
const loadRecentVideo = async (video: RecentVideo) => {
611666
try {
667+
// Reset current video state first
668+
resetVideoState();
669+
612670
// Load the video
613671
const videoPath = await LoadVideoFromPath(video.path);
614672
console.log("Video loaded from recent:", videoPath);
@@ -742,14 +800,28 @@ export default defineComponent({
742800
activeIntegration,
743801
selectIntegration,
744802
showAnyOtherIntegration,
745-
toggleIntegrationPanel
803+
toggleIntegrationPanel,
804+
resetVideoState,
805+
resetPlayer
746806
};
747807
}
748808
});
749809
</script>
750810

751811

752812
<style>
813+
.clickable {
814+
cursor: pointer;
815+
transition: transform 0.2s ease;
816+
}
817+
818+
.clickable:hover {
819+
transform: scale(1.05);
820+
}
821+
822+
h1.clickable:hover {
823+
color: #b4befe; /* Catppuccin Mocha lavender - a slightly different color on hover */
824+
}
753825
/* Mobile-first approach */
754826
@media (max-width: 768px) {
755827
.header h1 {

0 commit comments

Comments
 (0)