bug fixes and localization:

- add localization strings
- fixed duplicates in search (use offset when sorting by startDate)
This commit is contained in:
ssmucny 2023-04-23 23:29:47 -04:00
parent b3fb7c9271
commit 661c83a23f
8 changed files with 33 additions and 17 deletions

View File

@ -993,6 +993,18 @@ noteIdOrUrl: "ートIDまたはURL"
accountMigration: "アカウントの引っ越し" accountMigration: "アカウントの引っ越し"
accountMoved: "このユーザーは新しいアカウントに引っ越しました:" accountMoved: "このユーザーは新しいアカウントに引っ越しました:"
forceShowAds: "常に広告を表示する" forceShowAds: "常に広告を表示する"
event: "イベント"
events: "イベント"
reverseChronological: "倒叙"
_event:
title: "題"
startDate: "開始日"
endDate: "終了日"
startTime: "開始時刻"
endTime: "終了時刻"
detailName: "属性"
detailValue: "値"
_accountMigration: _accountMigration:
moveTo: "このアカウントを新しいアカウントに引っ越す" moveTo: "このアカウントを新しいアカウントに引っ越す"

View File

@ -47,6 +47,7 @@ export const paramDef = {
sinceId: { type: 'string', format: 'misskey:id' }, sinceId: { type: 'string', format: 'misskey:id' },
untilId: { type: 'string', format: 'misskey:id' }, untilId: { type: 'string', format: 'misskey:id' },
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
offset: { type: 'integer', default: 0 },
users: { type: 'array', nullable: true, items: { type: 'string', format: 'misskey:id' } }, users: { type: 'array', nullable: true, items: { type: 'string', format: 'misskey:id' } },
sinceDate: { type: 'integer', nullable: true }, sinceDate: { type: 'integer', nullable: true },
untilDate: { type: 'integer', nullable: true }, untilDate: { type: 'integer', nullable: true },
@ -134,6 +135,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
if (me) this.queryService.generateMutedUserQuery(query, me); if (me) this.queryService.generateMutedUserQuery(query, me);
if (me) this.queryService.generateBlockedUserQuery(query, me); if (me) this.queryService.generateBlockedUserQuery(query, me);
if (ps.offset) query.skip(ps.offset);
const notes = await query.take(ps.limit).getMany(); const notes = await query.take(ps.limit).getMany();
return await this.noteEntityService.packMany(notes, me); return await this.noteEntityService.packMany(notes, me);

View File

@ -11,7 +11,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import * as misskey from 'misskey-js'; import * as misskey from 'misskey-js';
//import { i18n } from '@/i18n';
const props = defineProps<{ const props = defineProps<{
note: misskey.entities.Note note: misskey.entities.Note

View File

@ -1,24 +1,24 @@
<template> <template>
<div class="zmdxowut"> <div class="zmdxowut">
<MkInput v-model="title" small type="text" class="input"> <MkInput v-model="title" small type="text" class="input">
<template #label>*{{ "Title" }}</template> <template #label>*{{ i18n.ts._event.title }}</template>
</MkInput> </MkInput>
<section> <section>
<div> <div>
<section> <section>
<MkInput v-model="startDate" small type="date" class="input"> <MkInput v-model="startDate" small type="date" class="input">
<template #label>*{{ "Start Date" }}</template> <template #label>*{{ i18n.ts._event.startDate }}</template>
</MkInput> </MkInput>
<MkInput v-model="startTime" small type="time" class="input"> <MkInput v-model="startTime" small type="time" class="input">
<template #label>*{{ "Start Time" }}</template> <template #label>*{{ i18n.ts._event.startTime }}</template>
</MkInput> </MkInput>
</section> </section>
<section> <section>
<MkInput v-model="endDate" small type="date" class="input"> <MkInput v-model="endDate" small type="date" class="input">
<template #label>{{ "End Date" }}</template> <template #label>{{ i18n.ts._event.endDate }}</template>
</MkInput> </MkInput>
<MkInput v-model="endTime" small type="time" class="input"> <MkInput v-model="endTime" small type="time" class="input">
<template #label>{{ "End Time" }}</template> <template #label>{{ i18n.ts._event.endTime }}</template>
</MkInput> </MkInput>
</section> </section>
</div> </div>
@ -26,10 +26,10 @@
<p>Details</p> <p>Details</p>
<ul> <ul>
<li v-for="(entry, i) in meta" :key="i"> <li v-for="(entry, i) in meta" :key="i">
<MkInput class="input" small :model-value="entry[0]" placeholder="placeholder key" <MkInput class="input" small :model-value="entry[0]" :placeholder="i18n.ts._event.detailName"
@update:model-value="onKeyInput(i, $event)"> @update:model-value="onKeyInput(i, $event)">
</MkInput> </MkInput>
<MkInput class="input" small :model-value="entry[1]" placeholder="placeholder value" <MkInput class="input" small :model-value="entry[1]" :placeholder="i18n.ts._event.detailValue"
@update:model-value="onValueInput(i, $event)"> @update:model-value="onValueInput(i, $event)">
</MkInput> </MkInput>
<button class="_button" @click="remove(i)"> <button class="_button" @click="remove(i)">

View File

@ -46,16 +46,16 @@
<template #prefix><i class="ti ti-search"></i></template> <template #prefix><i class="ti ti-search"></i></template>
</MkInput> </MkInput>
<MkSelect v-model="eventSort" small> <MkSelect v-model="eventSort" small>
<template #label>{{ 'Sort By' }}</template> <template #label>{{ i18n.ts.sort }}</template>
<option value="startDate">{{ 'Event Date' }}</option> <option value="startDate">{{ i18n.ts._event.startDate }}</option>
<option value="createdAt">{{ 'New' }}</option> <option value="createdAt">{{ i18n.ts.reverseChronological }}</option>
</MkSelect> </MkSelect>
<section> <section>
<MkInput v-model="startDate" small type="date" class="input"> <MkInput v-model="startDate" small type="date" class="input">
<template #label>{{ "Start Date" }}</template> <template #label>{{ i18n.ts._event.startDate }}</template>
</MkInput> </MkInput>
<MkInput v-model="endDate" small type="date" class="input"> <MkInput v-model="endDate" small type="date" class="input">
<template #label>{{ "End Date" }}</template> <template #label>{{ i18n.ts._event.endDate }}</template>
</MkInput> </MkInput>
</section> </section>
<MkButton large primary gradate rounded @click="search">{{ i18n.ts.search }}</MkButton> <MkButton large primary gradate rounded @click="search">{{ i18n.ts.search }}</MkButton>
@ -161,6 +161,7 @@ async function search() {
eventPagination = { eventPagination = {
endpoint: 'notes/events/search', endpoint: 'notes/events/search',
limit: 10, limit: 10,
offsetMode: true,
params: { params: {
query: !searchQuery ? undefined : searchQuery, query: !searchQuery ? undefined : searchQuery,
sortBy: eventSort, sortBy: eventSort,
@ -190,7 +191,7 @@ const headerTabs = $computed(() => [{
icon: 'ti ti-users', icon: 'ti ti-users',
}, { }, {
key: 'event', key: 'event',
title: 'Events', title: i18n.ts.events,
icon: 'ti ti-calendar', icon: 'ti ti-calendar',
}]); }]);

View File

@ -3,8 +3,8 @@
<MkStickyContainer> <MkStickyContainer>
<template #header> <template #header>
<MkTab v-model="include" :class="$style.tab"> <MkTab v-model="include" :class="$style.tab">
<option value="upcoming">{{ i18n.ts.upcomingEvents || 'Upcoming' }}</option> <option value="upcoming">{{ i18n.ts._event.startDate }}</option>
<option :value="null">{{ i18n.ts.events || 'Events' }}</option> <option :value="null">{{ i18n.ts.reverseChronological }}</option>
</MkTab> </MkTab>
</template> </template>
<MkNotes :no-gap="true" :pagination="pagination" :class="$style.tl" :get-date="include === 'upcoming' ? note => note.event.start : undefined "/> <MkNotes :no-gap="true" :pagination="pagination" :class="$style.tl" :get-date="include === 'upcoming' ? note => note.event.start : undefined "/>
@ -28,6 +28,7 @@ const include = ref<string | null>('upcoming');
const pagination = { const pagination = {
endpoint: 'notes/events/search' as const, endpoint: 'notes/events/search' as const,
limit: 10, limit: 10,
offsetMode: include.value === 'upcoming',
params: computed(() => ({ params: computed(() => ({
users: [props.user.id], users: [props.user.id],
sortBy: include.value === 'upcoming' ? 'startDate' : 'createdAt', sortBy: include.value === 'upcoming' ? 'startDate' : 'createdAt',

View File

@ -78,7 +78,7 @@ const headerTabs = $computed(() => user ? [{
icon: 'ti ti-pencil', icon: 'ti ti-pencil',
}, { }, {
key: 'events', key: 'events',
title: 'Events', //i18n.ts.events, title: i18n.ts.events,
icon: 'ti ti-calendar', icon: 'ti ti-calendar',
}, { }, {
key: 'activity', key: 'activity',

View File

@ -510,6 +510,7 @@ export type Endpoints = {
sinceId?: Note['id']; sinceId?: Note['id'];
untilId?: Note['id']; untilId?: Note['id'];
limit?: number; limit?: number;
offset?: number;
users?: User['id'][]; users?: User['id'][];
sinceDate?: number; sinceDate?: number;
untilDate?: number; untilDate?: number;