mirror of
https://github.com/vrcx-team/VRCX.git
synced 2026-04-06 00:32:02 +02:00
Discord profile badge
This commit is contained in:
@@ -46,6 +46,18 @@ namespace VRCX
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenDiscordProfile(string discordId)
|
||||
{
|
||||
if (!long.TryParse(discordId, out _))
|
||||
throw new Exception("Invalid user ID");
|
||||
|
||||
var uri = $"discord://-/users/{discordId}";
|
||||
Process.Start(new ProcessStartInfo(uri)
|
||||
{
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
|
||||
public string GetLaunchCommand()
|
||||
{
|
||||
var command = StartupArgs.LaunchArguments.LaunchCommand;
|
||||
|
||||
@@ -291,6 +291,11 @@ i.x-status-icon.red {
|
||||
border-color: #3b82f6 !important;
|
||||
}
|
||||
|
||||
.x-tag-discord {
|
||||
color: #7289da;
|
||||
border-color: #7289da !important;
|
||||
}
|
||||
|
||||
.x-tag-border-left {
|
||||
border-left: 0.8px solid;
|
||||
margin-left: 5px;
|
||||
|
||||
@@ -121,6 +121,19 @@
|
||||
{{ userDialog.mutualFriendCount }}
|
||||
</Badge>
|
||||
</TooltipWrapper>
|
||||
<TooltipWrapper
|
||||
v-if="userDialog.ref.discordId"
|
||||
side="top"
|
||||
:content="t('dialog.user.tags.open_in_discord')">
|
||||
<Badge
|
||||
variant="outline"
|
||||
class="x-tag-discord cursor-pointer"
|
||||
style="margin-right: 5px; margin-top: 5px"
|
||||
@click="openDiscordProfile(userDialog.ref.discordId)">
|
||||
<i class="ri-discord-line mr-1 h-4 w-4 inline-block" style="height: 1em; width: 1em"></i>
|
||||
{{ t('dialog.user.tags.discord') }}
|
||||
</Badge>
|
||||
</TooltipWrapper>
|
||||
<Badge
|
||||
v-if="userDialog.ref.$isTroll"
|
||||
variant="outline"
|
||||
@@ -272,7 +285,13 @@
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import { formatDateFilter, languageClass, userImage, userStatusClass } from '../../../shared/utils';
|
||||
import {
|
||||
formatDateFilter,
|
||||
languageClass,
|
||||
openDiscordProfile,
|
||||
userImage,
|
||||
userStatusClass
|
||||
} from '../../../shared/utils';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '../../ui/popover';
|
||||
import { useGalleryStore, useUserStore } from '../../../stores';
|
||||
import { Badge } from '../../ui/badge';
|
||||
|
||||
@@ -1027,7 +1027,9 @@
|
||||
"18_plus_verified": "18+ Verified",
|
||||
"age_verified": "Age Verified",
|
||||
"trust_level": "Trust Level",
|
||||
"mutual_friends": "Mutual Friends"
|
||||
"mutual_friends": "Mutual Friends",
|
||||
"open_in_discord": "Open in Discord",
|
||||
"discord": "Discord"
|
||||
},
|
||||
"badges": {
|
||||
"assigned": "Assigned",
|
||||
|
||||
@@ -421,6 +421,17 @@ function openExternalLink(link) {
|
||||
});
|
||||
}
|
||||
|
||||
function openDiscordProfile(discordId) {
|
||||
if (!discordId) {
|
||||
toast.error('No Discord ID provided!');
|
||||
return;
|
||||
}
|
||||
AppApi.OpenDiscordProfile(discordId).catch((err) => {
|
||||
console.error('Failed to open Discord profile:', err);
|
||||
toast.error('Failed to open Discord profile!');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {object} ref
|
||||
@@ -537,6 +548,7 @@ export {
|
||||
buildTreeData,
|
||||
replaceBioSymbols,
|
||||
openExternalLink,
|
||||
openDiscordProfile,
|
||||
getBundleDateSize,
|
||||
openFolderGeneric,
|
||||
debounce
|
||||
|
||||
@@ -92,6 +92,11 @@ export const useUserStore = defineStore('User', () => {
|
||||
currentAvatarThumbnailImageUrl: '',
|
||||
date_joined: '',
|
||||
developerType: '',
|
||||
discordDetails: {
|
||||
global_name: '',
|
||||
id: ''
|
||||
},
|
||||
discordId: '',
|
||||
displayName: '',
|
||||
emailVerified: false,
|
||||
fallbackAvatar: '',
|
||||
@@ -491,6 +496,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
currentAvatarThumbnailImageUrl: '',
|
||||
date_joined: '',
|
||||
developerType: '',
|
||||
discordId: '',
|
||||
displayName: '',
|
||||
friendKey: '',
|
||||
friendRequestStatus: '',
|
||||
@@ -1836,6 +1842,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
currentAvatarThumbnailImageUrl: '',
|
||||
date_joined: '',
|
||||
developerType: '',
|
||||
discordId: '',
|
||||
displayName: '',
|
||||
emailVerified: false,
|
||||
fallbackAvatar: '',
|
||||
@@ -1991,6 +1998,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
currentAvatarThumbnailImageUrl: json.currentAvatarThumbnailImageUrl,
|
||||
date_joined: json.date_joined,
|
||||
developerType: json.developerType,
|
||||
discordId: json.discordId,
|
||||
displayName: json.displayName,
|
||||
friendKey: json.friendKey,
|
||||
// json.friendRequestStatus - missing from currentUser
|
||||
|
||||
1
src/types/api/user.d.ts
vendored
1
src/types/api/user.d.ts
vendored
@@ -133,6 +133,7 @@ interface GetUserResponse {
|
||||
currentAvatarThumbnailImageUrl: string;
|
||||
date_joined: string;
|
||||
developerType: string;
|
||||
discordId: string;
|
||||
displayName: string;
|
||||
friendKey: string;
|
||||
friendRequestStatus?: string;
|
||||
|
||||
1
src/types/globals.d.ts
vendored
1
src/types/globals.d.ts
vendored
@@ -191,6 +191,7 @@ declare global {
|
||||
// Common Functions
|
||||
GetColourFromUserID(userId: string): Promise<number>;
|
||||
OpenLink(url: string): Promise<void>;
|
||||
OpenDiscordProfile(discordId: string): Promise<void>;
|
||||
GetLaunchCommand(): Promise<string>;
|
||||
IPCAnnounceStart(): Promise<void>;
|
||||
SendIpc(type: string, data: string): Promise<void>;
|
||||
|
||||
Reference in New Issue
Block a user