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> <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">
{{ 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> <span class="extra">{{ formatDateFilter(groupDialog.lastVisit, 'long') }}</span>
</div> </div>
</div> </div>
@@ -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();
@@ -4,15 +4,13 @@
: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">
@@ -24,21 +22,10 @@
<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"
: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="scope.row.$location.tag" :location="scope.row.$location.tag"
:force-update-key="previousInstancesGroupDialog.forceUpdate" :grouphint="scope.row.groupName"
/> :hint="scope.row.worldName" />
</template> </template>
</el-table-column> </el-table-column>
@@ -54,23 +41,20 @@
type="text" type="text"
icon="el-icon-s-data" icon="el-icon-s-data"
size="mini" size="mini"
@click="showPreviousInstancesInfoDialog(scope.row.location)" @click="showPreviousInstancesInfoDialog(scope.row.location)" />
/>
<el-button <el-button
v-if="shiftHeld" v-if="shiftHeld"
style="color: #f56c6c" style="color: #f56c6c"
type="text" type="text"
icon="el-icon-close" icon="el-icon-close"
size="mini" size="mini"
@click="deleteGameLogGroupInstance(scope.row)" @click="deleteGameLogGroupInstance(scope.row)" />
/>
<el-button <el-button
v-else v-else
type="text" type="text"
icon="el-icon-close" icon="el-icon-close"
size="mini" size="mini"
@click="deleteGameLogGroupInstancePrompt(scope.row)" @click="deleteGameLogGroupInstancePrompt(scope.row)" />
/>
</template> </template>
</el-table-column> </el-table-column>
</data-tables> </data-tables>
@@ -79,15 +63,21 @@
<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 {
parseLocation,
compareByCreatedAt,
timeToText,
removeFromArray,
adjustDialogZ,
formatDateFilter
} from '../../../shared/utils';
import { database } from '../../../service/database'; import { database } from '../../../service/database';
import { useI18n } from 'vue-i18n-bridge'; import { useI18n } from 'vue-i18n-bridge';
import { useInstanceStore, useUiStore, useUserStore } from '../../../stores'; 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);
@@ -106,7 +96,7 @@ const previousInstancesGroupDialogTable = reactive({
}); });
const props = defineProps({ const props = defineProps({
previousInstancesGroupDialog: { type: Object, required: true }, previousInstancesGroupDialog: { type: Object, required: true }
}); });
const emit = defineEmits(['update:previousInstancesGroupDialog']); const emit = defineEmits(['update:previousInstancesGroupDialog']);
@@ -120,19 +110,22 @@ const isVisible = computed({
} }
}); });
watch(() => props.previousInstancesGroupDialog.openFlg, () => { watch(
() => props.previousInstancesGroupDialog.openFlg,
() => {
if (props.previousInstancesGroupDialog.visible) { if (props.previousInstancesGroupDialog.visible) {
nextTick(() => { nextTick(() => {
adjustDialogZ(previousInstancesGroupDialogRef.value.$el); adjustDialogZ(previousInstancesGroupDialogRef.value.$el);
}); });
refreshPreviousInstancesGroupTable(); refreshPreviousInstancesGroupTable();
} }
}); }
);
function refreshPreviousInstancesGroupTable() { function refreshPreviousInstancesGroupTable() {
loading.value = true; loading.value = true;
const D = props.previousInstancesGroupDialog; const D = props.previousInstancesGroupDialog;
database.getPreviousInstancesByGroupName(D.groupRef.name).then((data) => { database.getPreviousInstancesByGroupId(D.groupRef.id).then((data) => {
const array = []; const array = [];
for (const ref of data.values()) { for (const ref of data.values()) {
ref.$location = parseLocation(ref.location); ref.$location = parseLocation(ref.location);
@@ -155,7 +148,11 @@ function deleteGameLogGroupInstancePrompt(row) {
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>
+1 -1
View File
@@ -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",
+7 -11
View File
@@ -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: ''
}; };