mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 14:56:06 +02:00
Group add last visited fixes
This commit is contained in:
@@ -611,11 +611,23 @@
|
|||||||
<span class="extra">{{ formatDateFilter(groupDialog.ref.createdAt, 'long') }}</span>
|
<span class="extra">{{ formatDateFilter(groupDialog.ref.createdAt, 'long') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-tooltip :disabled="hideTooltips" placement="top" :content="t('dialog.user.info.open_previous_instance')">
|
<el-tooltip
|
||||||
|
:disabled="hideTooltips"
|
||||||
|
placement="top"
|
||||||
|
:content="t('dialog.user.info.open_previous_instance')">
|
||||||
<div class="x-friend-item" @click="showPreviousInstancesGroupDialog(groupDialog.ref)">
|
<div class="x-friend-item" @click="showPreviousInstancesGroupDialog(groupDialog.ref)">
|
||||||
<div class="detail">
|
<div class="detail">
|
||||||
<span class="name">{{ t('dialog.group.info.last_visited') }}</span>
|
<span class="name">
|
||||||
<span class="extra">{{formatDateFilter(groupDialog.lastVisit,'long') }}</span>
|
{{ t('dialog.group.info.last_visited') }}
|
||||||
|
<el-tooltip
|
||||||
|
v-if="!hideTooltips"
|
||||||
|
placement="top"
|
||||||
|
style="margin-left: 5px"
|
||||||
|
:content="t('dialog.user.info.accuracy_notice')">
|
||||||
|
<i class="el-icon-warning"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</span>
|
||||||
|
<span class="extra">{{ formatDateFilter(groupDialog.lastVisit, 'long') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@@ -1176,8 +1188,7 @@
|
|||||||
<InviteGroupDialog />
|
<InviteGroupDialog />
|
||||||
<PreviousInstancesGroupDialog
|
<PreviousInstancesGroupDialog
|
||||||
:previous-instances-group-dialog.sync="previousInstancesGroupDialog"
|
:previous-instances-group-dialog.sync="previousInstancesGroupDialog"
|
||||||
:current-user="currentUser"
|
:current-user="currentUser" />
|
||||||
/>
|
|
||||||
</safe-dialog>
|
</safe-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -1215,7 +1226,7 @@
|
|||||||
} from '../../../stores';
|
} from '../../../stores';
|
||||||
import InviteGroupDialog from '../InviteGroupDialog.vue';
|
import InviteGroupDialog from '../InviteGroupDialog.vue';
|
||||||
import GroupPostEditDialog from './GroupPostEditDialog.vue';
|
import GroupPostEditDialog from './GroupPostEditDialog.vue';
|
||||||
import PreviousInstancesGroupDialog from "../PreviousInstancesDialog/PreviousInstancesGroupDialog.vue";
|
import PreviousInstancesGroupDialog from '../PreviousInstancesDialog/PreviousInstancesGroupDialog.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
|||||||
@@ -1,161 +1,158 @@
|
|||||||
<template>
|
<template>
|
||||||
<safe-dialog
|
<safe-dialog
|
||||||
ref="previousInstancesGroupDialogRef"
|
ref="previousInstancesGroupDialogRef"
|
||||||
:visible.sync="isVisible"
|
:visible.sync="isVisible"
|
||||||
:title="t('dialog.previous_instances.header')"
|
:title="t('dialog.previous_instances.header')"
|
||||||
width="1000px"
|
width="1000px"
|
||||||
append-to-body
|
append-to-body>
|
||||||
>
|
<div style="display: flex; align-items: center; justify-content: space-between">
|
||||||
<div style="display: flex; align-items: center; justify-content: space-between">
|
<span style="font-size: 14px" v-text="previousInstancesGroupDialog.groupRef.name"></span>
|
||||||
<span style="font-size: 14px" v-text="previousInstancesGroupDialog.groupRef.name"></span>
|
<el-input
|
||||||
<el-input
|
v-model="previousInstancesGroupDialogTable.filters[0].value"
|
||||||
v-model="previousInstancesGroupDialogTable.filters[0].value"
|
:placeholder="t('dialog.previous_instances.search_placeholder')"
|
||||||
:placeholder="t('dialog.previous_instances.search_placeholder')"
|
style="width: 150px" />
|
||||||
style="width: 150px"
|
</div>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<data-tables v-loading="loading" v-bind="previousInstancesGroupDialogTable" style="margin-top: 10px">
|
<data-tables v-loading="loading" v-bind="previousInstancesGroupDialogTable" style="margin-top: 10px">
|
||||||
<el-table-column :label="t('table.previous_instances.date')" prop="created_at" sortable width="170">
|
<el-table-column :label="t('table.previous_instances.date')" prop="created_at" sortable width="170">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ formatDateFilter(scope.row.created_at, 'long') }}</span>
|
<span>{{ formatDateFilter(scope.row.created_at, 'long') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column :label="t('table.previous_instances.instance_name')" prop="name">
|
<el-table-column :label="t('table.previous_instances.instance_name')" prop="name">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<LocationWorld
|
<Location
|
||||||
:locationobject="scope.row.$location"
|
:location="scope.row.$location.tag"
|
||||||
:grouphint="scope.row.groupName"
|
:grouphint="scope.row.groupName"
|
||||||
:currentuserid="currentUser.id"
|
:hint="scope.row.worldName" />
|
||||||
/>
|
</template>
|
||||||
</template>
|
</el-table-column>
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column :label="t('table.previous_instances.instance_creator')" prop="location">
|
<el-table-column :label="t('table.previous_instances.time')" prop="time" width="100" sortable>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<DisplayName
|
<span v-text="scope.row.timer"></span>
|
||||||
:userid="scope.row.$location.userId"
|
</template>
|
||||||
:location="scope.row.$location.tag"
|
</el-table-column>
|
||||||
:force-update-key="previousInstancesGroupDialog.forceUpdate"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column :label="t('table.previous_instances.time')" prop="time" width="100" sortable>
|
<el-table-column :label="t('table.previous_instances.action')" width="90" align="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-text="scope.row.timer"></span>
|
<el-button
|
||||||
</template>
|
type="text"
|
||||||
</el-table-column>
|
icon="el-icon-s-data"
|
||||||
|
size="mini"
|
||||||
<el-table-column :label="t('table.previous_instances.action')" width="90" align="right">
|
@click="showPreviousInstancesInfoDialog(scope.row.location)" />
|
||||||
<template #default="scope">
|
<el-button
|
||||||
<el-button
|
v-if="shiftHeld"
|
||||||
type="text"
|
style="color: #f56c6c"
|
||||||
icon="el-icon-s-data"
|
type="text"
|
||||||
size="mini"
|
icon="el-icon-close"
|
||||||
@click="showPreviousInstancesInfoDialog(scope.row.location)"
|
size="mini"
|
||||||
/>
|
@click="deleteGameLogGroupInstance(scope.row)" />
|
||||||
<el-button
|
<el-button
|
||||||
v-if="shiftHeld"
|
v-else
|
||||||
style="color: #f56c6c"
|
type="text"
|
||||||
type="text"
|
icon="el-icon-close"
|
||||||
icon="el-icon-close"
|
size="mini"
|
||||||
size="mini"
|
@click="deleteGameLogGroupInstancePrompt(scope.row)" />
|
||||||
@click="deleteGameLogGroupInstance(scope.row)"
|
</template>
|
||||||
/>
|
</el-table-column>
|
||||||
<el-button
|
</data-tables>
|
||||||
v-else
|
</safe-dialog>
|
||||||
type="text"
|
|
||||||
icon="el-icon-close"
|
|
||||||
size="mini"
|
|
||||||
@click="deleteGameLogGroupInstancePrompt(scope.row)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</data-tables>
|
|
||||||
</safe-dialog>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, computed, watch, nextTick, getCurrentInstance } from 'vue';
|
import { ref, reactive, computed, watch, nextTick, getCurrentInstance } from 'vue';
|
||||||
import { parseLocation, compareByCreatedAt, timeToText, removeFromArray, adjustDialogZ, formatDateFilter } from '../../../shared/utils';
|
import {
|
||||||
import { database } from '../../../service/database';
|
parseLocation,
|
||||||
import { useI18n } from 'vue-i18n-bridge';
|
compareByCreatedAt,
|
||||||
import { useInstanceStore, useUiStore, useUserStore } from '../../../stores';
|
timeToText,
|
||||||
|
removeFromArray,
|
||||||
|
adjustDialogZ,
|
||||||
|
formatDateFilter
|
||||||
|
} from '../../../shared/utils';
|
||||||
|
import { database } from '../../../service/database';
|
||||||
|
import { useI18n } from 'vue-i18n-bridge';
|
||||||
|
import { useInstanceStore, useUiStore } from '../../../stores';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { showPreviousInstancesInfoDialog } = useInstanceStore();
|
const { showPreviousInstancesInfoDialog } = useInstanceStore();
|
||||||
const { shiftHeld } = useUiStore();
|
const { shiftHeld } = useUiStore();
|
||||||
const { currentUser } = useUserStore();
|
const { t } = useI18n();
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const previousInstancesGroupDialogRef = ref(null);
|
const previousInstancesGroupDialogRef = ref(null);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
const previousInstancesGroupDialogTable = reactive({
|
const previousInstancesGroupDialogTable = reactive({
|
||||||
data: [],
|
data: [],
|
||||||
filters: [{ prop: 'groupName', value: '' }],
|
filters: [{ prop: 'groupName', value: '' }],
|
||||||
tableProps: {
|
tableProps: {
|
||||||
stripe: true,
|
stripe: true,
|
||||||
size: 'mini',
|
size: 'mini',
|
||||||
defaultSort: { prop: 'created_at', order: 'descending' }
|
defaultSort: { prop: 'created_at', order: 'descending' }
|
||||||
},
|
},
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
paginationProps: { small: true, layout: 'sizes,prev,pager,next,total', pageSizes: [10, 25, 50, 100] }
|
paginationProps: { small: true, layout: 'sizes,prev,pager,next,total', pageSizes: [10, 25, 50, 100] }
|
||||||
});
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
previousInstancesGroupDialog: { type: Object, required: true },
|
|
||||||
});
|
|
||||||
const emit = defineEmits(['update:previousInstancesGroupDialog']);
|
|
||||||
|
|
||||||
const isVisible = computed({
|
|
||||||
get: () => props.previousInstancesGroupDialog.visible,
|
|
||||||
set: (value) => {
|
|
||||||
emit('update:previousInstancesGroupDialog', {
|
|
||||||
...props.previousInstancesGroupDialog,
|
|
||||||
visible: value
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(() => props.previousInstancesGroupDialog.openFlg, () => {
|
const props = defineProps({
|
||||||
if (props.previousInstancesGroupDialog.visible) {
|
previousInstancesGroupDialog: { type: Object, required: true }
|
||||||
nextTick(() => {
|
|
||||||
adjustDialogZ(previousInstancesGroupDialogRef.value.$el);
|
|
||||||
});
|
});
|
||||||
refreshPreviousInstancesGroupTable();
|
const emit = defineEmits(['update:previousInstancesGroupDialog']);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function refreshPreviousInstancesGroupTable() {
|
const isVisible = computed({
|
||||||
loading.value = true;
|
get: () => props.previousInstancesGroupDialog.visible,
|
||||||
const D = props.previousInstancesGroupDialog;
|
set: (value) => {
|
||||||
database.getPreviousInstancesByGroupName(D.groupRef.name).then((data) => {
|
emit('update:previousInstancesGroupDialog', {
|
||||||
const array = [];
|
...props.previousInstancesGroupDialog,
|
||||||
for (const ref of data.values()) {
|
visible: value
|
||||||
ref.$location = parseLocation(ref.location);
|
});
|
||||||
ref.timer = ref.time > 0 ? timeToText(ref.time) : '';
|
}
|
||||||
array.push(ref);
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.previousInstancesGroupDialog.openFlg,
|
||||||
|
() => {
|
||||||
|
if (props.previousInstancesGroupDialog.visible) {
|
||||||
|
nextTick(() => {
|
||||||
|
adjustDialogZ(previousInstancesGroupDialogRef.value.$el);
|
||||||
|
});
|
||||||
|
refreshPreviousInstancesGroupTable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function refreshPreviousInstancesGroupTable() {
|
||||||
|
loading.value = true;
|
||||||
|
const D = props.previousInstancesGroupDialog;
|
||||||
|
database.getPreviousInstancesByGroupId(D.groupRef.id).then((data) => {
|
||||||
|
const array = [];
|
||||||
|
for (const ref of data.values()) {
|
||||||
|
ref.$location = parseLocation(ref.location);
|
||||||
|
ref.timer = ref.time > 0 ? timeToText(ref.time) : '';
|
||||||
|
array.push(ref);
|
||||||
|
}
|
||||||
|
array.sort(compareByCreatedAt);
|
||||||
|
previousInstancesGroupDialogTable.data = array;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
array.sort(compareByCreatedAt);
|
|
||||||
previousInstancesGroupDialogTable.data = array;
|
|
||||||
loading.value = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteGameLogGroupInstance(row) {
|
function deleteGameLogGroupInstance(row) {
|
||||||
database.deleteGameLogInstanceByInstanceId({ location: row.location });
|
database.deleteGameLogInstanceByInstanceId({ location: row.location });
|
||||||
removeFromArray(previousInstancesGroupDialogTable.data, row);
|
removeFromArray(previousInstancesGroupDialogTable.data, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteGameLogGroupInstancePrompt(row) {
|
function deleteGameLogGroupInstancePrompt(row) {
|
||||||
proxy.$confirm('Continue? Delete GameLog Instance', 'Confirm', {
|
proxy.$confirm('Continue? Delete GameLog Instance', 'Confirm', {
|
||||||
confirmButtonText: 'Confirm',
|
confirmButtonText: 'Confirm',
|
||||||
cancelButtonText: 'Cancel',
|
cancelButtonText: 'Cancel',
|
||||||
type: 'info',
|
type: 'info',
|
||||||
callback: (action) => { if (action === 'confirm') deleteGameLogGroupInstance(row); }
|
callback: (action) => {
|
||||||
});
|
if (action === 'confirm') {
|
||||||
}
|
deleteGameLogGroupInstance(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -829,7 +829,7 @@
|
|||||||
"instance_hard_closed": "hard closed",
|
"instance_hard_closed": "hard closed",
|
||||||
"close_instance": "Close Instance",
|
"close_instance": "Close Instance",
|
||||||
"instance_age_gated": "age gated",
|
"instance_age_gated": "age gated",
|
||||||
"open_previous_instance": "Open Previous Instance"
|
"open_previous_instance": "Open Previous Instances"
|
||||||
},
|
},
|
||||||
"groups": {
|
"groups": {
|
||||||
"header": "Groups",
|
"header": "Groups",
|
||||||
|
|||||||
@@ -324,11 +324,11 @@ const gameLog = {
|
|||||||
return ref;
|
return ref;
|
||||||
},
|
},
|
||||||
|
|
||||||
async getPreviousInstancesByGroupName(groupName) {
|
async getPreviousInstancesByGroupId(groupId) {
|
||||||
var data = new Map();
|
const data = new Map();
|
||||||
await sqliteService.execute(
|
await sqliteService.execute(
|
||||||
(dbRow) => {
|
(dbRow) => {
|
||||||
var time = 0;
|
let time = 0;
|
||||||
if (dbRow[2]) {
|
if (dbRow[2]) {
|
||||||
time = dbRow[2];
|
time = dbRow[2];
|
||||||
}
|
}
|
||||||
@@ -345,21 +345,17 @@ const gameLog = {
|
|||||||
};
|
};
|
||||||
data.set(row.location, row);
|
data.set(row.location, row);
|
||||||
},
|
},
|
||||||
`SELECT created_at, location, time, world_name, group_name FROM gamelog_location WHERE group_name = @groupName ORDER BY id DESC`,
|
`SELECT created_at, location, time, world_name, group_name FROM gamelog_location WHERE location LIKE '%${groupId}%' ORDER BY id DESC`,
|
||||||
{
|
{
|
||||||
'@groupName': groupName
|
'@groupId': groupId
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
|
|
||||||
async getLastSeen(input, inCurrentWorld) {
|
async getLastSeen(input, inCurrentWorld) {
|
||||||
if (inCurrentWorld) {
|
const count = inCurrentWorld ? 2 : 1;
|
||||||
var count = 2;
|
let ref = {
|
||||||
} else {
|
|
||||||
var count = 1;
|
|
||||||
}
|
|
||||||
var ref = {
|
|
||||||
created_at: '',
|
created_at: '',
|
||||||
userId: ''
|
userId: ''
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user