mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-23 08:43:50 +02:00
adjust Location component to optionally enable context menu
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<ContextMenu>
|
<component :is="enableContextMenu ? ContextMenu : Passthrough">
|
||||||
<ContextMenuTrigger as-child>
|
<component :is="enableContextMenu ? ContextMenuTrigger : Passthrough" as-child>
|
||||||
<div class="cursor-pointer">
|
<div class="cursor-pointer">
|
||||||
<div v-if="!text" class="text-transparent">-</div>
|
<div v-if="!text" class="text-transparent">-</div>
|
||||||
<div v-show="text" class="flex items-center">
|
<div v-show="text" class="flex items-center">
|
||||||
@@ -39,8 +39,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ContextMenuTrigger>
|
</component>
|
||||||
<ContextMenuContent v-if="parsedLocation.isRealInstance && parsedLocation.worldId">
|
<ContextMenuContent v-if="enableContextMenu && parsedLocation.isRealInstance && parsedLocation.worldId">
|
||||||
<WorldActionMenuItems
|
<WorldActionMenuItems
|
||||||
:can-open-instance-in-game="canOpenInstanceInGame"
|
:can-open-instance-in-game="canOpenInstanceInGame"
|
||||||
:show-share="true"
|
:show-share="true"
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
@self-invite="handleNewInstanceSelfInvite"
|
@self-invite="handleNewInstanceSelfInvite"
|
||||||
@show-previous-instances="handleShowPreviousInstances" />
|
@show-previous-instances="handleShowPreviousInstances" />
|
||||||
</ContextMenuContent>
|
</ContextMenuContent>
|
||||||
</ContextMenu>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -83,6 +83,8 @@
|
|||||||
import WorldActionMenuItems from './WorldActionMenuItems.vue';
|
import WorldActionMenuItems from './WorldActionMenuItems.vue';
|
||||||
import { accessTypeLocaleKeyMap } from '../shared/constants';
|
import { accessTypeLocaleKeyMap } from '../shared/constants';
|
||||||
|
|
||||||
|
const Passthrough = (_, { slots }) => slots.default?.();
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const { cachedWorlds } = useWorldStore();
|
const { cachedWorlds } = useWorldStore();
|
||||||
@@ -115,6 +117,10 @@
|
|||||||
isOpenPreviousInstanceInfoDialog: {
|
isOpenPreviousInstanceInfoDialog: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
|
},
|
||||||
|
enableContextMenu: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
:location="item.location"
|
:location="item.location"
|
||||||
:hint="item.worldName"
|
:hint="item.worldName"
|
||||||
:grouphint="item.groupName"
|
:grouphint="item.groupName"
|
||||||
|
enable-context-menu
|
||||||
disable-tooltip />
|
disable-tooltip />
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.type === 'Online'">
|
<template v-else-if="item.type === 'Online'">
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
:location="item.location"
|
:location="item.location"
|
||||||
:hint="item.worldName"
|
:hint="item.worldName"
|
||||||
:grouphint="item.groupName"
|
:grouphint="item.groupName"
|
||||||
|
enable-context-menu
|
||||||
disable-tooltip />
|
disable-tooltip />
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
:location="item.location"
|
:location="item.location"
|
||||||
:hint="item.worldName"
|
:hint="item.worldName"
|
||||||
:grouphint="item.groupName"
|
:grouphint="item.groupName"
|
||||||
|
enable-context-menu
|
||||||
disable-tooltip />
|
disable-tooltip />
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="item.type === 'OnPlayerJoined'">
|
<template v-else-if="item.type === 'OnPlayerJoined'">
|
||||||
@@ -104,6 +105,7 @@
|
|||||||
class="inline [&>div]:inline-flex"
|
class="inline [&>div]:inline-flex"
|
||||||
:location="item.location"
|
:location="item.location"
|
||||||
:hint="item.worldName"
|
:hint="item.worldName"
|
||||||
|
enable-context-menu
|
||||||
disable-tooltip />
|
disable-tooltip />
|
||||||
<span v-else class="text-muted-foreground">{{ item.worldName || '' }}</span>
|
<span v-else class="text-muted-foreground">{{ item.worldName || '' }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ const expandedRow = ({ row }) => {
|
|||||||
<Location
|
<Location
|
||||||
location={original.previousLocation}
|
location={original.previousLocation}
|
||||||
class="inline-block"
|
class="inline-block"
|
||||||
|
enableContextMenu
|
||||||
/>
|
/>
|
||||||
<Badge variant="secondary" class="ml-1 w-fit">
|
<Badge variant="secondary" class="ml-1 w-fit">
|
||||||
{timeToText(original.time)}
|
{timeToText(original.time)}
|
||||||
@@ -57,6 +58,7 @@ const expandedRow = ({ row }) => {
|
|||||||
location={original.location}
|
location={original.location}
|
||||||
hint={original.worldName}
|
hint={original.worldName}
|
||||||
grouphint={original.groupName}
|
grouphint={original.groupName}
|
||||||
|
enableContextMenu
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
@@ -70,6 +72,7 @@ const expandedRow = ({ row }) => {
|
|||||||
location={original.location}
|
location={original.location}
|
||||||
hint={original.worldName}
|
hint={original.worldName}
|
||||||
grouphint={original.groupName}
|
grouphint={original.groupName}
|
||||||
|
enableContextMenu
|
||||||
/>
|
/>
|
||||||
<Badge variant="secondary" class="ml-1 w-fit">
|
<Badge variant="secondary" class="ml-1 w-fit">
|
||||||
{timeToText(original.time)}
|
{timeToText(original.time)}
|
||||||
@@ -85,6 +88,7 @@ const expandedRow = ({ row }) => {
|
|||||||
location={original.location}
|
location={original.location}
|
||||||
hint={original.worldName}
|
hint={original.worldName}
|
||||||
grouphint={original.groupName}
|
grouphint={original.groupName}
|
||||||
|
enableContextMenu
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : null;
|
) : null;
|
||||||
@@ -323,6 +327,7 @@ export const columns = [
|
|||||||
location={original.location}
|
location={original.location}
|
||||||
hint={original.worldName}
|
hint={original.worldName}
|
||||||
grouphint={original.groupName}
|
grouphint={original.groupName}
|
||||||
|
enableContextMenu
|
||||||
disableTooltip
|
disableTooltip
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -336,6 +341,7 @@ export const columns = [
|
|||||||
location={original.location}
|
location={original.location}
|
||||||
hint={original.worldName}
|
hint={original.worldName}
|
||||||
grouphint={original.groupName}
|
grouphint={original.groupName}
|
||||||
|
enableContextMenu
|
||||||
disableTooltip
|
disableTooltip
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
class="friend-card__location flex w-full overflow-hidden leading-[1.3] wrap-break-word text-center"
|
class="friend-card__location flex w-full overflow-hidden leading-[1.3] wrap-break-word text-center"
|
||||||
:location="friend.ref?.location"
|
:location="friend.ref?.location"
|
||||||
:traveling="friend.ref?.travelingToLocation"
|
:traveling="friend.ref?.travelingToLocation"
|
||||||
|
enable-context-menu
|
||||||
link />
|
link />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ export const createColumns = ({ getCreatedAt, onDelete, onDeletePrompt }) => {
|
|||||||
location={original.location}
|
location={original.location}
|
||||||
hint={original.worldName}
|
hint={original.worldName}
|
||||||
grouphint={original.groupName}
|
grouphint={original.groupName}
|
||||||
|
enableContextMenu
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -149,6 +150,7 @@ export const createColumns = ({ getCreatedAt, onDelete, onDeletePrompt }) => {
|
|||||||
location={original.instanceId}
|
location={original.instanceId}
|
||||||
hint={original.worldName}
|
hint={original.worldName}
|
||||||
grouphint={original.groupName}
|
grouphint={original.groupName}
|
||||||
|
enableContextMenu
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user