Skip to content

Commit

Permalink
✨ feat: Add DataStatistics
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 authored May 7, 2024
1 parent 00016c0 commit cf474bb
Show file tree
Hide file tree
Showing 28 changed files with 336 additions and 7 deletions.
6 changes: 6 additions & 0 deletions locales/ar/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "نسخ",
"copyFail": "فشل في النسخ",
"copySuccess": "تم النسخ بنجاح",
"dataStatistics": {
"messages": "رسائل",
"sessions": "جلسات",
"today": "اليوم",
"topics": "مواضيع"
},
"defaultAgent": "مساعد افتراضي",
"defaultSession": "جلسة افتراضية",
"delete": "حذف",
Expand Down
6 changes: 6 additions & 0 deletions locales/bg-BG/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Копирай",
"copyFail": "Копирането не е успешно",
"copySuccess": "Копирано успешно",
"dataStatistics": {
"messages": "Съобщения",
"sessions": "Сесии",
"today": "Днес",
"topics": "Теми"
},
"defaultAgent": "Агент по подразбиране",
"defaultSession": "Агент по подразбиране",
"delete": "Изтрий",
Expand Down
6 changes: 6 additions & 0 deletions locales/de-DE/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Kopieren",
"copyFail": "Kopieren fehlgeschlagen",
"copySuccess": "Kopieren erfolgreich",
"dataStatistics": {
"messages": "Nachrichten",
"sessions": "Sitzungen",
"today": "Heute",
"topics": "Themen"
},
"defaultAgent": "Standardassistent",
"defaultSession": "Standardassistent",
"delete": "Löschen",
Expand Down
6 changes: 6 additions & 0 deletions locales/en-US/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Copy",
"copyFail": "Copy failed",
"copySuccess": "Copied successfully",
"dataStatistics": {
"messages": "Messages",
"sessions": "Assistants",
"today": "Today's New",
"topics": "Topics"
},
"defaultAgent": "Default Agent",
"defaultSession": "Default Agent",
"delete": "Delete",
Expand Down
6 changes: 6 additions & 0 deletions locales/es-ES/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Copiar",
"copyFail": "Fallo al copiar",
"copySuccess": "¡Copia exitosa!",
"dataStatistics": {
"messages": "Mensajes",
"sessions": "Sesiones",
"today": "Hoy",
"topics": "Temas"
},
"defaultAgent": "Asistente predeterminado",
"defaultSession": "Sesión predeterminada",
"delete": "Eliminar",
Expand Down
6 changes: 6 additions & 0 deletions locales/fr-FR/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Copier",
"copyFail": "Échec de la copie",
"copySuccess": "Copie réussie",
"dataStatistics": {
"messages": "Messages",
"sessions": "Sessions",
"today": "Aujourd'hui",
"topics": "Sujets"
},
"defaultAgent": "Agent par défaut",
"defaultSession": "Session par défaut",
"delete": "Supprimer",
Expand Down
6 changes: 6 additions & 0 deletions locales/it-IT/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Copia",
"copyFail": "Copia non riuscita",
"copySuccess": "Copia riuscita",
"dataStatistics": {
"messages": "Messaggi",
"sessions": "Sessioni",
"today": "Oggi",
"topics": "Argomenti"
},
"defaultAgent": "Assistente predefinito",
"defaultSession": "Sessione predefinita",
"delete": "Elimina",
Expand Down
6 changes: 6 additions & 0 deletions locales/ja-JP/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "コピー",
"copyFail": "コピーに失敗しました",
"copySuccess": "コピーが成功しました",
"dataStatistics": {
"messages": "メッセージ",
"sessions": "セッション",
"today": "今日の追加",
"topics": "トピック"
},
"defaultAgent": "デフォルトエージェント",
"defaultSession": "デフォルトセッション",
"delete": "削除",
Expand Down
6 changes: 6 additions & 0 deletions locales/ko-KR/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "복사",
"copyFail": "복사 실패",
"copySuccess": "복사 성공",
"dataStatistics": {
"messages": "메시지",
"sessions": "세션",
"today": "오늘",
"topics": "주제"
},
"defaultAgent": "기본 에이전트",
"defaultSession": "기본 세션",
"delete": "삭제",
Expand Down
6 changes: 6 additions & 0 deletions locales/nl-NL/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Kopiëren",
"copyFail": "Kopiëren mislukt",
"copySuccess": "Kopiëren gelukt",
"dataStatistics": {
"messages": "Berichten",
"sessions": "Sessies",
"today": "Vandaag",
"topics": "Onderwerpen"
},
"defaultAgent": "Standaard assistent",
"defaultSession": "Standaard assistent",
"delete": "Verwijderen",
Expand Down
6 changes: 6 additions & 0 deletions locales/pl-PL/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Kopiuj",
"copyFail": "Nie udało się skopiować",
"copySuccess": "Skopiowano pomyślnie",
"dataStatistics": {
"messages": "Wiadomości",
"sessions": "Sesje",
"today": "Dzisiaj",
"topics": "Tematy"
},
"defaultAgent": "Domyślny asystent",
"defaultSession": "Domyślna sesja",
"delete": "Usuń",
Expand Down
6 changes: 6 additions & 0 deletions locales/pt-BR/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Copiar",
"copyFail": "Falha ao copiar",
"copySuccess": "Cópia bem-sucedida",
"dataStatistics": {
"messages": "Mensagens",
"sessions": "Sessões",
"today": "Hoje",
"topics": "Tópicos"
},
"defaultAgent": "Assistente padrão",
"defaultSession": "Sessão padrão",
"delete": "Excluir",
Expand Down
6 changes: 6 additions & 0 deletions locales/ru-RU/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Копировать",
"copyFail": "Не удалось скопировать",
"copySuccess": "Успешно скопировано",
"dataStatistics": {
"messages": "Сообщения",
"sessions": "Сессии",
"today": "Сегодня",
"topics": "Темы"
},
"defaultAgent": "Пользовательский агент",
"defaultSession": "Пользовательский агент",
"delete": "Удалить",
Expand Down
6 changes: 6 additions & 0 deletions locales/tr-TR/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Kopyala",
"copyFail": "Kopyalama başarısız oldu",
"copySuccess": "Kopyalama Başarılı",
"dataStatistics": {
"messages": "Mesajlar",
"sessions": "Oturumlar",
"today": "Bugün",
"topics": "Konular"
},
"defaultAgent": "Varsayılan Asistan",
"defaultSession": "Varsayılan Asistan",
"delete": "Sil",
Expand Down
6 changes: 6 additions & 0 deletions locales/vi-VN/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "Sao chép",
"copyFail": "Sao chép thất bại",
"copySuccess": "Sao chép thành công",
"dataStatistics": {
"messages": "Tin nhắn",
"sessions": "Phiên làm việc",
"today": "Hôm nay",
"topics": "Chủ đề"
},
"defaultAgent": "Trợ lý mặc định",
"defaultSession": "Phiên mặc định",
"delete": "Xóa",
Expand Down
6 changes: 6 additions & 0 deletions locales/zh-CN/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "复制",
"copyFail": "复制失败",
"copySuccess": "复制成功",
"dataStatistics": {
"messages": "消息",
"sessions": "助手",
"today": "今日新增",
"topics": "话题"
},
"defaultAgent": "自定义助手",
"defaultSession": "自定义助手",
"delete": "删除",
Expand Down
6 changes: 6 additions & 0 deletions locales/zh-TW/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
"copy": "複製",
"copyFail": "複製失敗",
"copySuccess": "複製成功",
"dataStatistics": {
"messages": "消息",
"sessions": "助手",
"today": "今日新增",
"topics": "話題"
},
"defaultAgent": "預設助手",
"defaultSession": "預設助手",
"delete": "刪除",
Expand Down
5 changes: 2 additions & 3 deletions src/app/(main)/(mobile)/me/features/AvatarBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { PropsWithChildren, memo } from 'react';
import { Flexbox } from 'react-layout-kit';

import UserAvatar from '@/features/User/UserAvatar';
import UserInfo from '@/features/User/UserInfo';

import { useStyles } from './style';

export const AVATAR_SIZE = 80;

const AvatarBanner = memo<PropsWithChildren>(() => {
const AvatarBanner = memo<PropsWithChildren>(({ children }) => {
const { styles } = useStyles();

return (
Expand All @@ -20,7 +19,7 @@ const AvatarBanner = memo<PropsWithChildren>(() => {
<UserAvatar shape={'square'} size={AVATAR_SIZE} />
</div>
</Flexbox>
<UserInfo className={styles.info} />
<Flexbox className={styles.info}>{children}</Flexbox>
</>
);
});
Expand Down
21 changes: 19 additions & 2 deletions src/app/(main)/(mobile)/me/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Skeleton } from 'antd';
import { memo } from 'react';
import { Flexbox } from 'react-layout-kit';

import Divider from '@/components/Cell/Divider';
import SkeletonLoading from '@/components/SkeletonLoading';

import { useStyles } from './features/style';
Expand All @@ -22,9 +23,25 @@ const Loading = memo(() => {
paddingInline={12}
>
<Skeleton.Avatar active shape={'circle'} size={48} />
<Skeleton active paragraph={{ rows: 1 }} title={false} />
<Skeleton.Button active block />
</Flexbox>
<SkeletonLoading active paragraph={{ rows: 8 }} title={false} />
<Flexbox gap={4} horizontal paddingBlock={12} paddingInline={16}>
<Skeleton.Button active block />
<Skeleton.Button active block />
<Skeleton.Button active block />
</Flexbox>
<Divider />
<SkeletonLoading
active
paragraph={{ rows: 6, style: { marginBottom: 0 }, width: '100%' }}
title={false}
/>
<Divider />
<SkeletonLoading
active
paragraph={{ rows: 3, style: { marginBottom: 0 }, width: '100%' }}
title={false}
/>
</>
);
});
Expand Down
7 changes: 6 additions & 1 deletion src/app/(main)/(mobile)/me/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { Center } from 'react-layout-kit';

import BrandWatermark from '@/components/BrandWatermark';
import Divider from '@/components/Cell/Divider';
import DataStatistics from '@/features/User/DataStatistics';
import UserInfo from '@/features/User/UserInfo';
import { isMobileDevice } from '@/utils/responsive';

import AvatarBanner from './features/AvatarBanner';
Expand All @@ -16,7 +18,10 @@ const Page = () => {

return (
<>
<AvatarBanner />
<AvatarBanner>
<UserInfo />
<DataStatistics paddingInline={16} />
</AvatarBanner>
<Divider />
<Cate />
<ExtraCate />
Expand Down
4 changes: 4 additions & 0 deletions src/database/client/models/topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ class _TopicModel extends BaseModel {
return this.table.get(id);
}

async count() {
return this.table.count();
}

// **************** Create *************** //

async create({ title, favorite, sessionId, messages }: CreateTopicParams, id = nanoid()) {
Expand Down
Loading

0 comments on commit cf474bb

Please sign in to comment.