...
This commit is contained in:
@@ -4,6 +4,7 @@ using Hushian.Application.Contracts.Persistence;
|
||||
using Hushian.Application.Models;
|
||||
using Hushian.Domain.Entites;
|
||||
using Hushian.WebApi;
|
||||
using Microsoft.AspNetCore.Routing.Constraints;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
@@ -77,7 +78,7 @@ namespace Hushian.Application.Services
|
||||
.Where(w => w.CompanyID == CompanyID && w.Status == status)
|
||||
.Select(s => new ChatItemDto()
|
||||
{
|
||||
ID = s.ID,
|
||||
ID = s.ID,
|
||||
ExperID = s.ConversationResponses.OrderBy(o => o.ID).Last(l => l.ExperID.HasValue).ExperID,
|
||||
ExperFullName = s.ConversationResponses.OrderBy(o => o.ID).Last(l => l.ExperID.HasValue).Exper.FullName,
|
||||
GroupID = s.GroupID,
|
||||
@@ -117,7 +118,7 @@ namespace Hushian.Application.Services
|
||||
.Include(inc => inc.Group)
|
||||
.Include(inc => inc.ConversationResponses).ThenInclude(tinc => tinc.Exper)
|
||||
.Where(w => w.Status == ConversationStatus.Recorded && w.CompanyID == CompanyID);
|
||||
if (groupallow != null) request = request.Where(w=>!w.GroupID.HasValue || groupallow.Contains(w.GroupID.Value));
|
||||
if (groupallow != null) request = request.Where(w => !w.GroupID.HasValue || groupallow.Contains(w.GroupID.Value));
|
||||
return await request.Select(s => new ChatItemDto()
|
||||
{
|
||||
ID = s.ID,
|
||||
@@ -237,7 +238,7 @@ namespace Hushian.Application.Services
|
||||
var convModel = await _ConversationRepository.Get()
|
||||
.Include(inc => inc.ConversationResponses)
|
||||
.FirstOrDefaultAsync(w => w.ID == dto.ConversationID);
|
||||
|
||||
|
||||
if (convModel != null)
|
||||
{
|
||||
if (ExperID.HasValue && !await _experService.CheckExperInCompany(convModel.CompanyID, ExperID.Value))
|
||||
@@ -277,7 +278,24 @@ namespace Hushian.Application.Services
|
||||
await _ConversationRepository.UPDATE(convModel);
|
||||
}
|
||||
if (dto.Type != ConversationType.UE)
|
||||
await WriteInHubFromCompany(Response.Value, convModel.UserID);
|
||||
await WriteInHubFromCompany(Response.Value, convModel.UserID);
|
||||
else
|
||||
{
|
||||
var modelA = convModel.ConversationResponses.OrderBy(o => o.ID)
|
||||
.LastOrDefault(l => l.Type == ConversationType.EU || l.Type == ConversationType.CU);
|
||||
if (modelA != null)
|
||||
{
|
||||
int userid = 0;
|
||||
|
||||
if (modelA.Type == ConversationType.EU) userid = modelA.ExperID.Value;
|
||||
|
||||
else if (modelA.Type == ConversationType.CU) userid = modelA.conversation.CompanyID;
|
||||
|
||||
await WriteInHubFromUser(Response.Value, userid);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else Response.Errors.Add("گفتگویی یافت نشد");
|
||||
@@ -360,8 +378,23 @@ namespace Hushian.Application.Services
|
||||
{
|
||||
item.IsRead = true;
|
||||
item.ReadDateTime = DateTime.Now;
|
||||
if (!item.ExperID.HasValue)
|
||||
item.ExperID = ExperID;
|
||||
return (await _ConversationResponseRepository.UPDATE(item)) != null;
|
||||
|
||||
|
||||
if( (await _ConversationResponseRepository.UPDATE(item)) != null)
|
||||
{
|
||||
int userID = 0;
|
||||
if (item.Type == ConversationType.EU) userID = item.ExperID.Value;
|
||||
|
||||
else if (item.Type == ConversationType.CU) userID = item.conversation.CompanyID;
|
||||
|
||||
else if (item.Type == ConversationType.UE) userID = item.conversation.UserID;
|
||||
|
||||
await CheckMarkAsReadInHub(item.ID, userID);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +413,7 @@ namespace Hushian.Application.Services
|
||||
.Select(s => new ChatItemDto()
|
||||
{
|
||||
ID = s.ID,
|
||||
ExperID = s.ConversationResponses.OrderBy(o => o.ID).Last(l=>l.ExperID.HasValue).ExperID,
|
||||
ExperID = s.ConversationResponses.OrderBy(o => o.ID).Last(l => l.ExperID.HasValue).ExperID,
|
||||
ExperFullName = s.ConversationResponses.OrderBy(o => o.ID).Last(l => l.ExperID.HasValue).Exper.FullName,
|
||||
GroupID = s.GroupID,
|
||||
GroupName = s.Group.Name,
|
||||
@@ -451,7 +484,7 @@ namespace Hushian.Application.Services
|
||||
if (Response.Value != null) Response.Success = true;
|
||||
return Response;
|
||||
}
|
||||
public async Task WriteInHubFromCompany(ChatItemResponseDto item,int UserID)
|
||||
public async Task WriteInHubFromCompany(ChatItemResponseDto item, int UserID)
|
||||
{
|
||||
await _hubContext.Clients.User(UserID.ToString())
|
||||
.SendAsync("ReceiveNewChatItemFromCompany", item);
|
||||
@@ -465,19 +498,16 @@ namespace Hushian.Application.Services
|
||||
// // .SendAsync("ReceiveNewConversation", conv.Id, conv.Title);
|
||||
//}
|
||||
}
|
||||
public async Task WriteInHubFromUser(ChatItemResponseDto item)
|
||||
public async Task WriteInHubFromUser(ChatItemResponseDto item, int UserID)
|
||||
{
|
||||
await _hubContext.Clients.User(UserID.ToString())
|
||||
.SendAsync("ReceiveNewChatItemFromCompany", item);
|
||||
|
||||
//// فرض: لیستی از کاربرانی که به گفتگو دسترسی دارند
|
||||
//var usernames = new List<string>();
|
||||
|
||||
//foreach (var usn in usernames)
|
||||
//{
|
||||
// //await _hubContext.Clients.User(usn)
|
||||
// // .SendAsync("ReceiveNewConversation", conv.Id, conv.Title);
|
||||
//}
|
||||
.SendAsync("ReceiveNewChatItemFromUser", item);
|
||||
}
|
||||
public async Task CheckMarkAsReadInHub(int item, int UserID)
|
||||
{
|
||||
await _hubContext.Clients.User(UserID.ToString())
|
||||
.SendAsync("CheckMarkAsRead", item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -206,12 +206,12 @@ namespace Hushian.WebApi.Controllers.v1
|
||||
[Authorize(Roles = "Company,User,Exper")]
|
||||
public async Task<ActionResult> MarkAsReadChatItem(int ConversationItemID)
|
||||
{
|
||||
int? ExperID = null;
|
||||
int? ID = null;
|
||||
ConversationType Type = ConversationType.UE;
|
||||
if (User.IsInRole("Exper"))
|
||||
{
|
||||
string strExperID = User.Claims.Where(w => w.Type == CustomClaimTypes.Uid).Select(s => s.Value).First();
|
||||
ExperID = Convert.ToInt32(strExperID);
|
||||
ID = Convert.ToInt32(strExperID);
|
||||
Type = ConversationType.EU;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace Hushian.WebApi.Controllers.v1
|
||||
}
|
||||
else return Unauthorized();
|
||||
|
||||
return await _chatService.MarkAsReadChatItem(ConversationItemID, Type, ExperID) ? NoContent()
|
||||
return await _chatService.MarkAsReadChatItem(ConversationItemID, Type, ID) ? NoContent()
|
||||
: BadRequest(new List<string>() { "خطا در بروزرسانی گفتگو" });
|
||||
|
||||
}
|
||||
|
@@ -5,11 +5,15 @@
|
||||
@using Common.Enums
|
||||
@using HushianWebApp.Components
|
||||
@using HushianWebApp.Service
|
||||
@using HushianWebApp.Services
|
||||
@using Microsoft.AspNetCore.SignalR.Client
|
||||
@inject ChatService chatService
|
||||
@inject GroupService groupService
|
||||
@inject UserService userService
|
||||
@inject IJSRuntime JS
|
||||
@inject ToastService toastService
|
||||
@inject ILocalStorageService localStorageService;
|
||||
@inject HttpClient _Http;
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
<Modal @ref="modal" IsVerticallyCentered="true" IsScrollable="true" />
|
||||
<PageTitle>گفتمان</PageTitle>
|
||||
@@ -29,7 +33,7 @@
|
||||
<div class="sidebar-tabs" id="A2">
|
||||
<!-- Inbox1 -->
|
||||
<Button Outline="@isSelectedInbox1" Type="ButtonType.Link" @onclick="async()=>{await OnclickInbox(1);}" Size=ButtonSize.Small Color="ButtonColor.Warning"
|
||||
class=@($"tab-button inbox1-button {(isSelectedInbox1 ? "active-tab inbox1-active" : "")}")>
|
||||
class=@($"tab-button inbox1-button {(isSelectedInbox1 ? "active-tab inbox1-active" : "")}")>
|
||||
<Icon Name="IconName.Inbox" Class="tab-icon" />
|
||||
<span class="tab-text">پیام های آمده</span>
|
||||
<Badge Color="BadgeColor.Warning" Class="tab-badge">@Inbox1Items.Count()</Badge>
|
||||
@@ -37,7 +41,7 @@
|
||||
|
||||
<!-- Inbox2 -->
|
||||
<Button Outline="@isSelectedInbox2" Type="ButtonType.Link" @onclick="async()=>{await OnclickInbox(2);}" Size=ButtonSize.Small Color="ButtonColor.Primary"
|
||||
class=@($"tab-button inbox2-button {(isSelectedInbox2 ? "active-tab inbox2-active" : "")}")>
|
||||
class=@($"tab-button inbox2-button {(isSelectedInbox2 ? "active-tab inbox2-active" : "")}")>
|
||||
<Icon Name="IconName.Send" Class="tab-icon" />
|
||||
<span class="tab-text">پیام های من</span>
|
||||
<Badge Color="BadgeColor.Warning" Class="tab-badge">@Inbox2Items.Count()</Badge>
|
||||
@@ -45,7 +49,7 @@
|
||||
|
||||
<!-- Inbox3 -->
|
||||
<Button Outline="@isSelectedInbox3" Type="ButtonType.Link" @onclick="async()=>{await OnclickInbox(3);}" Size=ButtonSize.Small Color="ButtonColor.Danger"
|
||||
class=@($"tab-button inbox3-button {(isSelectedInbox3 ? "active-tab inbox3-active" : "")}")>
|
||||
class=@($"tab-button inbox3-button {(isSelectedInbox3 ? "active-tab inbox3-active" : "")}")>
|
||||
<Icon Name="IconName.Archive" Class="tab-icon" />
|
||||
<span class="tab-text">پیام های بسته</span>
|
||||
</Button>
|
||||
@@ -63,7 +67,8 @@
|
||||
<div class="item-content">
|
||||
<div class="item-header">
|
||||
<strong class="item-name">@item.UserFullName </strong>
|
||||
@if(!string.IsNullOrEmpty(item.GroupName)){
|
||||
@if (!string.IsNullOrEmpty(item.GroupName))
|
||||
{
|
||||
<div class="mb-3">
|
||||
<Badge Color="BadgeColor.Info" VisuallyHiddenText="Visually hidden text for Info">@item.GroupName</Badge>
|
||||
</div>
|
||||
@@ -156,20 +161,19 @@
|
||||
@if (ChatCurrent.status == Common.Enums.ConversationStatus.InProgress)
|
||||
{
|
||||
<Button Color="ButtonColor.Danger" Size=ButtonSize.ExtraSmall Outline="true" Class="finish-conversation-btn"
|
||||
@onclick="CloseChat">
|
||||
@onclick="CloseChat">
|
||||
<Icon Name="IconName.Escape" /> اتمام گفتگو
|
||||
</Button>
|
||||
|
||||
<Button Color="ButtonColor.Secondary" Size=ButtonSize.ExtraSmall Outline="true" Class="toexper-btn" @onclick="onclickAttachedto">
|
||||
<Icon Name="IconName.EnvelopeArrowUp"
|
||||
/> پیوست به...
|
||||
<Icon Name="IconName.EnvelopeArrowUp" /> پیوست به...
|
||||
</Button>
|
||||
}
|
||||
else if (ChatCurrent.status == Common.Enums.ConversationStatus.Finished
|
||||
&& (CurrentUser.Role == "Company" || ChatCurrent.ExperID == CurrentUser.ExperID))
|
||||
{
|
||||
<Button Color="ButtonColor.Success" Size=ButtonSize.ExtraSmall Outline="true" Class="open-conversation-btn"
|
||||
@onclick="OpenChat">
|
||||
@onclick="OpenChat">
|
||||
|
||||
<Icon Name="IconName.Escape" /> باز کردن گفتگو
|
||||
</Button>
|
||||
@@ -270,23 +274,24 @@
|
||||
|
||||
|
||||
@code {
|
||||
public Common.Dtos.CurrentUserInfo CurrentUser { get; set; }
|
||||
Common.Dtos.CurrentUserInfo CurrentUser { get; set; }
|
||||
List<Read_GroupDto> _Group = new List<Read_GroupDto>();
|
||||
//-------------------------------------
|
||||
bool isSelectedInbox1 = false;
|
||||
public List<ChatItemDto> Inbox1Items { get; set; } = new();
|
||||
List<ChatItemDto> Inbox1Items { get; set; } = new();
|
||||
bool isSelectedInbox2 = true;
|
||||
public List<ChatItemDto> Inbox2Items { get; set; } = new();
|
||||
List<ChatItemDto> Inbox2Items { get; set; } = new();
|
||||
bool isSelectedInbox3 = false;
|
||||
public List<ChatItemDto> Inbox3Items { get; set; } = new();
|
||||
List<ChatItemDto> Inbox3Items { get; set; } = new();
|
||||
/////////////
|
||||
public ChatItemDto? ChatCurrent { get; set; } = null;
|
||||
public string MsgInput { get; set; }
|
||||
ChatItemDto? ChatCurrent { get; set; } = null;
|
||||
string MsgInput { get; set; }
|
||||
bool chatloading = false;
|
||||
string SelectedChatUserName = "مهدی ربیع نژاد";
|
||||
private bool _shouldObserveVisibility = false;
|
||||
private ConfirmDialog dialog = default!;
|
||||
private Modal modal = default!;
|
||||
private HubConnection? hubConnection;
|
||||
}
|
||||
@functions {
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -297,6 +302,39 @@
|
||||
Inbox2Items = await chatService.MyChatsIsInProgress();
|
||||
Inbox3Items = await chatService.MyChatsIsFinished();
|
||||
|
||||
//-------------hub
|
||||
var token = await localStorageService.GetItem<string>("U/key");
|
||||
string AddressHub = _Http.BaseAddress.AbsoluteUri.Replace("api/", "");
|
||||
|
||||
hubConnection = new HubConnectionBuilder()
|
||||
.WithUrl($"{_Http.BaseAddress.AbsoluteUri.Replace("api/", "")}chatNotificationHub", options =>
|
||||
{
|
||||
options.AccessTokenProvider = () => Task.FromResult(token);
|
||||
})
|
||||
.WithAutomaticReconnect()
|
||||
.Build();
|
||||
|
||||
hubConnection.On<ChatItemResponseDto>("ReceiveNewChatItemFromUser", async (chatitem) =>
|
||||
{
|
||||
if (ChatCurrent.ID == chatitem.ChatItemID)
|
||||
{
|
||||
ChatCurrent.Responses.Add(chatitem);
|
||||
StateHasChanged();
|
||||
await MarkAsRead(chatitem.ID);
|
||||
// Scroll to target if exists, otherwise scroll to bottom
|
||||
await JS.InvokeVoidAsync("scrollToTargetOrBottom");
|
||||
}
|
||||
});
|
||||
|
||||
hubConnection.On<int>("CheckMarkAsRead", async (chatresponseid) =>
|
||||
{
|
||||
if (ChatCurrent.Responses.Any(a => a.ID == chatresponseid && !a.IsRead && (a.Type == Common.Enums.ConversationType.EU || a.Type == Common.Enums.ConversationType.CU)))
|
||||
{ ChatCurrent.Responses.First(a => a.ID == chatresponseid).IsRead = true; StateHasChanged(); }
|
||||
});
|
||||
|
||||
await hubConnection.StartAsync();
|
||||
//---------end hub
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
@@ -339,12 +377,13 @@
|
||||
if (!string.IsNullOrEmpty(MsgInput) && ChatCurrent != null)
|
||||
{
|
||||
Common.Enums.ConversationType type = CurrentUser.Role == "Company" ? Common.Enums.ConversationType.CU : Common.Enums.ConversationType.EU;
|
||||
await chatService.ADDChatResponse(ChatCurrent.ID, MsgInput, type);
|
||||
ChatCurrent?.Responses.Add(new() { text = MsgInput, Type = type });
|
||||
var geter= await chatService.ADDChatResponse(ChatCurrent.ID, MsgInput, type);
|
||||
if(geter!=null)
|
||||
{ChatCurrent?.Responses.Add(geter);
|
||||
ChatCurrent.LastText = MsgInput;
|
||||
await Task.Yield();
|
||||
await JS.InvokeVoidAsync("scrollToBottom", "B1");
|
||||
MsgInput = string.Empty;
|
||||
MsgInput = string.Empty;}
|
||||
}
|
||||
}
|
||||
async Task onClickSelectedChat(int InboxID, ChatItemDto chatItem)
|
||||
@@ -375,7 +414,7 @@
|
||||
async Task onclickAttachedto()
|
||||
{
|
||||
Dictionary<string, object> parameters = new Dictionary<string, object>();
|
||||
parameters.Add("chatID",ChatCurrent.ID);
|
||||
parameters.Add("chatID", ChatCurrent.ID);
|
||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create(this, CallBackAttachedto));
|
||||
|
||||
await modal.ShowAsync<AttachedtoComponent>("پیوست کارشناس", parameters: parameters);
|
||||
@@ -383,12 +422,12 @@
|
||||
}
|
||||
async Task CallBackAttachedto()
|
||||
{
|
||||
await modal.HideAsync();
|
||||
await modal.HideAsync();
|
||||
toastService.Notify(new ToastMessage(ToastType.Success, "کارشناس جدید به این گفتگو پیوست"));
|
||||
}
|
||||
async Task OpenChat()
|
||||
{
|
||||
if (CurrentUser.Role == "Company" || CurrentUser.Role == "Exper" && ChatCurrent.ExperID==CurrentUser.ExperID)
|
||||
if (CurrentUser.Role == "Company" || CurrentUser.Role == "Exper" && ChatCurrent.ExperID == CurrentUser.ExperID)
|
||||
{
|
||||
if (ChatCurrent.status != Common.Enums.ConversationStatus.Finished) return;
|
||||
if (await chatService.OpenChat(ChatCurrent.ID))
|
||||
@@ -396,10 +435,10 @@
|
||||
ChatCurrent.status = Common.Enums.ConversationStatus.InProgress;
|
||||
StateHasChanged();
|
||||
}
|
||||
else toastService.Notify(new ToastMessage(ToastType.Danger, "تغییر وضعیت گفتگو موفق نبود"));
|
||||
else toastService.Notify(new ToastMessage(ToastType.Danger, "تغییر وضعیت گفتگو موفق نبود"));
|
||||
}
|
||||
else toastService.Notify(new ToastMessage(ToastType.Danger, "دسترسی به این گفتگو ندارید"));
|
||||
|
||||
|
||||
}
|
||||
async Task CloseChat()
|
||||
{
|
||||
@@ -455,20 +494,25 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sidebar-header::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
left: -50%;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
|
||||
animation: shimmer 3s infinite;
|
||||
}
|
||||
.sidebar-header::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -50%;
|
||||
left: -50%;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
|
||||
animation: shimmer 3s infinite;
|
||||
}
|
||||
|
||||
@@keyframes shimmer {
|
||||
0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
|
||||
100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
|
||||
0% {
|
||||
transform: translateX(-100%) translateY(-100%) rotate(45deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translateX(100%) translateY(100%) rotate(45deg);
|
||||
}
|
||||
}
|
||||
|
||||
.header-content {
|
||||
@@ -509,33 +553,33 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tab-button::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
|
||||
transition: left 0.5s ease;
|
||||
}
|
||||
.tab-button::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
|
||||
transition: left 0.5s ease;
|
||||
}
|
||||
|
||||
.tab-button:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
.tab-button:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
.tab-button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(13, 110, 253, 0.2);
|
||||
border-color: #0d6efd;
|
||||
}
|
||||
.tab-button:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(13, 110, 253, 0.2);
|
||||
border-color: #0d6efd;
|
||||
}
|
||||
|
||||
.tab-button.active-tab {
|
||||
background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
|
||||
color: white;
|
||||
border-color: #0d6efd;
|
||||
box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
|
||||
}
|
||||
.tab-button.active-tab {
|
||||
background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
|
||||
color: white;
|
||||
border-color: #0d6efd;
|
||||
box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
|
||||
}
|
||||
|
||||
/* Smaller tab buttons */
|
||||
.tab-button {
|
||||
@@ -559,11 +603,11 @@
|
||||
background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
|
||||
}
|
||||
|
||||
.inbox1-button:hover {
|
||||
border-color: #e0a800;
|
||||
background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
|
||||
color: #856404;
|
||||
}
|
||||
.inbox1-button:hover {
|
||||
border-color: #e0a800;
|
||||
background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
|
||||
color: #856404;
|
||||
}
|
||||
|
||||
.inbox1-active {
|
||||
background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
|
||||
@@ -579,11 +623,11 @@
|
||||
background: linear-gradient(135deg, #e7f1ff 0%, #cce7ff 100%);
|
||||
}
|
||||
|
||||
.inbox2-button:hover {
|
||||
border-color: #0b5ed7;
|
||||
background: linear-gradient(135deg, #cce7ff 0%, #b3d9ff 100%);
|
||||
color: #0b5ed7;
|
||||
}
|
||||
.inbox2-button:hover {
|
||||
border-color: #0b5ed7;
|
||||
background: linear-gradient(135deg, #cce7ff 0%, #b3d9ff 100%);
|
||||
color: #0b5ed7;
|
||||
}
|
||||
|
||||
.inbox2-active {
|
||||
background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%) !important;
|
||||
@@ -599,11 +643,11 @@
|
||||
background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
|
||||
}
|
||||
|
||||
.inbox3-button:hover {
|
||||
border-color: #c82333;
|
||||
background: linear-gradient(135deg, #f5c6cb 0%, #f1b0b7 100%);
|
||||
color: #721c24;
|
||||
}
|
||||
.inbox3-button:hover {
|
||||
border-color: #c82333;
|
||||
background: linear-gradient(135deg, #f5c6cb 0%, #f1b0b7 100%);
|
||||
color: #721c24;
|
||||
}
|
||||
|
||||
.inbox3-active {
|
||||
background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
|
||||
@@ -639,27 +683,27 @@
|
||||
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.sidebar-chat-list::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
.sidebar-chat-list::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.sidebar-chat-list::-webkit-scrollbar-track {
|
||||
background: rgba(241, 241, 241, 0.5);
|
||||
border-radius: 10px;
|
||||
}
|
||||
.sidebar-chat-list::-webkit-scrollbar-track {
|
||||
background: rgba(241, 241, 241, 0.5);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.sidebar-chat-list::-webkit-scrollbar-thumb {
|
||||
background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
|
||||
border-radius: 10px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.sidebar-chat-list::-webkit-scrollbar-thumb {
|
||||
background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
|
||||
border-radius: 10px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.sidebar-chat-list::-webkit-scrollbar-thumb:hover {
|
||||
background: linear-gradient(135deg, #0b5ed7 0%, #0a4b9e 100%);
|
||||
}
|
||||
.sidebar-chat-list::-webkit-scrollbar-thumb:hover {
|
||||
background: linear-gradient(135deg, #0b5ed7 0%, #0a4b9e 100%);
|
||||
}
|
||||
|
||||
.chat-list-item {
|
||||
height:75px;
|
||||
height: 75px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
@@ -674,26 +718,26 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.chat-list-item::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(13, 110, 253, 0.1), transparent);
|
||||
transition: left 0.5s ease;
|
||||
}
|
||||
.chat-list-item::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(13, 110, 253, 0.1), transparent);
|
||||
transition: left 0.5s ease;
|
||||
}
|
||||
|
||||
.chat-list-item:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
.chat-list-item:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
.chat-list-item:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(13, 110, 253, 0.15);
|
||||
border-color: #0d6efd;
|
||||
}
|
||||
.chat-list-item:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 16px rgba(13, 110, 253, 0.15);
|
||||
border-color: #0d6efd;
|
||||
}
|
||||
|
||||
.item-avatar {
|
||||
width: 45px;
|
||||
@@ -776,6 +820,7 @@
|
||||
transform: scale(1);
|
||||
box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 4px 8px rgba(220, 53, 69, 0.4);
|
||||
@@ -1015,7 +1060,6 @@
|
||||
|
||||
/* Empty state styling */
|
||||
.chat-area-container .d-flex.justify-content-center {
|
||||
|
||||
border-radius: 15px;
|
||||
padding: 2rem;
|
||||
margin: 1rem;
|
||||
@@ -1175,29 +1219,35 @@
|
||||
animation: warningGlow 3s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.warning-note::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 193, 7, 0.1), transparent);
|
||||
animation: warningShimmer 4s infinite;
|
||||
}
|
||||
.warning-note::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255, 193, 7, 0.1), transparent);
|
||||
animation: warningShimmer 4s infinite;
|
||||
}
|
||||
|
||||
@@keyframes warningGlow {
|
||||
0%, 100% {
|
||||
box-shadow: 0 4px 12px rgba(255, 193, 7, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
50% {
|
||||
box-shadow: 0 6px 16px rgba(255, 193, 7, 0.3), 0 4px 8px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
}
|
||||
|
||||
@@keyframes warningShimmer {
|
||||
0% { left: -100%; }
|
||||
100% { left: 100%; }
|
||||
0% {
|
||||
left: -100%;
|
||||
}
|
||||
|
||||
100% {
|
||||
left: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.warning-icon {
|
||||
@@ -1218,6 +1268,7 @@
|
||||
transform: scale(1);
|
||||
box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 6px 16px rgba(255, 193, 7, 0.6);
|
||||
@@ -1251,9 +1302,9 @@
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.warning-note:hover .warning-icon {
|
||||
animation: warningPulse 1s ease-in-out infinite;
|
||||
}
|
||||
.warning-note:hover .warning-icon {
|
||||
animation: warningPulse 1s ease-in-out infinite;
|
||||
}
|
||||
|
||||
/* Enhanced button styling */
|
||||
.finish-conversation-btn {
|
||||
@@ -1291,6 +1342,7 @@
|
||||
background-color: #23caba;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.toexper-btn {
|
||||
border-radius: 20px;
|
||||
font-weight: 600;
|
||||
@@ -1345,7 +1397,7 @@
|
||||
const targetRect = targetElement.getBoundingClientRect();
|
||||
const containerRect = chatContainer.getBoundingClientRect();
|
||||
const relativeTop = targetRect.top - containerRect.top;
|
||||
|
||||
|
||||
// Scroll to show the target element with some padding
|
||||
const scrollPosition = chatContainer.scrollTop + relativeTop - 100; // 100px padding
|
||||
chatContainer.scrollTo({
|
||||
|
@@ -18,6 +18,7 @@
|
||||
@inject ChatService chatService
|
||||
@inject IJSRuntime JS
|
||||
@inject ToastService toastService
|
||||
@inject HttpClient _Http;
|
||||
@layout UserPanelLayout
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
|
||||
@@ -262,14 +263,14 @@
|
||||
}
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Console.WriteLine($"🔔 welcome");
|
||||
|
||||
await IsOnline();
|
||||
//-------------hub
|
||||
var token = await localStorageService.GetItem<string>("U/key");
|
||||
string AddressHub = _Http.BaseAddress.AbsoluteUri.Replace("api/", "");
|
||||
|
||||
hubConnection = new HubConnectionBuilder()
|
||||
.WithUrl("http://localhost:5089/chatNotificationHub", options =>
|
||||
.WithUrl($"{AddressHub}chatNotificationHub", options =>
|
||||
{
|
||||
options.AccessTokenProvider = () => Task.FromResult(token);
|
||||
})
|
||||
@@ -282,11 +283,20 @@
|
||||
{
|
||||
LastOpenChat.Responses.Add(chatitem);
|
||||
StateHasChanged();
|
||||
await MarkAsRead(chatitem.ID);
|
||||
await MarkAsRead(chatitem.ID);
|
||||
// Scroll to target if exists, otherwise scroll to bottom
|
||||
await JS.InvokeVoidAsync("scrollToTargetOrBottom");
|
||||
}
|
||||
});
|
||||
//-------------------------------------
|
||||
hubConnection.On<int>("CheckMarkAsRead", async (chatresponseid) =>
|
||||
{
|
||||
if (LastOpenChat.Responses.Any(a=>a.ID==chatresponseid && !a.IsRead && a.Type==Common.Enums.ConversationType.UE))
|
||||
{
|
||||
LastOpenChat.Responses.First(a => a.ID == chatresponseid).IsRead = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
});
|
||||
|
||||
await hubConnection.StartAsync();
|
||||
//---------end hub
|
||||
|
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Components;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
using static System.Net.WebRequestMethods;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace HushianWebApp.Service
|
||||
@@ -54,6 +55,7 @@ namespace HushianWebApp.Service
|
||||
}
|
||||
public async Task<Tuple<string, HttpResponseMessage>> PostLogin(string route, object mode)
|
||||
{
|
||||
|
||||
var result = await _Http.PostAsJsonAsync(route, mode);
|
||||
if (result.IsSuccessStatusCode)
|
||||
{
|
||||
|
Reference in New Issue
Block a user