Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/renderer/src/components/ClipDetail/ClipDetailModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import { useClipNeighbours } from '@renderer/composables/clips/useClipNeighbours
* with the video, which gave real weight to the one thing nobody opens a clip
* to find out. Still there, and now they read as a footnote.
*/
const { openClipId, view, close, show, back, open } = useClipDetail();
const { openClipId, view, close, show, back, open, countsAsOpen } = useClipDetail();
const toastStore = useToastStore();
const collectionsStore = useCollectionsStore();

Expand Down Expand Up @@ -112,9 +112,12 @@ watch(
* Here rather than anywhere finer grained: this watcher fires once per
* open, where a Range request fires several times a second.
*/
void recordClipOpened(id).catch((error) => {
console.debug('Could not record that this clip was opened:', error);
});
// Not when Storage Saver opened it: see `countsAsOpen`.
if (countsAsOpen.value) {
void recordClipOpened(id).catch((error) => {
console.debug('Could not record that this clip was opened:', error);
});
}

// A clip opened after another should not inherit the last one's expanded
// date or a half-open sheet.
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/components/Storage/StorageClipTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const frame = computed(() => [
type="button"
:class="['group/pic relative block w-full aspect-21/9 bg-video-bed cursor-pointer', FOCUS_RING]"
:aria-label="`Watch ${title}`"
@click="openClip(clip.id)"
@click="openClip(clip.id, 'details', { countAsOpen: false })"
@mousemove="preview"
@mouseleave="stopPreview"
>
Expand Down
18 changes: 17 additions & 1 deletion src/renderer/src/composables/clips/useClipDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,29 @@ const view = ref<ClipView>('details');
*/
const cameFrom = ref<'library' | 'details'>('details');

/**
* Whether this opening counts as somebody watching the clip.
*
* False only when Storage Saver opens it. That screen lists the clips nobody
* ever opened, and a look is how somebody there decides whether to delete
* one, so counting it would take the clip off the list the moment it was
* watched: it could never be deleted from the screen that exists to delete
* it. Held for as long as the layer is open, so stepping to the next clip
* inside it does not start counting, and put back on close.
*/
const countsAsOpen = ref(true);

export function useClipDetail() {
return {
openClipId,
view,
cameFrom,

countsAsOpen,

/** Open the layer from nothing, on whichever panel was asked for. */
open: (id: number, as: ClipView = 'details') => {
open: (id: number, as: ClipView = 'details', options: { countAsOpen?: boolean } = {}) => {
countsAsOpen.value = options.countAsOpen ?? true;
openClipId.value = id;
view.value = as;
cameFrom.value = 'library';
Expand Down Expand Up @@ -81,6 +96,7 @@ export function useClipDetail() {
* to reset.
*/
close: () => {
countsAsOpen.value = true;
openClipId.value = null;
},
};
Expand Down
Loading