-
+ ))}
+
+
+
+ >
+ ) : (
+
+ openCreateModalFun()}
/>
)}
- >
+
+ ) : (
+
+ openCreateModalFun()}
+ />
+
)}
{/* {openCreateModal && (
)}
-
+ >
);
}
diff --git a/web/src/pages/next-chats/index.tsx b/web/src/pages/next-chats/index.tsx
index 195fd99121..a6d764c530 100644
--- a/web/src/pages/next-chats/index.tsx
+++ b/web/src/pages/next-chats/index.tsx
@@ -49,70 +49,72 @@ export default function ChatList() {
}, [isCreate, handleShowCreateModal, searchParams, setSearchParams]);
return (
-
- {data.dialogs?.length <= 0 && !searchString && (
-
- handleShowCreateModal()}
- testId="chats-empty-create"
- />
-
- )}
- {(data.dialogs?.length > 0 || searchString) && (
- <>
-
+ <>
+ {data.dialogs?.length || searchString ? (
+
+
-
-
- {data.dialogs?.length <= 0 && searchString && (
-
- handleShowCreateModal()}
- testId="chats-empty-create"
- />
-
- )}
-
-
- {data.dialogs.map((x) => {
- return (
+
+
+ {data.dialogs?.length ? (
+ <>
+
+ {data.dialogs.map((x) => (
- );
- })}
-
-
-
-
-
- >
+ />
+ ))}
+
+
+
+ >
+ ) : (
+
+
+
+ )}
+
+ ) : (
+
+ handleShowCreateModal()}
+ testId="chats-empty-create"
+ />
+
)}
+
{chatRenameVisible && (
)}
-
+ >
);
}
diff --git a/web/src/pages/next-searches/index.tsx b/web/src/pages/next-searches/index.tsx
index f49563a2d5..70e9a01f43 100644
--- a/web/src/pages/next-searches/index.tsx
+++ b/web/src/pages/next-searches/index.tsx
@@ -65,25 +65,10 @@ export default function SearchList() {
}, [isCreate, openCreateModalFun, searchUrl, setSearchUrl]);
return (
-
- {(!list?.data?.search_apps?.length ||
- list?.data?.search_apps?.length <= 0) &&
- !searchString && (
-
- openCreateModalFun()}
- testId="search-empty-create"
- />
-
- )}
- {(!!list?.data?.search_apps?.length || searchString) && (
- <>
-
+ <>
+ {list?.data?.search_apps?.length || searchString ? (
+
+
{
- openCreateModalFun();
- }}
+ onClick={() => openCreateModalFun()}
>
-
+
{t('createSearch')}
-
- {(!list?.data?.search_apps?.length ||
- list?.data?.search_apps?.length <= 0) &&
- searchString && (
-
- openCreateModalFun()}
- testId="search-empty-create"
+
+
+ {list?.data?.search_apps?.length ? (
+ <>
+
+ {list?.data.search_apps.map((x) => {
+ return (
+ {
+ showSearchRenameModal(x);
+ }}
+ />
+ );
+ })}
+
+
+
- )}
-
-
- {list?.data.search_apps.map((x) => {
- return (
- {
- showSearchRenameModal(x);
- }}
- >
- );
- })}
-
-
- {list?.data.total && list?.data.total > 0 && (
-
-
+ >
+ ) : (
+
+
)}
- >
+
+ ) : (
+
+ openCreateModalFun()}
+ testId="search-empty-create"
+ />
+
)}
{openCreateModal && (
)}
-
+ >
);
}
diff --git a/web/src/pages/user-setting/index.tsx b/web/src/pages/user-setting/index.tsx
index f3b8568579..080ed3b8d1 100644
--- a/web/src/pages/user-setting/index.tsx
+++ b/web/src/pages/user-setting/index.tsx
@@ -6,10 +6,10 @@ import { cn } from '@/lib/utils';
const UserSetting = () => {
return (
);
diff --git a/web/src/pages/user-setting/profile/hooks/use-profile.ts b/web/src/pages/user-setting/profile/hooks/use-profile.ts
index 5b8bdf7b50..ffcd6ae134 100644
--- a/web/src/pages/user-setting/profile/hooks/use-profile.ts
+++ b/web/src/pages/user-setting/profile/hooks/use-profile.ts
@@ -1,4 +1,5 @@
// src/hooks/useProfile.ts
+import { DEFAULT_TIMEZONE } from '@/constants/setting';
import {
useFetchUserInfo,
useSaveSetting,
@@ -53,7 +54,10 @@ export const useProfile = () => {
// form.setValue('currPasswd', ''); // current password
const profile = {
userName: userInfo.nickname,
- timeZone: userInfo.timezone,
+ timeZone:
+ userInfo.timezone === ' UTC+8\tAsia/Shanghai'
+ ? DEFAULT_TIMEZONE.name
+ : userInfo.timezone,
avatar: userInfo.avatar || '',
email: userInfo.email,
currPasswd: userInfo.password,
diff --git a/web/src/pages/user-setting/profile/index.tsx b/web/src/pages/user-setting/profile/index.tsx
index 4b0d897ffb..9f330fab33 100644
--- a/web/src/pages/user-setting/profile/index.tsx
+++ b/web/src/pages/user-setting/profile/index.tsx
@@ -19,12 +19,17 @@ import { TimezoneList } from '@/pages/user-setting/constants';
import { zodResolver } from '@hookform/resolvers/zod';
import { t } from 'i18next';
import { Loader2Icon, PenLine } from 'lucide-react';
-import { FC, useEffect } from 'react';
+import { FC, useEffect, useMemo } from 'react';
import { useForm } from 'react-hook-form';
import { z } from 'zod';
import { ProfileSettingWrapperCard } from '../components/user-setting-header';
import { EditType, modalTitle, useProfile } from './hooks/use-profile';
+const timezoneOptions = TimezoneList.map(({ name }) => ({
+ value: name,
+ label: name,
+}));
+
const baseSchema = z.object({
userName: z
.string()
@@ -75,6 +80,7 @@ const passwordSchema = baseSchema
});
}
});
+
const ProfilePage: FC = () => {
const { t } = useTranslate('setting');
@@ -116,6 +122,11 @@ const ProfilePage: FC = () => {
// );
// };
+ const timezone = useMemo(() => {
+ const tz = TimezoneList.find((tz) => tz.name === profile.timeZone);
+ return tz?.name ?? '';
+ }, [profile.timeZone]);
+
return (
//
{
{t('timezone')}
-
- {profile.timeZone}
+
+ {timezone}
{
{t('timezone')}
{
- return { value: timeStr, label: timeStr };
- })}
+ options={timezoneOptions}
placeholder="Select a timeZone"
onChange={field.onChange}
value={field.value}
diff --git a/web/src/pages/user-setting/setting-locale/index.tsx b/web/src/pages/user-setting/setting-locale/index.tsx
deleted file mode 100644
index cb06ddde9a..0000000000
--- a/web/src/pages/user-setting/setting-locale/index.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { translationTable } from '@/locales/config';
-import TranslationTable from './translation-table';
-
-function UserSettingLocale() {
- return (
-
- );
-}
-
-export default UserSettingLocale;
diff --git a/web/src/pages/user-setting/setting-locale/translation-table.tsx b/web/src/pages/user-setting/setting-locale/translation-table.tsx
deleted file mode 100644
index 34c2c13494..0000000000
--- a/web/src/pages/user-setting/setting-locale/translation-table.tsx
+++ /dev/null
@@ -1,238 +0,0 @@
-import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';
-import {
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
-} from '@/components/ui/table';
-import { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react';
-import { useMemo, useState } from 'react';
-
-type TranslationTableRow = {
- key: string;
- [language: string]: string;
-};
-
-interface TranslationTableProps {
- data: TranslationTableRow[];
- languages: string[];
-}
-
-type FilterType = 'all' | 'show_empty' | 'show_non_empty';
-type SortOrder = 'asc' | 'desc' | null;
-
-interface ColumnState {
- key: string;
- sortOrder: SortOrder;
- filter: FilterType;
-}
-
-const TranslationTable: React.FC = ({
- data,
- languages,
-}) => {
- const [columnStates, setColumnStates] = useState(
- [{ key: 'key', sortOrder: null, filter: 'all' as FilterType }].concat(
- languages.map((lang) => ({
- key: lang,
- sortOrder: null,
- filter: 'all' as FilterType,
- })),
- ),
- );
-
- const [currentPage, setCurrentPage] = useState(1);
- const [pageSize, setPageSize] = useState(10);
-
- // Get the active sort column
- const activeSortColumn = useMemo(() => {
- return columnStates.find((col) => col.sortOrder !== null);
- }, [columnStates]);
-
- // Apply sorting and filtering
- const processedData = useMemo(() => {
- let filtered = [...data];
-
- // Apply filters for all columns
- columnStates.forEach((colState) => {
- if (colState.filter !== 'all') {
- filtered = filtered.filter((record) => {
- const value = record[colState.key];
- if (colState.filter === 'show_empty') {
- return !value || value.length === 0;
- }
- if (colState.filter === 'show_non_empty') {
- return value && value.length > 0;
- }
- return true;
- });
- }
- });
-
- // Apply sorting
- if (activeSortColumn && activeSortColumn.sortOrder) {
- filtered.sort((a, b) => {
- const aValue = a[activeSortColumn.key] || '';
- const bValue = b[activeSortColumn.key] || '';
- const comparison = String(aValue).localeCompare(String(bValue));
- return activeSortColumn.sortOrder === 'asc' ? comparison : -comparison;
- });
- }
-
- return filtered;
- }, [data, columnStates, activeSortColumn]);
-
- // Apply pagination
- const paginatedData = useMemo(() => {
- const start = (currentPage - 1) * pageSize;
- const end = start + pageSize;
- return processedData.slice(start, end);
- }, [processedData, currentPage, pageSize]);
-
- const handleSort = (columnKey: string) => {
- setColumnStates((prev) =>
- prev.map((col) => {
- if (col.key === columnKey) {
- let newOrder: SortOrder = 'asc';
- if (col.sortOrder === 'asc') {
- newOrder = 'desc';
- } else if (col.sortOrder === 'desc') {
- newOrder = null;
- }
- return { ...col, sortOrder: newOrder };
- }
- return { ...col, sortOrder: null };
- }),
- );
- };
-
- const handleFilter = (columnKey: string, filter: FilterType) => {
- setColumnStates((prev) =>
- prev.map((col) => (col.key === columnKey ? { ...col, filter } : col)),
- );
- setCurrentPage(1);
- };
-
- const renderSortIcon = (columnKey: string) => {
- const colState = columnStates.find((col) => col.key === columnKey);
- const sortOrder = colState?.sortOrder;
-
- if (sortOrder === 'asc') {
- return ;
- } else if (sortOrder === 'desc') {
- return ;
- } else {
- return ;
- }
- };
-
- const handlePageChange = (page: number, size: number) => {
- setCurrentPage(page);
- setPageSize(size);
- };
-
- return (
-
-
-
-
-
- handleSort('key')}
- >
-
- Key
- {renderSortIcon('key')}
-
-
- {languages.map((lang) => {
- const colState = columnStates.find((col) => col.key === lang)!;
- return (
-
-
-
handleSort(lang)}
- >
- {lang}
- {renderSortIcon(lang)}
-
-
- handleFilter(lang, 'show_empty')}
- >
- Empty
-
- handleFilter(lang, 'show_non_empty')}
- >
- Non-Empty
-
- handleFilter(lang, 'all')}
- >
- All
-
-
-
-
- );
- })}
-
-
-
- {paginatedData.length > 0 ? (
- paginatedData.map((record) => (
-
-
- {record.key}
-
- {languages.map((lang) => (
-
- {record[lang] || ''}
-
- ))}
-
- ))
- ) : (
-
-
- No data
-
-
- )}
-
-
-
-
-
- );
-};
-
-export default TranslationTable;
diff --git a/web/src/pages/user-setting/sidebar/index.tsx b/web/src/pages/user-setting/sidebar/index.tsx
index fbb6e51000..e093ce0203 100644
--- a/web/src/pages/user-setting/sidebar/index.tsx
+++ b/web/src/pages/user-setting/sidebar/index.tsx
@@ -128,7 +128,8 @@ export function SideBar() {