Skip to content

🤯 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.

💄 style(daily-brief): add skeleton loading state (#14333)

Tsuki24062bb412fa
diff --git a/src/features/DailyBrief/BriefCardSkeleton.tsx b/src/features/DailyBrief/BriefCardSkeleton.tsx
new file mode 100644
index 00000000000..8ed10e31867
--- /dev/null
+++ b/src/features/DailyBrief/BriefCardSkeleton.tsx
@@ -0,0 +1,37 @@
+import { Block, Flexbox, Skeleton } from '@lobehub/ui';
+import { Divider } from 'antd';
+import { cssVar } from 'antd-style';
+import { memo } from 'react';
+
+const BriefCardSkeleton = memo(() => {
+ return (
+ <Block
+ gap={12}
+ padding={12}
+ style={{ borderRadius: cssVar.borderRadiusLG }}
+ variant={'outlined'}
+ >
+ <Flexbox horizontal align={'center'} gap={16} justify={'space-between'}>
+ <Flexbox horizontal align={'center'} gap={8} style={{ overflow: 'hidden' }}>
+ <Skeleton.Avatar active shape={'circle'} size={18} style={{ flex: 'none' }} />
+ <Skeleton.Button active style={{ height: 20, width: 200 }} />
+ <Skeleton.Button active style={{ height: 14, width: 60 }} />
+ </Flexbox>
+ <Flexbox horizontal align={'center'} gap={8}>
+ <Skeleton.Avatar active shape={'circle'} size={28} style={{ flex: 'none' }} />
+ </Flexbox>
+ </Flexbox>
+
+ <Divider dashed style={{ marginBlock: 0 }} />
+
+ <Skeleton.Paragraph active fontSize={14} rows={3} style={{ marginBottom: 0 }} />
+
+ <Flexbox horizontal gap={8} style={{ alignSelf: 'flex-end' }}>
+ <Skeleton.Button active style={{ height: 28, width: 100 }} />
+ <Skeleton.Button active style={{ height: 28, width: 80 }} />
+ </Flexbox>
+ </Block>
+ );
+});
+
+export default BriefCardSkeleton;
diff --git a/src/features/DailyBrief/index.tsx b/src/features/DailyBrief/index.tsx
index 7ac1ca36911..284a83d570a 100644
--- a/src/features/DailyBrief/index.tsx
+++ b/src/features/DailyBrief/index.tsx
@@ -12,6 +12,7 @@ import { useUserStore } from '@/store/user';
import { authSelectors } from '@/store/user/slices/auth/selectors';
import BriefCard from './BriefCard';
+import BriefCardSkeleton from './BriefCardSkeleton';
const DailyBrief = memo(() => {
const { t } = useTranslation('home');
@@ -24,7 +25,20 @@ const DailyBrief = memo(() => {
const briefs = useBriefStore(briefListSelectors.briefs);
const isInit = useBriefStore(briefListSelectors.isBriefsInit);
- if (!enableAgentTask || !isInit || briefs.length === 0) return null;
+ if (!enableAgentTask || !isLogin) return null;
+
+ if (!isInit) {
+ return (
+ <GroupBlock icon={Newspaper} title={t('brief.title')}>
+ <Flexbox gap={12}>
+ <BriefCardSkeleton />
+ <BriefCardSkeleton />
+ </Flexbox>
+ </GroupBlock>
+ );
+ }
+
+ if (briefs.length === 0) return null;
return (
<GroupBlock