Skip to content

A self-hosted media server and file management system

fix: selected context menu item styles

aminnausin3a3f997831b6
diff --git a/resources/js/components/cedar-ui/context-menu/ContextMenuItem.vue b/resources/js/components/cedar-ui/context-menu/ContextMenuItem.vue
index 99ca93e1..11647a22 100644
--- a/resources/js/components/cedar-ui/context-menu/ContextMenuItem.vue
+++ b/resources/js/components/cedar-ui/context-menu/ContextMenuItem.vue
@@ -9,7 +9,7 @@ import { cn } from '@aminnausin/cedar-ui';
import ProiconsChevronRight from '~icons/proicons/chevron-right';
const props = withDefaults(defineProps<ContextMenuItem & { divider?: boolean; children?: ContextMenuItem[]; submenuStyle?: string; showLeftIcon?: boolean }>(), {
- selectedStyle: 'text-primary font-bold',
+ selectedStyle: 'dark:text-primary',
showLeftIcon: true,
});
@@ -36,7 +36,6 @@ useMutationObserver(subMenu, () => (isFloating.value = subMenu.value?.dataset.fl
v-bind="wrapperProps"
:class="
cn(
- { [selectedStyle]: selected },
'hocus:bg-overlay-accent focus-visible:ring-foreground-0 h-7 w-full justify-start rounded-md px-2 py-1.5 ring ring-transparent select-none ring-inset focus:outline-none dark:focus-visible:bg-neutral-950/90',
style,
)
@@ -55,8 +54,7 @@ useMutationObserver(subMenu, () => (isFloating.value = subMenu.value?.dataset.fl
"
>
<slot name="icon" v-if="showLeftIcon">
- <component v-if="icon" :is="icon" class="h-5 w-auto shrink-0" />
- <span v-else class="size-4 shrink-0" />
+ <component :is="icon ?? 'span'" :class="cn('shrink-0', icon ? 'h-4 w-auto' : 'size-4', { [selectedStyle]: selected })" />
</slot>
<span class="mr-auto truncate text-nowrap">
<slot>
diff --git a/resources/js/components/video/VideoPlayer.vue b/resources/js/components/video/VideoPlayer.vue
index 8c8e9e30..9c03922a 100755
--- a/resources/js/components/video/VideoPlayer.vue
+++ b/resources/js/components/video/VideoPlayer.vue
@@ -294,65 +294,70 @@ const progressTooltip = computed(() => timeline.value?.progressTooltip);
// const url = ref('');
-const playerContextMenuItems = computed<ContextMenuItem[]>(() => [
- {
- text: 'Loop',
- icon: isLooping.value ? ProiconsCheckmark : undefined,
- action: () => {
- isLooping.value = !isLooping.value;
+const playerContextMenuItems = computed<ContextMenuItem[]>(() =>
+ [
+ {
+ text: 'Loop',
+ icon: isLooping.value ? ProiconsCheckmark : undefined,
+ selected: isLooping.value,
+ action: () => {
+ isLooping.value = !isLooping.value;
+ },
},
- },
- {
- text: 'Player Stats',
- icon: isShowingStats.value ? ProiconsCheckmark : undefined,
- action: () => {
- isShowingStats.value = !isShowingStats.value;
+ {
+ text: 'Player Stats',
+ icon: isShowingStats.value ? ProiconsCheckmark : undefined,
+ selected: isShowingStats.value,
+ action: () => {
+ isShowingStats.value = !isShowingStats.value;
+ },
},
- },
- {
- text: 'Watch Party',
- icon: isShowingParty.value ? ProiconsCheckmark : undefined,
- selected: isShowingParty.value,
- disabled: !userData.value?.id,
- action: () => {
- isShowingParty.value = !isShowingParty.value;
+ {
+ text: 'Watch Party',
+ icon: isShowingParty.value ? ProiconsCheckmark : undefined,
+ selected: isShowingParty.value,
+ disabled: !userData.value?.id,
+ action: () => {
+ isShowingParty.value = !isShowingParty.value;
+ },
},
- },
- {
- text: 'Show Miniplayer',
- icon: isPictureInPicture.value ? ProiconsCheckmark : undefined,
- hidden: !document.pictureInPictureEnabled || isAudio.value,
- action: () => {
- if (isLoading.value) return;
- togglePictureInPicture();
+ {
+ text: 'Show Miniplayer',
+ icon: isPictureInPicture.value ? ProiconsCheckmark : undefined,
+ selected: isPictureInPicture.value,
+ hidden: !document.pictureInPictureEnabled || isAudio.value,
+ action: () => {
+ if (isLoading.value) return;
+ togglePictureInPicture();
+ },
},
- },
- {
- text: 'Audio Graph Menu',
- icon: isShowingAudioGraphSettings.value ? ProiconsCheckmark : undefined,
- selected: isShowingAudioGraphSettings.value,
- hidden: !isAudioGraphEnabled.value,
- action: () => {
- isShowingAudioGraphSettings.value = !isShowingAudioGraphSettings.value;
+ {
+ text: 'Audio Graph Menu',
+ icon: isShowingAudioGraphSettings.value ? ProiconsCheckmark : undefined,
+ selected: isShowingAudioGraphSettings.value,
+ hidden: !isAudioGraphEnabled.value,
+ action: () => {
+ isShowingAudioGraphSettings.value = !isShowingAudioGraphSettings.value;
+ },
},
- },
- {
- text: 'Save Frame',
- hidden: isAudio.value,
- action: () => {
- if (!player.value) return;
- saveVideoFrame(player.value);
+ {
+ text: 'Save Frame',
+ hidden: isAudio.value,
+ action: () => {
+ if (!player.value) return;
+ saveVideoFrame(player.value);
+ },
},
- },
- {
- text: 'Copy Frame',
- hidden: isAudio.value,
- action: () => {
- if (!player.value) return;
- copyVideoFrame(player.value);
+ {
+ text: 'Copy Frame',
+ hidden: isAudio.value,
+ action: () => {
+ if (!player.value) return;
+ copyVideoFrame(player.value);
+ },
},
- },
-]);
+ ].map((item) => ({ ...item, selectedStyle: '' })),
+);
const videoPopoverItems = computed(() => {
const items: PopoverItem[] = [