feat: replace ToolCard grid with compact icon+name grid on Dashboard
- Replace large ToolCard layout with dense grid (3-6 columns responsive) - Each item shows icon + tool name in a compact tile - Hover highlights icon and text with smooth transitions - Remove ToolCard import from Dashboard (component retained for reuse) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { useRouter } from '@/providers/RouterProvider';
|
import { useRouter } from '@/providers/RouterProvider';
|
||||||
import ToolCard from '@/pages/Dashboard/ToolCard';
|
|
||||||
import { getFeatureByKey } from '@/config/features';
|
import { getFeatureByKey } from '@/config/features';
|
||||||
import type { PageType } from '@/types/storage';
|
import type { PageType } from '@/types/storage';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
@@ -89,26 +88,39 @@ export default function DashboardPage() {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 全部工具 */}
|
{/* 全部工具 — 紧凑 Grid */}
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<h3 className="text-xs font-semibold text-muted-foreground/80 uppercase tracking-wider">
|
<h3 className="text-xs font-semibold text-muted-foreground/80 uppercase tracking-wider">
|
||||||
{t('dashboard_allTools')}
|
{t('dashboard_allTools')}
|
||||||
</h3>
|
</h3>
|
||||||
<div
|
<div className={cn('grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-2')}>
|
||||||
className={cn(
|
{filteredFeatures.map(({ key, feature }) => {
|
||||||
'grid grid-cols-1 sm:grid-cols-[repeat(auto-fill,minmax(290px,1fr))] auto-rows-auto gap-3.5',
|
const IconComponent = feature!.icon!;
|
||||||
)}
|
return (
|
||||||
>
|
<button
|
||||||
{filteredFeatures.map(({ key, feature }) => (
|
key={key}
|
||||||
<ToolCard
|
type="button"
|
||||||
key={key}
|
onClick={() => navigateTo(key as PageType)}
|
||||||
title={t(feature!.labelKey)}
|
className={cn(
|
||||||
description={t(feature!.descriptionKey)}
|
'group flex flex-col items-center justify-center gap-1.5',
|
||||||
colorKey={feature!.themeColorKey!}
|
'py-3 px-2 rounded-xl border border-border/50 bg-card',
|
||||||
icon={feature!.icon!}
|
'hover:bg-muted/40 hover:border-primary/30',
|
||||||
onNavigate={() => navigateTo(key as PageType)}
|
'transition-colors cursor-pointer',
|
||||||
/>
|
)}
|
||||||
))}
|
>
|
||||||
|
<IconComponent
|
||||||
|
className={cn(
|
||||||
|
'h-5 w-5 text-muted-foreground/70',
|
||||||
|
'group-hover:text-foreground',
|
||||||
|
'transition-colors',
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
<span className="text-[11px] font-medium text-muted-foreground/80 group-hover:text-foreground leading-tight text-center truncate w-full transition-colors">
|
||||||
|
{t(feature!.labelKey)}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user