This commit is contained in:
Xeltica 2023-04-29 14:04:30 +09:00
parent d9a9072bd0
commit 34b4507e14
3 changed files with 6 additions and 4 deletions

View File

@ -7,7 +7,6 @@ import { misskeySessionDtoSchema } from '../dto/misskey-session';
import { prisma } from '@/libs/prisma'; import { prisma } from '@/libs/prisma';
import { sessionProcedure } from '@/server/api/procedures/session.js'; import { sessionProcedure } from '@/server/api/procedures/session.js';
import { router } from '@/server/api/trpc.js'; import { router } from '@/server/api/trpc.js';
import { delay } from '@/utils/delay';
export const accountRouter = router({ export const accountRouter = router({
@ -19,7 +18,6 @@ export const accountRouter = router({
getMisskeySessions: sessionProcedure getMisskeySessions: sessionProcedure
.output(z.array(misskeySessionDtoSchema)) .output(z.array(misskeySessionDtoSchema))
.query(async ({ ctx }) => { .query(async ({ ctx }) => {
await delay(1000);
const sessions = await prisma.misskeySession.findMany({ const sessions = await prisma.misskeySession.findMany({
where: { accountId: ctx.account.id }, where: { accountId: ctx.account.id },
select: { select: {

View File

@ -3,6 +3,8 @@ import { useTranslation } from 'react-i18next';
import { WidgetBase } from './WidgetBase'; import { WidgetBase } from './WidgetBase';
import { SuspenseView } from '@/components/primitives/SuspenseView';
export interface WidgetDef { export interface WidgetDef {
name: string; name: string;
iconClass: string; iconClass: string;
@ -17,7 +19,9 @@ export const widget = (name: string, iconClass: string, pale: boolean, render: R
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<WidgetBase title={pale ? undefined : (t('_widgets.' + name) ?? '')} iconClass={pale ? undefined : iconClass} pale={pale}> <WidgetBase title={pale ? undefined : (t('_widgets.' + name) ?? '')} iconClass={pale ? undefined : iconClass} pale={pale}>
<SuspenseView>
{render({})} {render({})}
</SuspenseView>
</WidgetBase> </WidgetBase>
); );
}, },

View File

@ -1,5 +1,5 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import 'dayjs/locale/ja';
import relativeTime from 'dayjs/plugin/relativeTime'; import relativeTime from 'dayjs/plugin/relativeTime';
import 'dayjs/locale/ja';
dayjs.extend(relativeTime); dayjs.extend(relativeTime);