From 50cb3eaf979eb5027172a92a4e941ed64aa3671e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sedat=20=C3=96ZT=C3=9CRK?= <76204082+iamsedatozturk@users.noreply.github.com> Date: Mon, 13 Jul 2026 15:28:23 +0300 Subject: [PATCH] =?UTF-8?q?Forum=20g=C3=BCncellemeleri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Forum/ForumDtos.cs | 8 +++ .../Forum/ForumAppService.cs | 53 ++++++++++++++++-- .../Entities/Host/ForumPost.cs | 21 +++++++- .../Entities/Host/ForumTopic.cs | 21 +++++++- .../EntityFrameworkCore/PlatformDbContext.cs | 8 +++ ....cs => 20260713103339_Initial.Designer.cs} | 34 +++++++++++- ...0_Initial.cs => 20260713103339_Initial.cs} | 8 +++ .../PlatformDbContextModelSnapshot.cs | 32 +++++++++++ ui/src/App.tsx | 7 +-- ui/src/proxy/forum/forum.ts | 8 +++ ui/src/views/forum/forum/ForumPostCard.tsx | 54 ++++++++++++------- ui/src/views/forum/forum/ForumTopicCard.tsx | 54 ++++++++++++++----- ui/src/views/forum/forum/ForumView.tsx | 26 ++++++--- .../intranet/SocialWall/UserProfileCard.tsx | 29 +++++----- 14 files changed, 298 insertions(+), 65 deletions(-) rename api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/{20260711200250_Initial.Designer.cs => 20260713103339_Initial.Designer.cs} (99%) rename api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/{20260711200250_Initial.cs => 20260713103339_Initial.cs} (99%) diff --git a/api/src/Sozsoft.Platform.Application.Contracts/Forum/ForumDtos.cs b/api/src/Sozsoft.Platform.Application.Contracts/Forum/ForumDtos.cs index 15e9405..e8ccd0f 100644 --- a/api/src/Sozsoft.Platform.Application.Contracts/Forum/ForumDtos.cs +++ b/api/src/Sozsoft.Platform.Application.Contracts/Forum/ForumDtos.cs @@ -93,6 +93,10 @@ public class ForumTopicDto : FullAuditedEntityDto public Guid CategoryId { get; set; } public Guid AuthorId { get; set; } public string AuthorName { get; set; } + public string AuthorTitle { get; set; } + public string AuthorEmail { get; set; } + public string AuthorPhoneNumber { get; set; } + public string AuthorDepartment { get; set; } public int ViewCount { get; set; } public int ReplyCount { get; set; } public int LikeCount { get; set; } @@ -155,6 +159,10 @@ public class ForumPostDto : FullAuditedEntityDto public string Content { get; set; } public Guid AuthorId { get; set; } public string AuthorName { get; set; } + public string AuthorTitle { get; set; } + public string AuthorEmail { get; set; } + public string AuthorPhoneNumber { get; set; } + public string AuthorDepartment { get; set; } public int LikeCount { get; set; } public bool IsAcceptedAnswer { get; set; } diff --git a/api/src/Sozsoft.Platform.Application/Forum/ForumAppService.cs b/api/src/Sozsoft.Platform.Application/Forum/ForumAppService.cs index e06e5f7..c897e75 100644 --- a/api/src/Sozsoft.Platform.Application/Forum/ForumAppService.cs +++ b/api/src/Sozsoft.Platform.Application/Forum/ForumAppService.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.EntityFrameworkCore; +using Sozsoft.Platform.Entities; +using Sozsoft.Platform.Extensions; using Volo.Abp.Application.Dtos; using Volo.Abp.Authorization; using Volo.Abp.Domain.Entities; @@ -20,19 +22,24 @@ public class ForumAppService : PlatformAppService, IForumAppService private readonly IRepository _topicRepository; private readonly IRepository _postRepository; private readonly IIdentityUserRepository _identityUserRepository; + private readonly IRepository _departmentRepository; + private readonly IRepository _jobPositionRepository; public ForumAppService( IRepository categoryRepository, IRepository topicRepository, IRepository postRepository, - IIdentityUserRepository identityUserRepository) + IIdentityUserRepository identityUserRepository, + IRepository departmentRepository, + IRepository jobPositionRepository) { _categoryRepository = categoryRepository; _topicRepository = topicRepository; _postRepository = postRepository; _identityUserRepository = identityUserRepository; - + _departmentRepository = departmentRepository; + _jobPositionRepository = jobPositionRepository; } // Search functionality @@ -337,13 +344,32 @@ public class ForumAppService : PlatformAppService, IForumAppService [UnitOfWork] public async Task CreateTopicAsync(CreateForumTopicDto input) { + var author = await _identityUserRepository.FindAsync(CurrentUser.Id.Value) + ?? throw new EntityNotFoundException(typeof(IdentityUser), CurrentUser.Id.Value); + var jobPositionId = author.GetJobPositionId(); + var jobPosition = jobPositionId == Guid.Empty + ? null + : await _jobPositionRepository.FindAsync(jobPositionId); + var departmentId = author.GetDepartmentId(); + if (departmentId == Guid.Empty && jobPosition != null) + { + departmentId = jobPosition.DepartmentId; + } + var department = departmentId == Guid.Empty + ? null + : await _departmentRepository.FindAsync(departmentId); + var topic = new ForumTopic( GuidGenerator.Create(), input.Title, input.Content, input.CategoryId, CurrentUser.Id.Value, - CurrentUser.Name, + author.GetFullName(), + jobPosition?.Name ?? string.Empty, + author.Email ?? string.Empty, + author.PhoneNumber ?? string.Empty, + department?.Name ?? string.Empty, input.TenantId ) { @@ -438,12 +464,31 @@ public class ForumAppService : PlatformAppService, IForumAppService [UnitOfWork] public async Task CreatePostAsync(CreateForumPostDto input) { + var author = await _identityUserRepository.FindAsync(CurrentUser.Id.Value) + ?? throw new EntityNotFoundException(typeof(IdentityUser), CurrentUser.Id.Value); + var jobPositionId = author.GetJobPositionId(); + var jobPosition = jobPositionId == Guid.Empty + ? null + : await _jobPositionRepository.FindAsync(jobPositionId); + var departmentId = author.GetDepartmentId(); + if (departmentId == Guid.Empty && jobPosition != null) + { + departmentId = jobPosition.DepartmentId; + } + var department = departmentId == Guid.Empty + ? null + : await _departmentRepository.FindAsync(departmentId); + var post = new ForumPost( GuidGenerator.Create(), input.TopicId, input.Content, CurrentUser.Id.Value, - CurrentUser.Name, + author.GetFullName(), + jobPosition?.Name ?? string.Empty, + author.Email ?? string.Empty, + author.PhoneNumber ?? string.Empty, + department?.Name ?? string.Empty, input.ParentPostId, input.TenantId ); diff --git a/api/src/Sozsoft.Platform.Domain/Entities/Host/ForumPost.cs b/api/src/Sozsoft.Platform.Domain/Entities/Host/ForumPost.cs index 75ddb13..fc7d082 100644 --- a/api/src/Sozsoft.Platform.Domain/Entities/Host/ForumPost.cs +++ b/api/src/Sozsoft.Platform.Domain/Entities/Host/ForumPost.cs @@ -10,6 +10,10 @@ public class ForumPost : FullAuditedEntity public string Content { get; set; } public Guid AuthorId { get; set; } public string AuthorName { get; set; } + public string AuthorTitle { get; set; } + public string AuthorEmail { get; set; } + public string AuthorPhoneNumber { get; set; } + public string AuthorDepartment { get; set; } public int? LikeCount { get; set; } public bool? IsAcceptedAnswer { get; set; } = false; public Guid? ParentPostId { get; set; } @@ -21,12 +25,27 @@ public class ForumPost : FullAuditedEntity protected ForumPost() { } - public ForumPost(Guid id, Guid topicId, string content, Guid authorId, string authorName, Guid? parentPostId = null, Guid? tenantId = null) : base(id) + public ForumPost( + Guid id, + Guid topicId, + string content, + Guid authorId, + string authorName, + string authorTitle, + string authorEmail, + string authorPhoneNumber, + string authorDepartment, + Guid? parentPostId = null, + Guid? tenantId = null) : base(id) { TopicId = topicId; Content = content; AuthorId = authorId; AuthorName = authorName; + AuthorTitle = authorTitle; + AuthorEmail = authorEmail; + AuthorPhoneNumber = authorPhoneNumber; + AuthorDepartment = authorDepartment; ParentPostId = parentPostId; LikeCount = 0; IsAcceptedAnswer = false; diff --git a/api/src/Sozsoft.Platform.Domain/Entities/Host/ForumTopic.cs b/api/src/Sozsoft.Platform.Domain/Entities/Host/ForumTopic.cs index 976cc0f..1b1c8b4 100644 --- a/api/src/Sozsoft.Platform.Domain/Entities/Host/ForumTopic.cs +++ b/api/src/Sozsoft.Platform.Domain/Entities/Host/ForumTopic.cs @@ -12,6 +12,10 @@ public class ForumTopic : FullAuditedEntity public ForumCategory Category { get; set; } public Guid AuthorId { get; set; } public string AuthorName { get; set; } + public string AuthorTitle { get; set; } + public string AuthorEmail { get; set; } + public string AuthorPhoneNumber { get; set; } + public string AuthorDepartment { get; set; } public int ViewCount { get; set; } public int ReplyCount { get; set; } public int LikeCount { get; set; } @@ -28,13 +32,28 @@ public class ForumTopic : FullAuditedEntity protected ForumTopic() { } - public ForumTopic(Guid id, string title, string content, Guid categoryId, Guid authorId, string authorName, Guid? tenantId = null) : base(id) + public ForumTopic( + Guid id, + string title, + string content, + Guid categoryId, + Guid authorId, + string authorName, + string authorTitle, + string authorEmail, + string authorPhoneNumber, + string authorDepartment, + Guid? tenantId = null) : base(id) { Title = title; Content = content; CategoryId = categoryId; AuthorId = authorId; AuthorName = authorName; + AuthorTitle = authorTitle; + AuthorEmail = authorEmail; + AuthorPhoneNumber = authorPhoneNumber; + AuthorDepartment = authorDepartment; ViewCount = 0; ReplyCount = 0; LikeCount = 0; diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs b/api/src/Sozsoft.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs index 20b9b2c..f326c15 100644 --- a/api/src/Sozsoft.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs +++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/EntityFrameworkCore/PlatformDbContext.cs @@ -573,6 +573,10 @@ public class PlatformDbContext : b.Property(x => x.Title).IsRequired().HasMaxLength(256); b.Property(x => x.Content).IsRequired(); b.Property(x => x.AuthorName).HasMaxLength(128); + b.Property(x => x.AuthorTitle).HasMaxLength(128); + b.Property(x => x.AuthorEmail).HasMaxLength(256); + b.Property(x => x.AuthorPhoneNumber).HasMaxLength(32); + b.Property(x => x.AuthorDepartment).HasMaxLength(128); b.Property(x => x.LastPostUserName).HasMaxLength(128); b.HasMany(x => x.Posts) @@ -588,6 +592,10 @@ public class PlatformDbContext : b.Property(x => x.Content).IsRequired(); b.Property(x => x.AuthorName).HasMaxLength(128); + b.Property(x => x.AuthorTitle).HasMaxLength(128); + b.Property(x => x.AuthorEmail).HasMaxLength(256); + b.Property(x => x.AuthorPhoneNumber).HasMaxLength(32); + b.Property(x => x.AuthorDepartment).HasMaxLength(128); b.HasOne(x => x.Topic) .WithMany(x => x.Posts) diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260711200250_Initial.Designer.cs b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260713103339_Initial.Designer.cs similarity index 99% rename from api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260711200250_Initial.Designer.cs rename to api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260713103339_Initial.Designer.cs index 561e54b..d8cf562 100644 --- a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260711200250_Initial.Designer.cs +++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260713103339_Initial.Designer.cs @@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Sozsoft.Platform.Migrations { [DbContext(typeof(PlatformDbContext))] - [Migration("20260711200250_Initial")] + [Migration("20260713103339_Initial")] partial class Initial { /// @@ -6303,6 +6303,14 @@ namespace Sozsoft.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("AuthorDepartment") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AuthorEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("AuthorId") .HasColumnType("uniqueidentifier"); @@ -6310,6 +6318,14 @@ namespace Sozsoft.Platform.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("AuthorPhoneNumber") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("AuthorTitle") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("Content") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -6373,6 +6389,14 @@ namespace Sozsoft.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("AuthorDepartment") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AuthorEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("AuthorId") .HasColumnType("uniqueidentifier"); @@ -6380,6 +6404,14 @@ namespace Sozsoft.Platform.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("AuthorPhoneNumber") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("AuthorTitle") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("CategoryId") .HasColumnType("uniqueidentifier"); diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260711200250_Initial.cs b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260713103339_Initial.cs similarity index 99% rename from api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260711200250_Initial.cs rename to api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260713103339_Initial.cs index 7e24513..e81a833 100644 --- a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260711200250_Initial.cs +++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/20260713103339_Initial.cs @@ -3022,6 +3022,10 @@ namespace Sozsoft.Platform.Migrations CategoryId = table.Column(type: "uniqueidentifier", nullable: false), AuthorId = table.Column(type: "uniqueidentifier", nullable: false), AuthorName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + AuthorTitle = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + AuthorEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + AuthorPhoneNumber = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: true), + AuthorDepartment = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), ViewCount = table.Column(type: "int", nullable: false), ReplyCount = table.Column(type: "int", nullable: false), LikeCount = table.Column(type: "int", nullable: false), @@ -3392,6 +3396,10 @@ namespace Sozsoft.Platform.Migrations Content = table.Column(type: "nvarchar(max)", nullable: false), AuthorId = table.Column(type: "uniqueidentifier", nullable: false), AuthorName = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + AuthorTitle = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), + AuthorEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), + AuthorPhoneNumber = table.Column(type: "nvarchar(32)", maxLength: 32, nullable: true), + AuthorDepartment = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: true), LikeCount = table.Column(type: "int", nullable: true), IsAcceptedAnswer = table.Column(type: "bit", nullable: true), ParentPostId = table.Column(type: "uniqueidentifier", nullable: true), diff --git a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs index 6cf3ade..c01af7f 100644 --- a/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs +++ b/api/src/Sozsoft.Platform.EntityFrameworkCore/Migrations/PlatformDbContextModelSnapshot.cs @@ -6300,6 +6300,14 @@ namespace Sozsoft.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("AuthorDepartment") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AuthorEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("AuthorId") .HasColumnType("uniqueidentifier"); @@ -6307,6 +6315,14 @@ namespace Sozsoft.Platform.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("AuthorPhoneNumber") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("AuthorTitle") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("Content") .IsRequired() .HasColumnType("nvarchar(max)"); @@ -6370,6 +6386,14 @@ namespace Sozsoft.Platform.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("AuthorDepartment") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("AuthorEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + b.Property("AuthorId") .HasColumnType("uniqueidentifier"); @@ -6377,6 +6401,14 @@ namespace Sozsoft.Platform.Migrations .HasMaxLength(128) .HasColumnType("nvarchar(128)"); + b.Property("AuthorPhoneNumber") + .HasMaxLength(32) + .HasColumnType("nvarchar(32)"); + + b.Property("AuthorTitle") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + b.Property("CategoryId") .HasColumnType("uniqueidentifier"); diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 729443d..47d5538 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -6,6 +6,7 @@ import { BrowserRouter } from 'react-router-dom' import { store } from './store' import { DynamicRoutesProvider } from './routes/dynamicRoutesContext' import { ComponentProvider } from './contexts/ComponentContext' +import { registerServiceWorker } from './views/version/swRegistration' import { useEffect } from 'react' import DevExtremeBoundary from './components/devExtreme/DevExtremeBoundary' @@ -20,11 +21,7 @@ const queryClient = new QueryClient({ function App() { useEffect(() => { - void import('./views/version/swRegistration') - .then(({ registerServiceWorker }) => registerServiceWorker()) - .catch((error: unknown) => { - console.warn('Service worker could not be registered.', error) - }) + registerServiceWorker() }, []) return ( diff --git a/ui/src/proxy/forum/forum.ts b/ui/src/proxy/forum/forum.ts index 8da0b8d..56d5f43 100644 --- a/ui/src/proxy/forum/forum.ts +++ b/ui/src/proxy/forum/forum.ts @@ -23,6 +23,10 @@ export interface ForumTopic { categoryId: string authorId: string authorName: string + authorTitle?: string + authorEmail?: string + authorPhoneNumber?: string + authorDepartment?: string viewCount: number replyCount: number likeCount: number @@ -43,6 +47,10 @@ export interface ForumPost { content: string authorId: string authorName: string + authorTitle?: string + authorEmail?: string + authorPhoneNumber?: string + authorDepartment?: string likeCount: number isAcceptedAnswer: boolean parentPostId?: string diff --git a/ui/src/views/forum/forum/ForumPostCard.tsx b/ui/src/views/forum/forum/ForumPostCard.tsx index 0a9b068..da1f333 100644 --- a/ui/src/views/forum/forum/ForumPostCard.tsx +++ b/ui/src/views/forum/forum/ForumPostCard.tsx @@ -1,8 +1,11 @@ +import { useState } from 'react' +import { AnimatePresence } from 'framer-motion' import { FaHeart, FaCheckCircle, FaReply } from 'react-icons/fa' import { ForumPost } from '@/proxy/forum/forum' import { AVATAR_URL } from '@/constants/app.constant' import { useLocalization } from '@/utils/hooks/useLocalization' -import { Button } from '@/components/ui' +import { Avatar, Button } from '@/components/ui' +import UserProfileCard from '@/views/intranet/SocialWall/UserProfileCard' import { formatForumDate } from './utils' interface PostCardProps { @@ -21,28 +24,43 @@ export function ForumPostCard({ isLiked = false, }: PostCardProps) { const { translate } = useLocalization() + const [showUserCard, setShowUserCard] = useState(false) return (
-
- { - e.currentTarget.onerror = null - e.currentTarget.src = '/img/others/default-profile.png' - }} - alt="User" - className="w-10 h-10 rounded-full" - /> +
setShowUserCard(true)} + onMouseLeave={() => setShowUserCard(false)} + > + + + {showUserCard && ( + + )} +
-

{post.authorName}

+

+ {post.authorName} +

{post.isAcceptedAnswer && (
@@ -67,14 +85,12 @@ export function ForumPostCard({ type="button" variant="plain" shape="none" + className="!inline-flex !h-auto items-center gap-1 !rounded-none !border-0 !bg-transparent !px-0 py-1 text-sm text-gray-600 transition-colors hover:!bg-transparent active:!bg-transparent focus:!bg-transparent dark:text-gray-300" onClick={() => onLike(post.id, isFirst)} - className={`!inline-flex !h-auto items-center gap-1 rounded-full !px-3 py-1 text-sm transition-colors ${ - isLiked - ? '!bg-red-100 text-red-600 hover:!bg-red-200 dark:!bg-red-900 dark:text-red-200 dark:hover:!bg-red-800' - : '!bg-gray-100 text-gray-600 hover:!bg-gray-200 dark:!bg-gray-800 dark:text-gray-300 dark:hover:!bg-gray-700' - }`} > - + {post.likeCount} @@ -83,8 +99,8 @@ export function ForumPostCard({ type="button" variant="plain" shape="none" - onClick={() => onReply(post.id)} className="!inline-flex !h-auto items-center gap-1 rounded-full !bg-gray-100 !px-3 py-1 text-sm text-gray-600 transition-colors hover:!bg-gray-200 dark:!bg-gray-800 dark:text-gray-300 dark:hover:!bg-gray-700" + onClick={() => onReply(post.id)} > {translate('::App.Forum.PostManagement.PostReply')} diff --git a/ui/src/views/forum/forum/ForumTopicCard.tsx b/ui/src/views/forum/forum/ForumTopicCard.tsx index eeec9c3..fb66f48 100644 --- a/ui/src/views/forum/forum/ForumTopicCard.tsx +++ b/ui/src/views/forum/forum/ForumTopicCard.tsx @@ -1,7 +1,11 @@ +import { useState } from 'react' +import { AnimatePresence } from 'framer-motion' import { FaComment, FaHeart, FaEye, FaThumbtack, FaLock, FaCheckCircle } from 'react-icons/fa' import { ForumTopic } from '@/proxy/forum/forum' import { AVATAR_URL } from '@/constants/app.constant' import { useLocalization } from '@/utils/hooks/useLocalization' +import { Avatar } from '@/components/ui' +import UserProfileCard from '@/views/intranet/SocialWall/UserProfileCard' import { formatForumRelativeDate } from './utils' interface TopicCardProps { @@ -11,11 +15,12 @@ interface TopicCardProps { export function ForumTopicCard({ topic, onClick }: TopicCardProps) { const { translate } = useLocalization() + const [showUserCard, setShowUserCard] = useState(false) return (
{/* Sol taraf: Başlık, içerik, istatistik */} @@ -29,7 +34,9 @@ export function ForumTopicCard({ topic, onClick }: TopicCardProps) {
-

{topic.content}

+

+ {topic.content} +

@@ -49,16 +56,34 @@ export function ForumTopicCard({ topic, onClick }: TopicCardProps) { {/* Sağ taraf: Avatar + Yazar bilgisi */}
- { - e.currentTarget.onerror = null - e.currentTarget.src = '/img/others/default-profile.png' - }} - alt="User" - className="w-10 h-10 rounded-full border" - /> -
{topic.authorName}
+
event.stopPropagation()} + onMouseEnter={() => setShowUserCard(true)} + onMouseLeave={() => setShowUserCard(false)} + > + + + {showUserCard && ( + + )} + +
+
+ {topic.authorName} +
{formatForumRelativeDate(topic.creationTime)}
@@ -70,8 +95,9 @@ export function ForumTopicCard({ topic, onClick }: TopicCardProps) {
{translate('::App.Forum.TopicManagement.Lastreplyby')}{' '} - {topic.lastPostUserName} - {' '} + + {topic.lastPostUserName} + {' '} {formatForumRelativeDate(topic.lastPostDate)}
diff --git a/ui/src/views/forum/forum/ForumView.tsx b/ui/src/views/forum/forum/ForumView.tsx index 7243dc2..c839586 100644 --- a/ui/src/views/forum/forum/ForumView.tsx +++ b/ui/src/views/forum/forum/ForumView.tsx @@ -224,9 +224,11 @@ export function ForumView({ onReply={handleReply} isLiked={likedPosts.has(post.id)} /> - {post.children.length > 0 && ( -
{renderPosts(post.children)}
- )} + {post.children.length > 0 && ( +
+ {renderPosts(post.children)} +
+ )}
)) } @@ -277,7 +279,7 @@ export function ForumView({
- Loading forum data... + Loading forum data...
) @@ -289,7 +291,9 @@ export function ForumView({
{/* Left Side: Breadcrumb */}
- {viewState !== 'categories' && } + {viewState !== 'categories' && ( + + )} @@ -437,6 +443,10 @@ export function ForumView({ content: selectedTopic.content, authorId: selectedTopic.authorId, authorName: selectedTopic.authorName, + authorTitle: selectedTopic.authorTitle, + authorEmail: selectedTopic.authorEmail, + authorPhoneNumber: selectedTopic.authorPhoneNumber, + authorDepartment: selectedTopic.authorDepartment, likeCount: postLikeCounts[selectedTopic.id] ?? selectedTopic.likeCount, isAcceptedAnswer: false, parentPostId: undefined, diff --git a/ui/src/views/intranet/SocialWall/UserProfileCard.tsx b/ui/src/views/intranet/SocialWall/UserProfileCard.tsx index b9d60c3..9bfe74f 100644 --- a/ui/src/views/intranet/SocialWall/UserProfileCard.tsx +++ b/ui/src/views/intranet/SocialWall/UserProfileCard.tsx @@ -1,6 +1,6 @@ import React from 'react' import { motion } from 'framer-motion' -import { FaEnvelope, FaPhone, FaBriefcase, FaMapMarkerAlt } from 'react-icons/fa' +import { FaEnvelope, FaPhone, FaBriefcase } from 'react-icons/fa' import { AVATAR_URL } from '@/constants/app.constant' import { Avatar } from '@/components/ui' @@ -15,16 +15,21 @@ interface UserProfileCardProps { tenantId: string } position?: 'top' | 'bottom' + align?: 'left' | 'right' } -const UserProfileCard: React.FC = ({ user, position = 'bottom' }) => { +const UserProfileCard: React.FC = ({ + user, + position = 'bottom', + align = 'left', +}) => { return ( @@ -33,13 +38,13 @@ const UserProfileCard: React.FC = ({ user, position = 'bot
-

- {user.name} -

-

- - {user.title} -

+

{user.name}

+ {user.title && ( +

+ + {user.title} +

+ )}
@@ -56,7 +61,7 @@ const UserProfileCard: React.FC = ({ user, position = 'bot
)} - + {user.phoneNumber && (
@@ -79,7 +84,7 @@ const UserProfileCard: React.FC = ({ user, position = 'bot {/* Arrow indicator */}