Feat: Switch the root route to the new page #3221 (#9560)

### What problem does this PR solve?

Feat: Switch the root route to the new page #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-08-19 17:41:03 +08:00
committed by GitHub
parent d5729e598f
commit b8bfbac2e5
12 changed files with 265 additions and 164 deletions

View File

@ -40,7 +40,7 @@ export function Header() {
const { t } = useTranslation();
const { pathname } = useLocation();
const navigate = useNavigateWithFromState();
const { navigateToProfile } = useNavigatePage();
const { navigateToOldProfile } = useNavigatePage();
const changeLanguage = useChangeLanguage();
const { setTheme, theme } = useTheme();
@ -74,7 +74,7 @@ export function Header() {
const tagsData = useMemo(
() => [
{ path: Routes.Home, name: t('header.home'), icon: House },
{ path: Routes.Root, name: t('header.Root'), icon: House },
{ path: Routes.Datasets, name: t('header.dataset'), icon: Library },
{ path: Routes.Chats, name: t('header.chat'), icon: MessageSquareText },
{ path: Routes.Searches, name: t('header.search'), icon: Search },
@ -90,7 +90,7 @@ export function Header() {
return {
label:
tag.path === Routes.Home ? (
tag.path === Routes.Root ? (
<HeaderIcon className="size-6"></HeaderIcon>
) : (
<span>{tag.name}</span>
@ -100,18 +100,18 @@ export function Header() {
});
}, [tagsData]);
const currentPath = useMemo(() => {
return (
tagsData.find((x) => pathname.startsWith(x.path))?.path || Routes.Home
);
}, [pathname, tagsData]);
// const currentPath = useMemo(() => {
// return (
// tagsData.find((x) => pathname.startsWith(x.path))?.path || Routes.Root
// );
// }, [pathname, tagsData]);
const handleChange = (path: SegmentedValue) => {
navigate(path as Routes);
};
const handleLogoClick = useCallback(() => {
navigate(Routes.Home);
navigate(Routes.Root);
}, [navigate]);
return (
@ -123,14 +123,19 @@ export function Header() {
className="size-10 mr-[12]"
onClick={handleLogoClick}
/>
<div className="flex items-center gap-1.5 text-text-secondary">
<Github className="size-3.5" />
<span className=" text-base">21.5k stars</span>
</div>
<a
className="flex items-center gap-1.5 text-text-secondary"
target="_blank"
href="https://github.com/infiniflow/ragflow"
rel="noreferrer"
>
<Github className="size-4" />
{/* <span className=" text-base">21.5k stars</span> */}
</a>
</div>
<Segmented
options={options}
value={currentPath}
value={pathname}
onChange={handleChange}
></Segmented>
<div className="flex items-center gap-5 text-text-badge">
@ -160,7 +165,7 @@ export function Header() {
name={nickname}
avatar={avatar}
className="size-8 cursor-pointer"
onClick={navigateToProfile}
onClick={navigateToOldProfile}
></RAGFlowAvatar>
{/* Temporarily hidden */}
{/* <Badge className="h-5 w-8 absolute font-normal p-0 justify-center -right-8 -top-2 text-bg-base bg-gradient-to-l from-[#42D7E7] to-[#478AF5]">