🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(home): restore welcome typewriter stability (#14270)
Inneic6a013a1a1ca
diff --git a/src/routes/(main)/home/features/WelcomeText/index.tsx b/src/routes/(main)/home/features/WelcomeText/index.tsxindex 08a86ec449d..69e8b32b918 100644--- a/src/routes/(main)/home/features/WelcomeText/index.tsx+++ b/src/routes/(main)/home/features/WelcomeText/index.tsx@@ -1,14 +1,18 @@import { Center } from '@lobehub/ui';-import { sample } from 'es-toolkit/compat';+import { TypewriterEffect } from '@lobehub/ui/awesome';+import { LoadingDots } from '@lobehub/ui/chat';+import { cssVar } from 'antd-style';+import { shuffle } from 'es-toolkit/compat';import { memo, useMemo } from 'react';import { useTranslation } from 'react-i18next';const WelcomeText = memo(() => {- const { t } = useTranslation('welcome');+ const { t, i18n } = useTranslation('welcome');+ const locale = i18n.language;- const sentence = useMemo(() => {+ const sentences = useMemo(() => {const messages = t('welcomeMessages', { returnObjects: true }) as Record<string, string>;- return sample(Object.values(messages));+ return shuffle(Object.values(messages));}, [t]);return (@@ -19,7 +23,17 @@ const WelcomeText = memo(() => {marginBlock: '36px 24px',}}>- {sentence}+ <TypewriterEffect+ cursorCharacter={<LoadingDots color={cssVar.colorText} size={20} variant={'pulse'} />}+ cursorFade={false}+ deletePauseDuration={1000}+ deletingSpeed={32}+ hideCursorWhileTyping={'afterTyping'}+ key={locale}+ pauseDuration={16_000}+ sentences={sentences}+ typingSpeed={64}+ /></Center>);});diff --git a/src/routes/(main)/home/features/index.tsx b/src/routes/(main)/home/features/index.tsxindex 7a6804edfbf..01c587af3e7 100644--- a/src/routes/(main)/home/features/index.tsx+++ b/src/routes/(main)/home/features/index.tsx@@ -1,8 +1,7 @@'use client';import { Flexbox } from '@lobehub/ui';-import { memo, useCallback } from 'react';-import { useTranslation } from 'react-i18next';+import { memo } from 'react';import RecommendTaskTemplates from '@/business/client/RecommendTaskTemplates';import DailyBrief from '@/features/DailyBrief';@@ -16,7 +15,6 @@ import InputArea from './InputArea';import WelcomeText from './WelcomeText';const Home = memo(() => {- const { i18n } = useTranslation();const isLogin = useUserStore(authSelectors.isLogin);const isDevMode = useUserStore((s) => userGeneralSettingsSelectors.config(s).isDevMode);const inputActiveMode = useHomeStore((s) => s.inputActiveMode);@@ -24,12 +22,9 @@ const Home = memo(() => {// Hide other modules when a starter mode is activeconst hideOtherModules = inputActiveMode && ['agent', 'group', 'write'].includes(inputActiveMode);- // eslint-disable-next-line @eslint-react/no-nested-component-definitions- const Welcome = useCallback(() => <WelcomeText />, [i18n.language]);-return (<Flexbox gap={40}>- <Welcome />+ <WelcomeText /><InputArea />{isLogin && (<Flexbox gap={40} style={{ display: hideOtherModules ? 'none' : undefined }}>