Group add last visited fixes

This commit is contained in:
Natsumi
2025-08-24 12:22:41 +12:00
parent b96d26e174
commit 90c6422418
4 changed files with 164 additions and 160 deletions
@@ -611,10 +611,22 @@
<span class="extra">{{ formatDateFilter(groupDialog.ref.createdAt, 'long') }}</span>
</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="detail">
<span class="name">{{ t('dialog.group.info.last_visited') }}</span>
<span class="name">
{{ 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>
@@ -1176,8 +1188,7 @@
<InviteGroupDialog />
<PreviousInstancesGroupDialog
:previous-instances-group-dialog.sync="previousInstancesGroupDialog"
:current-user="currentUser"
/>
:current-user="currentUser" />
</safe-dialog>
</template>
@@ -1215,7 +1226,7 @@
} from '../../../stores';
import InviteGroupDialog from '../InviteGroupDialog.vue';
import GroupPostEditDialog from './GroupPostEditDialog.vue';
import PreviousInstancesGroupDialog from "../PreviousInstancesDialog/PreviousInstancesGroupDialog.vue";
import PreviousInstancesGroupDialog from '../PreviousInstancesDialog/PreviousInstancesGroupDialog.vue';
const { t } = useI18n();
@@ -4,15 +4,13 @@
:visible.sync="isVisible"
:title="t('dialog.previous_instances.header')"
width="1000px"
append-to-body
>
append-to-body>
<div style="display: flex; align-items: center; justify-content: space-between">
<span style="font-size: 14px" v-text="previousInstancesGroupDialog.groupRef.name"></span>
<el-input
v-model="previousInstancesGroupDialogTable.filters[0].value"
:placeholder="t('dialog.previous_instances.search_placeholder')"
style="width: 150px"
/>
style="width: 150px" />
</div>
<data-tables v-loading="loading" v-bind="previousInstancesGroupDialogTable" style="margin-top: 10px">
@@ -24,21 +22,10 @@
<el-table-column :label="t('table.previous_instances.instance_name')" prop="name">
<template #default="scope">
<LocationWorld
:locationobject="scope.row.$location"
:grouphint="scope.row.groupName"
:currentuserid="currentUser.id"
/>
</template>
</el-table-column>
<el-table-column :label="t('table.previous_instances.instance_creator')" prop="location">
<template #default="scope">
<DisplayName
:userid="scope.row.$location.userId"
<Location
:location="scope.row.$location.tag"
:force-update-key="previousInstancesGroupDialog.forceUpdate"
/>
:grouphint="scope.row.groupName"
:hint="scope.row.worldName" />
</template>
</el-table-column>
@@ -54,23 +41,20 @@
type="text"
icon="el-icon-s-data"
size="mini"
@click="showPreviousInstancesInfoDialog(scope.row.location)"
/>
@click="showPreviousInstancesInfoDialog(scope.row.location)" />
<el-button
v-if="shiftHeld"
style="color: #f56c6c"
type="text"
icon="el-icon-close"
size="mini"
@click="deleteGameLogGroupInstance(scope.row)"
/>
@click="deleteGameLogGroupInstance(scope.row)" />
<el-button
v-else
type="text"
icon="el-icon-close"
size="mini"
@click="deleteGameLogGroupInstancePrompt(scope.row)"
/>
@click="deleteGameLogGroupInstancePrompt(scope.row)" />
</template>
</el-table-column>
</data-tables>
@@ -79,15 +63,21 @@
<script setup>
import { ref, reactive, computed, watch, nextTick, getCurrentInstance } from 'vue';
import { parseLocation, compareByCreatedAt, timeToText, removeFromArray, adjustDialogZ, formatDateFilter } from '../../../shared/utils';
import {
parseLocation,
compareByCreatedAt,
timeToText,
removeFromArray,
adjustDialogZ,
formatDateFilter
} from '../../../shared/utils';
import { database } from '../../../service/database';
import { useI18n } from 'vue-i18n-bridge';
import { useInstanceStore, useUiStore, useUserStore } from '../../../stores';
import { useInstanceStore, useUiStore } from '../../../stores';
const { proxy } = getCurrentInstance();
const { showPreviousInstancesInfoDialog } = useInstanceStore();
const { shiftHeld } = useUiStore();
const { currentUser } = useUserStore();
const { t } = useI18n();
const previousInstancesGroupDialogRef = ref(null);
@@ -106,7 +96,7 @@ const previousInstancesGroupDialogTable = reactive({
});
const props = defineProps({
previousInstancesGroupDialog: { type: Object, required: true },
previousInstancesGroupDialog: { type: Object, required: true }
});
const emit = defineEmits(['update:previousInstancesGroupDialog']);
@@ -120,19 +110,22 @@ const isVisible = computed({
}
});
watch(() => props.previousInstancesGroupDialog.openFlg, () => {
watch(
() => props.previousInstancesGroupDialog.openFlg,
() => {
if (props.previousInstancesGroupDialog.visible) {
nextTick(() => {
adjustDialogZ(previousInstancesGroupDialogRef.value.$el);
});
refreshPreviousInstancesGroupTable();
}
});
}
);
function refreshPreviousInstancesGroupTable() {
loading.value = true;
const D = props.previousInstancesGroupDialog;
database.getPreviousInstancesByGroupName(D.groupRef.name).then((data) => {
database.getPreviousInstancesByGroupId(D.groupRef.id).then((data) => {
const array = [];
for (const ref of data.values()) {
ref.$location = parseLocation(ref.location);
@@ -155,7 +148,11 @@ function deleteGameLogGroupInstancePrompt(row) {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'info',
callback: (action) => { if (action === 'confirm') deleteGameLogGroupInstance(row); }
callback: (action) => {
if (action === 'confirm') {
deleteGameLogGroupInstance(row);
}
}
});
}
</script>
+1 -1
View File
@@ -829,7 +829,7 @@
"instance_hard_closed": "hard closed",
"close_instance": "Close Instance",
"instance_age_gated": "age gated",
"open_previous_instance": "Open Previous Instance"
"open_previous_instance": "Open Previous Instances"
},
"groups": {
"header": "Groups",
+7 -11
View File
@@ -324,11 +324,11 @@ const gameLog = {
return ref;
},
async getPreviousInstancesByGroupName(groupName) {
var data = new Map();
async getPreviousInstancesByGroupId(groupId) {
const data = new Map();
await sqliteService.execute(
(dbRow) => {
var time = 0;
let time = 0;
if (dbRow[2]) {
time = dbRow[2];
}
@@ -345,21 +345,17 @@ const gameLog = {
};
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;
},
async getLastSeen(input, inCurrentWorld) {
if (inCurrentWorld) {
var count = 2;
} else {
var count = 1;
}
var ref = {
const count = inCurrentWorld ? 2 : 1;
let ref = {
created_at: '',
userId: ''
};