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(sidebar): align project group icon column with density metrics (#23664)

Lobehub Coderdafa62103446
diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx
index 3701fc1479d..305e3c030a9 100644
--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx
+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.tsx
@@ -34,6 +34,7 @@ import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspace
import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
import TailMarquee from '@/components/TailMarquee';
import { useCommitWorkingDirectory } from '@/features/ChatInput/ControlBar/useCommitWorkingDirectory';
+import { useNavItemMetrics } from '@/features/NavPanel/density';
import ProjectAvatar from '@/features/Projects/ProjectAvatar';
import { AgentDirectoryActions } from '@/features/Projects/WorkingDirectories/AgentDirectoryActions';
import { canStageDraftOn } from '@/features/Projects/WorkingDirectories/startProjectTopicDraft';
@@ -79,6 +80,7 @@ const FOLDER_SUB_GROUP_MODES = SUB_GROUP_MODES.filter((mode) => mode !== 'byDevi
const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {
const { id, title, children, deviceId: groupDeviceId } = group;
+ const metrics = useNavItemMetrics();
const scope = useTopicListScope();
const navigate = useWorkspaceAwareNavigate();
// `project-id:` groups merge every directory of one project — resolve the
@@ -336,8 +338,14 @@ const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {
<AccordionItem value={id}>
<AccordionHeader className={'accordion-header'}>
<AccordionTrigger style={{ paddingBlock: 4, paddingInline: 4 }}>
- <Flexbox horizontal align="center" gap={8} height={24} style={{ overflow: 'hidden' }}>
- <Center flex="none" height={24} width={28}>
+ <Flexbox
+ horizontal
+ align="center"
+ gap={metrics.gap}
+ height={24}
+ style={{ overflow: 'hidden' }}
+ >
+ <Center flex="none" height={24} width={metrics.iconBox}>
{project ? (
<ProjectAvatar
avatar={project.projectAvatar}
@@ -354,7 +362,11 @@ const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {
)}
</Center>
{project ? (
- <Text ellipsis fontSize={14} style={{ color: cssVar.colorText, flex: 1 }}>
+ <Text
+ ellipsis
+ fontSize={metrics.fontSize}
+ style={{ color: cssVar.colorText, flex: 1 }}
+ >
{scope ? (
title
) : (
@@ -390,7 +402,7 @@ const GroupItem = memo<GroupItemComponentProps>(({ group, expanded }) => {
<TailMarquee
style={{
color: cssVar.colorTextSecondary,
- fontSize: 14,
+ fontSize: metrics.fontSize,
// Beside a device tag, hug the name instead of filling the row,
// so it stays next to its icon and the tag follows it.
...(deviceLabel && { flex: '0 1 auto' }),
diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.test.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.test.tsx
index 79e0e3c2fb9..7cfd5621bef 100644
--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.test.tsx
+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/ProjectTopicList.test.tsx
@@ -44,6 +44,7 @@ vi.mock('@/store/user', () => ({
}));
vi.mock('@/store/user/selectors', () => ({
preferenceSelectors: { topicSortBy: () => 'updatedAt' },
+ userGeneralSettingsSelectors: { interfaceDensity: () => 'loose' },
}));
vi.mock('@/store/chat', () => ({
diff --git a/src/features/AgentSidebar/Topic/TopicListContent/TopicSubGroupItem.tsx b/src/features/AgentSidebar/Topic/TopicListContent/TopicSubGroupItem.tsx
index adcfb0efc0c..61256ed0582 100644
--- a/src/features/AgentSidebar/Topic/TopicListContent/TopicSubGroupItem.tsx
+++ b/src/features/AgentSidebar/Topic/TopicListContent/TopicSubGroupItem.tsx
@@ -19,6 +19,7 @@ import { useTranslation } from 'react-i18next';
import TailMarquee from '@/components/TailMarquee';
import EmptyNavItem from '@/features/NavPanel/components/EmptyNavItem';
+import { useNavItemMetrics } from '@/features/NavPanel/density';
import { type ChatTopic, type GroupedTopic } from '@/types/topic';
import TopicItem from '../List/Item';
@@ -68,6 +69,7 @@ const TopicSubGroupItem = memo<TopicSubGroupItemProps>(
tag,
title,
}) => {
+ const metrics = useNavItemMetrics();
const { t } = useTranslation('topic');
const { t: tProject } = useTranslation('project');
// A folded section keeps the parent row's running / awaiting / failed
@@ -80,8 +82,14 @@ const TopicSubGroupItem = memo<TopicSubGroupItemProps>(
{/* Same icon column and gap as the parent row, so the section
title lines up with the parent name and the topics below. */}
<AccordionTrigger style={{ paddingBlock: 2, paddingInline: 4 }}>
- <Flexbox horizontal align="center" gap={8} height={24} style={{ overflow: 'hidden' }}>
- <Center flex={'none'} height={24} width={28}>
+ <Flexbox
+ horizontal
+ align="center"
+ gap={metrics.gap}
+ height={24}
+ style={{ overflow: 'hidden' }}
+ >
+ <Center flex={'none'} height={24} width={metrics.iconBox}>
{icon}
</Center>
<Text ellipsis fontSize={12} type={'secondary'} weight={500}>