mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
3324d0d279
* Update Vue devtools
* upgrade vue pinia element-plus vue-i18n, add vite
* fix: i18n
* global components
* change v-deep
* upgrade vue-lazyload
* data table
* update enlint and safe-dialog
* package.json and vite.config.js
* el-icon
* el-message
* vue 2 -> vue3 migration changes
* $pinia
* dialog
* el-popover slot
* lint
* chore
* slot
* scss
* remote state access
* misc
* jsconfig
* el-button size mini -> small
* :model-value
* ElMessageBox
* datatable
* remove v-lazyload
* template #dropdown
* mini -> small
* css
* byebye hideTooltips
* use sass-embedded
* Update SQLite, remove unneeded libraries
* Fix shift remove local avatar favorites
* Electron arm64
* arm64 support
* bye pug
* f-word vite hah
* misc
* remove safe dialog component
* Add self invite to launch dialog
* Fix errors
* Icons 1
* improve localfavorite loading performance
* improve favorites world item performance
* dialog visibility changes for Element Plus
* clear element plus error
* import performance
* revert App.vue hah
* hah
* Revert "Add self invite to launch dialog"
This reverts commit 4801cfad58.
* Toggle self invite/open in-game
* Self invite on launch dialog
* el-button icon
* el-icon
* fix user dialog tab switching logic
* fix PlayerList
* Formatting changes
* More icons
* Fix friend log table
* loading margin
* fix markdown
* fix world dialog tab switching issue
* Fixes and formatting
* fix: global i18n.t export
* fix favorites world tab not working
* Create instance, displayName
* Remove group members sort by userId
* Fix loading dialog tabs on swtich
* Star
* charts console.warn
* wip: fix charts
* wip: fix charts
* wip: charts composables
* fix favorite item tooltip warning
* Fixes and formatting
* Clean up image dialogs
* Remove unused method
* Fix platform/size border
* Fix platform/size border
* $vr
* fix friendExportDialogVisible binding
* ElMessageBox and Settings
* Login formatting
* Rename VR overlay query
* Fix image popover and userdialog badges
* Formatting
* Big buttons
* Fixes, update Cef
* Fix gameLog table nav buttons jumping around while using nav buttons
* Fix z-index
* vr overlay
* vite input add theme
* defineAsyncComponent
* ISO 639-1
* fix i18n
* clean t
* Formatting, fix calendar, rotate arrows
* Show user status when user is offline
* Fix VR overlay
* fix theme and clean up
* split InstanceActivity
* tweak
* Fix VR overlay formatting
* fix scss var
* AppDebug hahahaha
* Years
* remove reactive
* improve perf
* state hah…
* fix user rendering poblems when user object is not yet loaded
* improve perf
* Update avatar/world image uploader, licenses, remove previous images dialog (old images are now deleted)
* improve perf 1
* Suppress stray errors
* fix traveling location display issue
* Fix empty instance creator
* improve friend list refresh performance
* fix main charts
* fix chart
* Fix darkmode
* Fix avatar dialog tags
---------
Co-authored-by: pa <maplenagisa@gmail.com>
234 lines
8.6 KiB
Vue
234 lines
8.6 KiB
Vue
<template>
|
|
<el-dialog v-model="isDialogVisible" :title="t('dialog.avatar_export.header')" width="650px">
|
|
<el-checkbox-group
|
|
v-model="exportSelectedOptions"
|
|
style="margin-bottom: 10px"
|
|
@change="updateAvatarExportDialog()">
|
|
<template v-for="option in exportSelectOptions" :key="option.value">
|
|
<el-checkbox :label="option.label"></el-checkbox>
|
|
</template>
|
|
</el-checkbox-group>
|
|
|
|
<el-dropdown trigger="click" size="small">
|
|
<el-button size="small">
|
|
<span v-if="avatarExportFavoriteGroup">
|
|
{{ avatarExportFavoriteGroup.displayName }} ({{ avatarExportFavoriteGroup.count }}/{{
|
|
avatarExportFavoriteGroup.capacity
|
|
}})
|
|
<el-icon class="el-icon--right"><ArrowDown /></el-icon>
|
|
</span>
|
|
<span v-else>
|
|
All Favorites
|
|
<el-icon class="el-icon--right"><ArrowDown /></el-icon>
|
|
</span>
|
|
</el-button>
|
|
<template #dropdown>
|
|
<el-dropdown-menu>
|
|
<el-dropdown-item style="display: block; margin: 10px 0" @click="selectAvatarExportGroup(null)">
|
|
All Favorites
|
|
</el-dropdown-item>
|
|
<template v-for="groupAPI in favoriteAvatarGroups" :key="groupAPI.name">
|
|
<el-dropdown-item
|
|
style="display: block; margin: 10px 0"
|
|
@click="selectAvatarExportGroup(groupAPI)">
|
|
{{ groupAPI.displayName }} ({{ groupAPI.count }}/{{ groupAPI.capacity }})
|
|
</el-dropdown-item>
|
|
</template>
|
|
</el-dropdown-menu>
|
|
</template>
|
|
</el-dropdown>
|
|
|
|
<el-dropdown trigger="click" size="small" style="margin-left: 10px">
|
|
<el-button size="small">
|
|
<span v-if="avatarExportLocalFavoriteGroup">
|
|
{{ avatarExportLocalFavoriteGroup }} ({{
|
|
getLocalAvatarFavoriteGroupLength(avatarExportLocalFavoriteGroup)
|
|
}})
|
|
<el-icon class="el-icon--right"><ArrowDown /></el-icon>
|
|
</span>
|
|
<span v-else>
|
|
Select Group
|
|
<el-icon class="el-icon--right"><ArrowDown /></el-icon>
|
|
</span>
|
|
</el-button>
|
|
<template #dropdown>
|
|
<el-dropdown-menu>
|
|
<el-dropdown-item
|
|
style="display: block; margin: 10px 0"
|
|
@click="selectAvatarExportLocalGroup(null)">
|
|
None
|
|
</el-dropdown-item>
|
|
<template v-for="group in localAvatarFavoriteGroups" :key="group">
|
|
<el-dropdown-item
|
|
style="display: block; margin: 10px 0"
|
|
@click="selectAvatarExportLocalGroup(group)">
|
|
{{ group }} ({{ getLocalAvatarFavoriteGroupLength(group) }})
|
|
</el-dropdown-item>
|
|
</template>
|
|
</el-dropdown-menu>
|
|
</template>
|
|
</el-dropdown>
|
|
<br />
|
|
<el-input
|
|
v-model="avatarExportContent"
|
|
type="textarea"
|
|
size="small"
|
|
:rows="15"
|
|
resize="none"
|
|
readonly
|
|
style="margin-top: 15px"
|
|
@click="handleCopyAvatarExportData"></el-input>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ArrowDown } from '@element-plus/icons-vue';
|
|
import { ref, computed, watch } from 'vue';
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
import { useI18n } from 'vue-i18n';
|
|
import { storeToRefs } from 'pinia';
|
|
import { useAvatarStore, useFavoriteStore } from '../../../stores';
|
|
|
|
const { t } = useI18n();
|
|
|
|
const props = defineProps({
|
|
avatarExportDialogVisible: {
|
|
type: Boolean,
|
|
required: true
|
|
}
|
|
});
|
|
|
|
const emit = defineEmits(['update:avatarExportDialogVisible']);
|
|
|
|
const favoriteStore = useFavoriteStore();
|
|
const {
|
|
favoriteAvatars,
|
|
favoriteAvatarGroups,
|
|
localAvatarFavorites,
|
|
localAvatarFavoritesList,
|
|
localAvatarFavoriteGroups
|
|
} = storeToRefs(favoriteStore);
|
|
const { getLocalAvatarFavoriteGroupLength } = favoriteStore;
|
|
const { cachedAvatars } = useAvatarStore();
|
|
|
|
const avatarExportContent = ref('');
|
|
const avatarExportFavoriteGroup = ref(null);
|
|
const avatarExportLocalFavoriteGroup = ref(null);
|
|
const exportSelectedOptions = ref(['ID', 'Name']);
|
|
const exportSelectOptions = ref([
|
|
{ label: 'ID', value: 'id' },
|
|
{ label: 'Name', value: 'name' },
|
|
{ label: 'Author ID', value: 'authorId' },
|
|
{ label: 'Author Name', value: 'authorName' },
|
|
{ label: 'Thumbnail', value: 'thumbnailImageUrl' }
|
|
]);
|
|
|
|
const isDialogVisible = computed({
|
|
get() {
|
|
return props.avatarExportDialogVisible;
|
|
},
|
|
set(value) {
|
|
emit('update:avatarExportDialogVisible', value);
|
|
}
|
|
});
|
|
|
|
watch(
|
|
() => props.avatarExportDialogVisible,
|
|
(value) => {
|
|
if (value) {
|
|
showAvatarExportDialog();
|
|
}
|
|
}
|
|
);
|
|
|
|
function showAvatarExportDialog() {
|
|
avatarExportFavoriteGroup.value = null;
|
|
avatarExportLocalFavoriteGroup.value = null;
|
|
updateAvatarExportDialog();
|
|
}
|
|
function handleCopyAvatarExportData(event) {
|
|
if (event.target.tagName === 'TEXTAREA') {
|
|
event.target.select();
|
|
}
|
|
navigator.clipboard
|
|
.writeText(avatarExportContent.value)
|
|
.then(() => {
|
|
ElMessage({
|
|
message: 'Copied successfully!',
|
|
type: 'success',
|
|
duration: 2000
|
|
});
|
|
})
|
|
.catch((err) => {
|
|
console.error('Copy failed:', err);
|
|
ElMessage.error('Copy failed!');
|
|
});
|
|
}
|
|
function updateAvatarExportDialog() {
|
|
const formatter = function (str) {
|
|
if (/[\x00-\x1f,"]/.test(str) === true) {
|
|
return `"${str.replace(/"/g, '""')}"`;
|
|
}
|
|
return str;
|
|
};
|
|
const propsForQuery = exportSelectOptions.value
|
|
.filter((option) => exportSelectedOptions.value.includes(option.label))
|
|
.map((option) => option.value);
|
|
|
|
function resText(ref) {
|
|
let resArr = [];
|
|
propsForQuery.forEach((e) => {
|
|
resArr.push(formatter(ref?.[e]));
|
|
});
|
|
return resArr.join(',');
|
|
}
|
|
|
|
const lines = [exportSelectedOptions.value.join(',')];
|
|
|
|
if (avatarExportFavoriteGroup.value) {
|
|
favoriteAvatarGroups.value.forEach((group) => {
|
|
if (!avatarExportFavoriteGroup.value || avatarExportFavoriteGroup.value === group) {
|
|
favoriteAvatars.value.forEach((ref) => {
|
|
if (group.key === ref.groupKey) {
|
|
lines.push(resText(ref.ref));
|
|
}
|
|
});
|
|
}
|
|
});
|
|
} else if (avatarExportLocalFavoriteGroup.value) {
|
|
const favoriteGroup = localAvatarFavorites.value[avatarExportLocalFavoriteGroup.value];
|
|
if (!favoriteGroup) {
|
|
return;
|
|
}
|
|
for (let i = 0; i < favoriteGroup.length; ++i) {
|
|
const ref = favoriteGroup[i];
|
|
lines.push(resText(ref));
|
|
}
|
|
} else {
|
|
// export all
|
|
favoriteAvatars.value.forEach((ref) => {
|
|
lines.push(resText(ref.ref));
|
|
});
|
|
for (let i = 0; i < localAvatarFavoritesList.value.length; ++i) {
|
|
const avatarId = localAvatarFavoritesList.value[i];
|
|
const ref = cachedAvatars.get(avatarId);
|
|
if (typeof ref !== 'undefined') {
|
|
lines.push(resText(ref));
|
|
}
|
|
}
|
|
}
|
|
avatarExportContent.value = lines.join('\n');
|
|
}
|
|
function selectAvatarExportGroup(group) {
|
|
avatarExportFavoriteGroup.value = group;
|
|
avatarExportLocalFavoriteGroup.value = null;
|
|
updateAvatarExportDialog();
|
|
}
|
|
function selectAvatarExportLocalGroup(group) {
|
|
avatarExportLocalFavoriteGroup.value = group;
|
|
avatarExportFavoriteGroup.value = null;
|
|
updateAvatarExportDialog();
|
|
}
|
|
</script>
|