From 8b10e64128bcb60dafe12d439cadb8b155aa1ebb Mon Sep 17 00:00:00 2001 From: songtianlun Date: Sun, 3 Aug 2025 00:27:02 +0800 Subject: [PATCH] better loading in studio --- CLAUDE.md | 4 +++- src/app/studio/page.tsx | 13 ++++++++---- src/components/ui/loading-ring.tsx | 34 ++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 src/components/ui/loading-ring.tsx diff --git a/CLAUDE.md b/CLAUDE.md index e8308cd..87f0b41 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -195,4 +195,6 @@ Required environment variables: 1. 暂停思考的习惯 - 在行动前先分析现有结构 2. 质量优先的价值观 - 宁可慢一点也要做对 3. 整体设计思维 - 考虑代码的可维护性和一致性 -4. 优先按照最佳实践完成工作 \ No newline at end of file +4. 优先按照最佳实践完成工作 +5. 完成一个模块后执行 build 查看是否有报错,确保能够成功构建后移除调试代码。 +6. 时刻保证布局友好和界面美观 diff --git a/src/app/studio/page.tsx b/src/app/studio/page.tsx index 2b04e2c..ea01ed5 100644 --- a/src/app/studio/page.tsx +++ b/src/app/studio/page.tsx @@ -7,7 +7,7 @@ import { useRouter } from 'next/navigation' import { Header } from '@/components/layout/Header' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' -import { FullScreenLoading } from '@/components/ui/full-screen-loading' +import { LoadingRing } from '@/components/ui/loading-ring' import { EditPromptModal } from '@/components/studio/EditPromptModal' import { PromptDetailModal } from '@/components/studio/PromptDetailModal' import { BulkAddPromptModal } from '@/components/studio/BulkAddPromptModal' @@ -275,8 +275,8 @@ export default function StudioPage() { // Use server-side pagination const currentPrompts = filteredPrompts - if (loading || isLoading) { - return + if (loading) { + return null } if (!user) { @@ -418,7 +418,12 @@ export default function StudioPage() { {/* Content */} - {filteredPrompts.length === 0 ? ( + {isLoading ? ( +
+ +

{t('loadingStudio')}

+
+ ) : filteredPrompts.length === 0 ? (
diff --git a/src/components/ui/loading-ring.tsx b/src/components/ui/loading-ring.tsx new file mode 100644 index 0000000..d6d073d --- /dev/null +++ b/src/components/ui/loading-ring.tsx @@ -0,0 +1,34 @@ +'use client' + +import { cn } from '@/lib/utils' + +interface LoadingRingProps { + size?: 'sm' | 'md' | 'lg' + className?: string +} + +export function LoadingRing({ size = 'md', className }: LoadingRingProps) { + const sizeClasses = { + sm: 'w-6 h-6', + md: 'w-8 h-8', + lg: 'w-12 h-12' + } + + return ( +
+
+
+
+
+ ) +} \ No newline at end of file