Forum düzenlemesi

This commit is contained in:
Sedat Öztürk 2026-05-13 23:03:10 +03:00
parent 3f44b23f57
commit b6e4eee402
7 changed files with 88 additions and 128 deletions

View file

@ -1692,12 +1692,6 @@
"en": "Loading execution details...",
"tr": "Çalıştırma detayları yükleniyor..."
},
{
"resourceName": "Platform",
"key": "App.Listforms.ImportManager.Executed",
"en": "executed",
"tr": "çalıştırıldı"
},
{
"resourceName": "Platform",
"key": "App.Listforms.ImportManager.Valid",

View file

@ -102,21 +102,21 @@ export function AdminView({
]
return (
<div className="flex flex-col lg:flex-row gap-8">
<div className="flex flex-col lg:flex-row gap-4 mt-3">
{/* Sidebar Navigation */}
<div className="lg:w-64 flex-shrink-0 p-4 bg-gray-50">
<nav className="space-y-2">
{navigationItems.map((item) => {
const Icon = item.icon
const isActive = activeSection === item.id
return (
<Button
key={item.id}
variant={isActive ? 'twoTone' : 'plain'}
color="blue-500"
active={isActive}
onClick={() => setActiveSection(item.id)}
className={`w-full flex items-center space-x-3 px-4 py-3 rounded-lg text-left transition-colors ${
activeSection === item.id
? 'bg-blue-100 text-blue-700'
: 'text-gray-600 hover:bg-gray-100 hover:text-gray-900'
}`}
className="w-full flex items-center space-x-3 px-4 py-3 text-left transition-colors"
>
<Icon className="w-5 h-5" />
<span className="font-medium">{item.label}</span>

View file

@ -160,22 +160,7 @@ export function CategoryManagement({
}
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<h2 className="text-2xl font-bold text-gray-900">
{translate('::App.Forum.CategoryManagement.Title')}
</h2>
<Button
variant="solid"
onClick={() => setShowCreateForm(true)}
disabled={loading}
className="flex items-center space-x-2 bg-blue-600 px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50"
>
<FaPlus className="w-4 h-4" />
<span>{translate('::App.Forum.CategoryManagement.AddCategory')}</span>
</Button>
</div>
<div className="space-y-3">
{/* Create/Edit Form */}
{showCreateForm && (
<div className="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
@ -322,10 +307,20 @@ export function CategoryManagement({
{/* Categories List */}
<div className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
<div className="px-6 py-4 border-b border-gray-200">
<div className="flex items-center justify-between px-3 py-4 border-b border-gray-200">
<h3 className="text-lg font-semibold text-gray-900">
{translate('::App.Forum.CategoryManagement.Categories')} ({categories.length})
</h3>
<Button
size="sm"
variant="solid"
onClick={() => setShowCreateForm(true)}
disabled={loading}
className="flex items-center space-x-2 bg-blue-600 px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50"
>
<FaPlus className="w-4 h-4" />
<span>{translate('::App.Forum.CategoryManagement.AddCategory')}</span>
</Button>
</div>
{loading ? (
@ -369,7 +364,7 @@ export function CategoryManagement({
<div className="flex items-center space-x-2">
<Button
size='xs'
size="xs"
onClick={() => handleToggleActive(category)}
className={`p-1 rounded-lg transition-colors ${
category.isActive
@ -386,7 +381,7 @@ export function CategoryManagement({
</Button>
<Button
size='xs'
size="xs"
onClick={() => handleToggleLocked(category)}
className={`p-1 rounded-lg transition-colors ${
category.isLocked
@ -403,7 +398,7 @@ export function CategoryManagement({
</Button>
<Button
size='xs'
size="xs"
onClick={() => handleEdit(category)}
className="p-1 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors"
title={translate('::App.Forum.CategoryManagement.EditCategory')}
@ -412,7 +407,7 @@ export function CategoryManagement({
</Button>
<Button
size='xs'
size="xs"
onClick={() => confirmDeleteCategory(category)}
className="p-1 text-red-600 hover:bg-red-100 rounded-lg transition-colors"
title={translate('::App.Forum.CategoryManagement.DeleteCategory')}

View file

@ -1,4 +1,4 @@
import { FaFolder, FaCommentDots, FaFileAlt, FaChartLine } from 'react-icons/fa'
import Widget from '@/components/ui/Widget/Widget'
import { ForumCategory, ForumPost, ForumTopic } from '@/proxy/forum/forum'
import { useLocalization } from '@/utils/hooks/useLocalization'
import dayjs from 'dayjs'
@ -30,30 +30,30 @@ export function AdminStats({ categories, topics, posts }: AdminStatsProps) {
{
title: translate('::App.Forum.Dashboard.TotalCategories'),
value: totalCategories,
subtitle: `${activeCategories} active`,
icon: FaFolder,
color: 'bg-blue-500',
subTitle: `${activeCategories} active`,
icon: 'FaFolder' as const,
color: 'blue' as const,
},
{
title: translate('::App.Forum.Dashboard.TotalTopics'),
value: totalTopics,
subtitle: `${solvedTopics} solved`,
icon: FaCommentDots,
color: 'bg-emerald-500',
subTitle: `${solvedTopics} solved`,
icon: 'FaCommentDots' as const,
color: 'green' as const,
},
{
title: translate('::App.Forum.Dashboard.TotalPosts'),
value: totalPosts,
subtitle: `${acceptedAnswers} accepted answers`,
icon: FaFileAlt,
color: 'bg-orange-500',
subTitle: `${acceptedAnswers} accepted answers`,
icon: 'FaFileAlt' as const,
color: 'orange' as const,
},
{
title: translate('::App.Forum.Dashboard.EngagementRate'),
value: totalTopics > 0 ? Math.round((totalPosts / totalTopics) * 100) / 100 : 0,
subtitle: 'posts per topic',
icon: FaChartLine,
color: 'bg-purple-500',
subTitle: 'posts per topic',
icon: 'FaChartLine' as const,
color: 'purple' as const,
},
]
@ -101,33 +101,18 @@ export function AdminStats({ categories, topics, posts }: AdminStatsProps) {
.slice(0, 3)
return (
<div className="space-y-8">
<div>
<h2 className="text-2xl font-bold text-gray-900 mb-6">
{translate('::App.Forum.Dashboard.Statistics')}
</h2>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
{stats.map((stat, index) => {
const Icon = stat.icon
return (
<div key={index} className="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
<div className="flex items-center justify-between mb-4">
<div
className={`w-12 h-12 ${stat.color} rounded-lg flex items-center justify-center`}
>
<Icon className="w-6 h-6 text-white" />
</div>
</div>
<div>
<h3 className="text-2xl font-bold text-gray-900 mb-1">{stat.value}</h3>
<p className="text-sm font-medium text-gray-600 mb-1">{stat.title}</p>
<p className="text-xs text-gray-500">{stat.subtitle}</p>
</div>
</div>
)
})}
</div>
<div className="space-y-4">
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
{stats.map((stat, index) => (
<Widget
key={index}
title={stat.title}
value={stat.value}
subTitle={stat.subTitle}
icon={stat.icon}
color={stat.color}
/>
))}
</div>
{/* Recent Activity */}

View file

@ -159,22 +159,7 @@ export function PostManagement({
})
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<h2 className="text-2xl font-bold text-gray-900">
{translate('::App.Forum.PostManagement.Title')}
</h2>
<Button
variant="solid"
onClick={() => setShowCreateForm(true)}
disabled={loading}
className="flex items-center space-x-2 bg-blue-600 px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50"
>
<FaPlus className="w-4 h-4" />
<span>{translate('::App.Forum.PostManagement.AddPost')}</span>
</Button>
</div>
<div className="space-y-3">
{/* Create/Edit Form */}
{showCreateForm && (
<div className="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
@ -346,8 +331,18 @@ export function PostManagement({
{/* Posts List */}
<div className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
<div className="px-6 py-4 border-b border-gray-200">
<div className="flex items-center justify-between px-3 py-4 border-b border-gray-200">
<h3 className="text-lg font-semibold text-gray-900">Posts ({posts.length})</h3>
<Button
size="sm"
variant="solid"
onClick={() => setShowCreateForm(true)}
disabled={loading}
className="flex items-center space-x-2 bg-blue-600 px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50"
>
<FaPlus className="w-4 h-4" />
<span>{translate('::App.Forum.PostManagement.AddPost')}</span>
</Button>
</div>
{loading ? (
@ -399,7 +394,7 @@ export function PostManagement({
<div className="flex items-center space-x-2 ml-4">
<Button
size='xs'
size="xs"
onClick={() => handleToggleAcceptedAnswer(post)}
className={`p-1 rounded-lg transition-colors ${
post.isAcceptedAnswer
@ -420,7 +415,7 @@ export function PostManagement({
</Button>
<Button
size='xs'
size="xs"
onClick={() => handleEdit(post)}
className="p-1 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors"
title={translate('::App.Forum.PostManagement.EditPost')}
@ -429,7 +424,7 @@ export function PostManagement({
</Button>
<Button
size='xs'
size="xs"
onClick={() => confirmDeletePost(post)}
className="p-1 text-red-600 hover:bg-red-100 rounded-lg transition-colors"
title={translate('::App.Forum.PostManagement.DeletePost')}

View file

@ -201,22 +201,7 @@ export function TopicManagement({
})
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<h2 className="text-2xl font-bold text-gray-900">
{translate('::App.Forum.TopicManagement.Title')}
</h2>
<Button
variant="solid"
onClick={() => setShowCreateForm(true)}
disabled={loading}
className="flex items-center space-x-2 bg-blue-600 px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50"
>
<FaPlus className="w-4 h-4" />
<span>{translate('::App.Forum.TopicManagement.AddTopic')}</span>
</Button>
</div>
<div className="space-y-3">
{/* Create/Edit Form */}
{showCreateForm && (
<div className="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
@ -347,10 +332,20 @@ export function TopicManagement({
{/* Topics List */}
<div className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
<div className="px-6 py-4 border-b border-gray-200">
<div className="flex items-center justify-between px-3 py-4 border-b border-gray-200">
<h3 className="text-lg font-semibold text-gray-900">
{translate('::App.Forum.Dashboard.Topics')} ({topics.length})
</h3>
<Button
size="sm"
variant="solid"
onClick={() => setShowCreateForm(true)}
disabled={loading}
className="flex items-center space-x-2 bg-blue-600 px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50"
>
<FaPlus className="w-4 h-4" />
<span>{translate('::App.Forum.TopicManagement.AddTopic')}</span>
</Button>
</div>
{loading ? (
@ -400,7 +395,7 @@ export function TopicManagement({
<div className="flex items-center space-x-2 ml-4">
<Button
size='xs'
size="xs"
onClick={() => handlePin(topic)}
className={`p-1 rounded-lg transition-colors ${
topic.isPinned
@ -417,7 +412,7 @@ export function TopicManagement({
</Button>
<Button
size='xs'
size="xs"
onClick={() => handleLock(topic)}
className={`p-1 rounded-lg transition-colors ${
topic.isLocked
@ -434,7 +429,7 @@ export function TopicManagement({
</Button>
<Button
size='xs'
size="xs"
onClick={() => handleSolved(topic)}
className={`p-1 rounded-lg transition-colors ${
topic.isSolved
@ -451,7 +446,7 @@ export function TopicManagement({
</Button>
<Button
size='xs'
size="xs"
onClick={() => handleEdit(topic)}
className="p-1 text-blue-600 hover:bg-blue-100 rounded-lg transition-colors"
title={translate('::App.Forum.TopicManagement.EditTopic')}
@ -460,7 +455,7 @@ export function TopicManagement({
</Button>
<Button
size='xs'
size="xs"
onClick={() => confirmDeleteTopic(topic)}
className="p-1 text-red-600 hover:bg-red-100 rounded-lg transition-colors"
title={translate('::App.Forum.TopicManagement.DeleteTopic')}

View file

@ -306,15 +306,7 @@ export function ForumView({
<div className="flex items-center justify-between mb-4">
{/* Left Side: Breadcrumb */}
<div className="flex items-center space-x-2">
{viewState !== 'categories' && (
<button
onClick={handleBack}
className="flex items-center space-x-1 text-blue-600 hover:text-blue-700 transition-colors"
>
<FaArrowLeft className="w-4 h-4" />
<span>Back</span>
</button>
)}
{viewState !== 'categories' && <FaArrowLeft className="w-4 h-4" />}
<nav className="flex items-center space-x-2 text-sm text-gray-500">
{selectedCategory && (
<>
@ -354,6 +346,7 @@ export function ForumView({
<div className="flex items-center space-x-2 ml-auto">
{viewState === 'topics' && selectedCategory && !selectedCategory.isLocked && (
<Button
size="sm"
icon={<FaPlus className="w-4 h-4" />}
variant="solid"
onClick={() => setShowCreateTopic(true)}
@ -364,6 +357,7 @@ export function ForumView({
)}
{viewState === 'posts' && selectedTopic && !selectedTopic.isLocked && (
<Button
size="sm"
icon={<FaPlus className="w-4 h-4" />}
variant="solid"
onClick={() => setShowCreatePost(true)}
@ -375,6 +369,7 @@ export function ForumView({
{/* Search */}
<Button
size="sm"
icon={<FaSearch className="w-4 h-4" />}
onClick={() => setIsSearchModalOpen(true)}
variant="default"
@ -386,6 +381,7 @@ export function ForumView({
</Button>
<Button
size="sm"
icon={<FaSearch className="w-5 h-5" />}
onClick={() => setIsSearchModalOpen(true)}
variant="default"
@ -396,7 +392,7 @@ export function ForumView({
{/* Categories View */}
{viewState === 'categories' && (
<div className="space-y-6">
<div className="space-y-3">
<div>
<div className="space-y-4">
{categories
@ -416,7 +412,7 @@ export function ForumView({
{/* Topics View */}
{viewState === 'topics' && selectedCategory && (
<div className="space-y-6">
<div className="space-y-3">
<div>
<h2 className="text-2xl font-bold text-gray-900 mb-6">{selectedCategory.name}</h2>
<div className="space-y-4">
@ -440,7 +436,7 @@ export function ForumView({
{/* Posts View */}
{viewState === 'posts' && selectedTopic && (
<div className="space-y-6">
<div className="space-y-3">
<div>
<h2 className="text-2xl font-bold text-gray-900 mb-6">{selectedTopic.title}</h2>