🤯 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
💄 style: change skills using this skill list style (#12089)
Rdmclin296fa203c810b
diff --git a/src/features/MCPPluginDetail/Agents.tsx b/src/features/MCPPluginDetail/Agents.tsxindex a74724eb991..23755c0ead3 100644--- a/src/features/MCPPluginDetail/Agents.tsx+++ b/src/features/MCPPluginDetail/Agents.tsx@@ -1,148 +1,22 @@'use client';-import { Avatar, Block, Center, Flexbox, Grid, Icon, Skeleton, Text } from '@lobehub/ui';-import { createStaticStyles, cssVar } from 'antd-style';-import { ClockIcon, InboxIcon, ServerCrash } from 'lucide-react';+import { Center, Grid, Icon, Skeleton, Text } from '@lobehub/ui';+import { cssVar } from 'antd-style';+import { InboxIcon, ServerCrash } from 'lucide-react';import { memo, useCallback, useEffect, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { VirtuosoGrid } from 'react-virtuoso';-import PublishedTime from '@/components/PublishedTime';+import AgentItem from '@/features/SkillStore/SkillDetail/AgentItem';+import { agentListStyles as styles } from '@/features/SkillStore/SkillDetail/style';import VirtuosoLoading from '@/features/SkillStore/SkillList/VirtuosoLoading';-import { virtuosoGridStyles } from '@/features/SkillStore/SkillList/style';import { useClientDataSWR } from '@/libs/swr';import { discoverService } from '@/services/discover';import { type DiscoverAssistantItem } from '@/types/discover';import { useDetailContext } from './DetailProvider';-const PAGE_SIZE = 6;--const styles = createStaticStyles(({ css, cssVar }) => ({- author: css`- color: ${cssVar.colorTextDescription};- `,- desc: css`- flex: 1;- margin: 0 !important;- color: ${cssVar.colorTextSecondary};- `,- footer: css`- margin-block-start: 16px;- border-block-start: 1px dashed ${cssVar.colorBorder};- background: ${cssVar.colorBgContainer};- `,- secondaryDesc: css`- font-size: 12px;- color: ${cssVar.colorTextDescription};- `,- title: css`- margin: 0 !important;- font-size: 16px !important;- font-weight: 500 !important;-- &:hover {- color: ${cssVar.colorLink};- }- `,-}));--const AgentItem = memo<DiscoverAssistantItem>(- ({ createdAt, author, avatar, title, description, identifier, category, backgroundColor }) => {- return (- <a- href={`/community/agent/${identifier}`}- rel="noopener noreferrer"- style={{ display: 'block', height: '100%' }}- target="_blank"- >- <Block- clickable- height={'100%'}- style={{- overflow: 'hidden',- position: 'relative',- }}- variant={'outlined'}- width={'100%'}- >- <Flexbox- align={'flex-start'}- gap={16}- horizontal- justify={'space-between'}- padding={16}- width={'100%'}- >- <Flexbox- gap={12}- horizontal- style={{- overflow: 'hidden',- }}- title={identifier}- >- <Avatar- avatar={avatar}- background={backgroundColor || 'transparent'}- shape={'square'}- size={40}- style={{ flex: 'none' }}- />- <Flexbox- flex={1}- gap={2}- style={{- overflow: 'hidden',- }}- >- <Text as={'h2'} className={styles.title} ellipsis>- {title}- </Text>- {author && <div className={styles.author}>{author}</div>}- </Flexbox>- </Flexbox>- </Flexbox>- <Flexbox flex={1} gap={12} paddingInline={16}>- <Text- as={'p'}- className={styles.desc}- ellipsis={{- rows: 3,- }}- >- {description}- </Text>- </Flexbox>- <Flexbox- align={'center'}- className={styles.footer}- horizontal- justify={'space-between'}- padding={16}- >- <Flexbox- align={'center'}- className={styles.secondaryDesc}- horizontal- justify={'space-between'}- >- <Flexbox align={'center'} gap={4} horizontal>- <Icon icon={ClockIcon} size={14} />- <PublishedTime- className={styles.secondaryDesc}- date={createdAt}- template={'MMM DD, YYYY'}- />- </Flexbox>- {category && <span style={{ marginLeft: 12 }}>{category}</span>}- </Flexbox>- </Flexbox>- </Block>- </a>- );- },-);+const PAGE_SIZE = 12;interface AgentsProps {inModal?: boolean;@@ -195,9 +69,14 @@ const Agents = memo<AgentsProps>(({ inModal }) => {// Initial loading stateif (!isInitialized && isLoading) {return (- <Grid gap={16} rows={2} width={'100%'}>+ <Grid gap={12} rows={2} width={'100%'}>{Array.from({ length: 4 }).map((_, index) => (- <Skeleton active key={index} paragraph={{ rows: 4 }} />+ <Skeleton+ active+ avatar={{ shape: 'square', size: 40 }}+ key={index}+ paragraph={{ rows: 1 }}+ />))}</Grid>);@@ -232,9 +111,9 @@ const Agents = memo<AgentsProps>(({ inModal }) => {data={items}endReached={loadMore}increaseViewportBy={typeof window !== 'undefined' ? window.innerHeight : 0}- itemClassName={virtuosoGridStyles.item}+ itemClassName={styles.item}itemContent={(_, item) => <AgentItem key={item.identifier} {...item} />}- listClassName={virtuosoGridStyles.list}+ listClassName={styles.list}overscan={24}style={inModal ? { height: '50vh', width: '100%' } : { width: '100%' }}useWindowScroll={!inModal}diff --git a/src/features/SkillStore/SkillDetail/AgentItem.tsx b/src/features/SkillStore/SkillDetail/AgentItem.tsxnew file mode 100644index 00000000000..344e06bc922--- /dev/null+++ b/src/features/SkillStore/SkillDetail/AgentItem.tsx@@ -0,0 +1,57 @@+'use client';++import { Avatar, Block, Flexbox } from '@lobehub/ui';+import { memo } from 'react';++import { itemStyles } from './style';++interface AgentItemProps {+ avatar?: string;+ backgroundColor?: string;+ description?: string;+ identifier?: string;+ title?: string;+}++const AgentItem = memo<AgentItemProps>(+ ({ avatar, title, description, identifier, backgroundColor }) => {+ const styles = itemStyles;++ if (!identifier || !title) return null;++ return (+ <a+ href={`/community/agent/${identifier}`}+ rel="noopener noreferrer"+ style={{ display: 'block', height: '100%' }}+ target="_blank"+ >+ <Block+ align={'center'}+ className={styles.container}+ clickable+ gap={12}+ horizontal+ paddingBlock={12}+ paddingInline={12}+ style={{ cursor: 'pointer', height: '100%' }}+ variant={'outlined'}+ >+ <Avatar+ avatar={avatar}+ background={backgroundColor || 'transparent'}+ shape={'square'}+ size={40}+ style={{ flex: 'none' }}+ />+ <Flexbox flex={1} gap={4} style={{ minWidth: 0, overflow: 'hidden' }}>+ <span className={styles.title}>{title}</span>+ {description && <span className={styles.description}>{description}</span>}+ </Flexbox>+ </Block>+ </a>+ );+ },+);++export default AgentItem;diff --git a/src/features/SkillStore/SkillDetail/Agents.tsx b/src/features/SkillStore/SkillDetail/Agents.tsxindex c0242ac2d73..c62dea46861 100644--- a/src/features/SkillStore/SkillDetail/Agents.tsx+++ b/src/features/SkillStore/SkillDetail/Agents.tsx@@ -1,148 +1,22 @@'use client';-import { Avatar, Block, Center, Flexbox, Grid, Icon, Skeleton, Text } from '@lobehub/ui';-import { createStaticStyles, cssVar } from 'antd-style';-import { ClockIcon, InboxIcon, ServerCrash } from 'lucide-react';+import { Center, Grid, Icon, Skeleton, Text } from '@lobehub/ui';+import { cssVar } from 'antd-style';+import { InboxIcon, ServerCrash } from 'lucide-react';import { memo, useCallback, useEffect, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { VirtuosoGrid } from 'react-virtuoso';-import PublishedTime from '@/components/PublishedTime';import { useClientDataSWR } from '@/libs/swr';import { discoverService } from '@/services/discover';import { type DiscoverAssistantItem } from '@/types/discover';-import VirtuosoLoading from '../SkillList/VirtuosoLoading';-import { virtuosoGridStyles } from '../SkillList/style';+import AgentItem from './AgentItem';import { useDetailContext } from './DetailContext';+import VirtuosoLoading from './VirtuosoLoading';+import { agentListStyles as styles } from './style';-const PAGE_SIZE = 6;--const styles = createStaticStyles(({ css, cssVar }) => ({- author: css`- color: ${cssVar.colorTextDescription};- `,- desc: css`- flex: 1;- margin: 0 !important;- color: ${cssVar.colorTextSecondary};- `,- footer: css`- margin-block-start: 16px;- border-block-start: 1px dashed ${cssVar.colorBorder};- background: ${cssVar.colorBgContainer};- `,- secondaryDesc: css`- font-size: 12px;- color: ${cssVar.colorTextDescription};- `,- title: css`- margin: 0 !important;- font-size: 16px !important;- font-weight: 500 !important;-- &:hover {- color: ${cssVar.colorLink};- }- `,-}));--const AgentItem = memo<DiscoverAssistantItem>(- ({ createdAt, author, avatar, title, description, identifier, category, backgroundColor }) => {- return (- <a- href={`/community/agent/${identifier}`}- rel="noopener noreferrer"- style={{ display: 'block', height: '100%' }}- target="_blank"- >- <Block- clickable- height={'100%'}- style={{- overflow: 'hidden',- position: 'relative',- }}- variant={'outlined'}- width={'100%'}- >- <Flexbox- align={'flex-start'}- gap={16}- horizontal- justify={'space-between'}- padding={16}- width={'100%'}- >- <Flexbox- gap={12}- horizontal- style={{- overflow: 'hidden',- }}- title={identifier}- >- <Avatar- avatar={avatar}- background={backgroundColor || 'transparent'}- shape={'square'}- size={40}- style={{ flex: 'none' }}- />- <Flexbox- flex={1}- gap={2}- style={{- overflow: 'hidden',- }}- >- <Text as={'h2'} className={styles.title} ellipsis>- {title}- </Text>- {author && <div className={styles.author}>{author}</div>}- </Flexbox>- </Flexbox>- </Flexbox>- <Flexbox flex={1} gap={12} paddingInline={16}>- <Text- as={'p'}- className={styles.desc}- ellipsis={{- rows: 3,- }}- >- {description}- </Text>- </Flexbox>- <Flexbox- align={'center'}- className={styles.footer}- horizontal- justify={'space-between'}- padding={16}- >- <Flexbox- align={'center'}- className={styles.secondaryDesc}- horizontal- justify={'space-between'}- >- <Flexbox align={'center'} gap={4} horizontal>- <Icon icon={ClockIcon} size={14} />- <PublishedTime- className={styles.secondaryDesc}- date={createdAt}- template={'MMM DD, YYYY'}- />- </Flexbox>- {category && <span style={{ marginLeft: 12 }}>{category}</span>}- </Flexbox>- </Flexbox>- </Block>- </a>- );- },-);+const PAGE_SIZE = 12;const Agents = memo(() => {const { t } = useTranslation('plugin');@@ -191,9 +65,14 @@ const Agents = memo(() => {// Initial loading stateif (!isInitialized && isLoading) {return (- <Grid gap={16} rows={2} width={'100%'}>+ <Grid gap={12} rows={2} width={'100%'}>{Array.from({ length: 4 }).map((_, index) => (- <Skeleton active key={index} paragraph={{ rows: 4 }} />+ <Skeleton+ active+ avatar={{ shape: 'square', size: 40 }}+ key={index}+ paragraph={{ rows: 1 }}+ />))}</Grid>);@@ -228,9 +107,9 @@ const Agents = memo(() => {data={items}endReached={loadMore}increaseViewportBy={typeof window !== 'undefined' ? window.innerHeight : 0}- itemClassName={virtuosoGridStyles.item}+ itemClassName={styles.item}itemContent={(_, item) => <AgentItem key={item.identifier} {...item} />}- listClassName={virtuosoGridStyles.list}+ listClassName={styles.list}overscan={24}style={{ height: '50vh', width: '100%' }}/>diff --git a/src/features/SkillStore/SkillDetail/VirtuosoLoading.tsx b/src/features/SkillStore/SkillDetail/VirtuosoLoading.tsxnew file mode 100644index 00000000000..0c921dc40c0--- /dev/null+++ b/src/features/SkillStore/SkillDetail/VirtuosoLoading.tsx@@ -0,0 +1,14 @@+import { Center, Icon } from '@lobehub/ui';+import { cssVar } from 'antd-style';+import { Loader2Icon } from 'lucide-react';+import { memo } from 'react';++const VirtuosoLoading = memo(() => {+ return (+ <Center padding={16}>+ <Icon color={cssVar.colorTextDescription} icon={Loader2Icon} spin />+ </Center>+ );+});++export default VirtuosoLoading;diff --git a/src/features/SkillStore/SkillDetail/style.ts b/src/features/SkillStore/SkillDetail/style.tsnew file mode 100644index 00000000000..74beb46b7f6--- /dev/null+++ b/src/features/SkillStore/SkillDetail/style.ts@@ -0,0 +1,43 @@+import { createStaticStyles, responsive } from 'antd-style';++export const agentListStyles = createStaticStyles(({ css }) => ({+ item: css`+ width: calc(50% - 6px);++ ${responsive.sm} {+ width: 100%;+ }+ `,+ list: css`+ display: flex;+ flex-wrap: wrap;+ gap: 12px;+ padding-block-end: 16px;+ `,+}));++export const itemStyles = createStaticStyles(({ css, cssVar }) => ({+ container: css`+ position: relative;+ overflow: hidden;+ flex: 1;+ min-width: 0;+ `,+ description: css`+ overflow: hidden;++ font-size: 12px;+ color: ${cssVar.colorTextSecondary};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+ title: css`+ overflow: hidden;++ font-size: 14px;+ font-weight: 500;+ color: ${cssVar.colorText};+ text-overflow: ellipsis;+ white-space: nowrap;+ `,+}));