mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-06 21:35:52 +08:00
Add loading state with spinner and i18n support to SessionsTab
- Replace static "No active agent" message with a spinner and loading text - Integrate react-i18next for translation of loading message - Adjust animation timing and styling for smoother loading state transition
This commit is contained in:
parent
6c233fef9f
commit
34b05a138b
@ -1,6 +1,8 @@
|
|||||||
|
import { Spinner } from '@heroui/react'
|
||||||
import { useRuntime } from '@renderer/hooks/useRuntime'
|
import { useRuntime } from '@renderer/hooks/useRuntime'
|
||||||
import { AnimatePresence,motion } from 'framer-motion'
|
import { AnimatePresence, motion } from 'framer-motion'
|
||||||
import { FC, memo } from 'react'
|
import { FC, memo } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
import Sessions from './components/Sessions'
|
import Sessions from './components/Sessions'
|
||||||
|
|
||||||
@ -9,18 +11,26 @@ interface SessionsTabProps {}
|
|||||||
const SessionsTab: FC<SessionsTabProps> = () => {
|
const SessionsTab: FC<SessionsTabProps> = () => {
|
||||||
const { chat } = useRuntime()
|
const { chat } = useRuntime()
|
||||||
const { activeAgentId } = chat
|
const { activeAgentId } = chat
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatePresence mode="wait">
|
<AnimatePresence mode="wait">
|
||||||
{!activeAgentId ? (
|
{!activeAgentId ? (
|
||||||
<motion.div
|
<motion.div
|
||||||
key="no-agent"
|
key="loading"
|
||||||
initial={{ opacity: 0, y: 10 }}
|
initial={{ opacity: 0 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1 }}
|
||||||
exit={{ opacity: 0, y: -10 }}
|
exit={{ opacity: 0 }}
|
||||||
transition={{ duration: 0.2 }}
|
transition={{ duration: 0.3 }}
|
||||||
className="flex h-full items-center justify-center text-foreground-500">
|
className="flex h-full flex-col items-center justify-center gap-3">
|
||||||
No active agent.
|
<Spinner size="lg" color="primary" />
|
||||||
|
<motion.p
|
||||||
|
initial={{ opacity: 0, y: 5 }}
|
||||||
|
animate={{ opacity: 1, y: 0 }}
|
||||||
|
transition={{ delay: 0.2, duration: 0.3 }}
|
||||||
|
className="text-sm text-foreground-500">
|
||||||
|
{t('common.loading')}...
|
||||||
|
</motion.p>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
) : (
|
) : (
|
||||||
<motion.div
|
<motion.div
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user