Skip to content

Commit 7598d80

Browse files
committed
(#424) wasm: update posts service
1 parent 807cae0 commit 7598d80

File tree

8 files changed

+95
-44
lines changed

8 files changed

+95
-44
lines changed

MiniSpace.Web/src/Astravent.Web.Wasm/Areas/Posts/CommandsDto/CreatePostCommand.cs

+4
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,9 @@ public class CreatePostCommand
1616
public DateTime? PublishDate { get; set; }
1717
public PostContext Context { get; set; }
1818
public string Visibility { get; set; }
19+
public string PostType { get; set; }
20+
public string Title { get; set; }
21+
public Guid? PageOwnerId { get; set; }
22+
public string PageOwnerType { get; set; }
1923
}
2024
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using Astravent.Web.Wasm.DTO.Enums.Posts;
3+
4+
namespace Astravent.Web.Wasm.Areas.Posts.CommandsDto
5+
{
6+
public class RepostCommand
7+
{
8+
public Guid OriginalPostId { get; set; }
9+
public Guid RepostedPostId { get; set; }
10+
public Guid? UserId { get; set; }
11+
public Guid? OrganizationId { get; set; }
12+
public Guid? EventId { get; set; }
13+
public PostContext Context { get; set; }
14+
public Guid? PageOwnerId { get; set; }
15+
public string PageOwnerType { get; set; }
16+
17+
public RepostCommand(
18+
Guid originalPostId,
19+
Guid repostedPostId,
20+
Guid? userId,
21+
Guid? organizationId,
22+
Guid? eventId,
23+
PostContext context,
24+
Guid? pageOwnerId = null,
25+
string pageOwnerType = "User")
26+
{
27+
OriginalPostId = originalPostId;
28+
RepostedPostId = repostedPostId;
29+
UserId = userId;
30+
OrganizationId = organizationId;
31+
EventId = eventId;
32+
Context = context;
33+
PageOwnerId = pageOwnerId;
34+
PageOwnerType = pageOwnerType;
35+
}
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Astravent.Web.Wasm.DTO.Enums.Posts;
4+
5+
namespace Astravent.Web.Wasm.Areas.Posts.CommandsDto
6+
{
7+
public class UpdatePostCommand
8+
{
9+
public Guid PostId { get; set; }
10+
public Guid? UserId { get; set; }
11+
public Guid? OrganizationId { get; set; }
12+
public Guid? EventId { get; set; }
13+
public string TextContent { get; set; }
14+
public IEnumerable<string> MediaFiles { get; set; }
15+
public string State { get; set; }
16+
public DateTime? PublishDate { get; set; }
17+
public PostContext Context { get; set; }
18+
public string Visibility { get; set; }
19+
public string PostType { get; set; }
20+
public string Title { get; set; }
21+
public Guid? PageOwnerId { get; set; }
22+
public string PageOwnerType { get; set; }
23+
}
24+
}

MiniSpace.Web/src/Astravent.Web.Wasm/Areas/Posts/IPostsService.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ public interface IPostsService
1414
Task<PostDto> GetPostAsync(Guid postId);
1515
Task ChangePostStateAsync(Guid postId, string state, DateTime publishDate);
1616
Task<HttpResponse<object>> CreatePostAsync(CreatePostCommand command);
17+
Task<HttpResponse<object>> RepostPostAsync(RepostCommand command);
1718
Task<HttpResponse<PagedResponseDto<PostDto>>> SearchPostsAsync(SearchPosts searchPosts);
18-
Task<HttpResponse<PagedResponseDto<PostDto>>> GetUserFeedAsync(Guid userId, int pageNumber, int pageSize, string sortBy = "PublishDate", string direction = "asc");
19+
Task<HttpResponse<PagedResponseDto<PostDto>>> GetUserFeedAsync(Guid userId, int pageNumber,
20+
int pageSize, string sortBy = "PublishDate", string direction = "asc");
1921
Task DeletePostAsync(Guid postId);
2022
Task<IEnumerable<PostDto>> GetPostsAsync(Guid eventId);
21-
Task<HttpResponse<object>> UpdatePostAsync(Guid postId, string textContent, IEnumerable<Guid> mediaFiles);
23+
Task<HttpResponse<object>> UpdatePostAsync(UpdatePostCommand command);
2224
}
2325
}

MiniSpace.Web/src/Astravent.Web.Wasm/Areas/Posts/PostsService.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ public Task<HttpResponse<object>> CreatePostAsync(CreatePostCommand command)
4141
_httpClient.SetAccessToken(_identityService.JwtDto.AccessToken);
4242
return _httpClient.PostAsync<CreatePostCommand, object>("posts", command);
4343
}
44+
45+
public Task<HttpResponse<object>> RepostPostAsync(RepostCommand command)
46+
{
47+
_httpClient.SetAccessToken(_identityService.JwtDto.AccessToken);
48+
return _httpClient.PostAsync<RepostCommand, object>("posts/repost", command);
49+
}
4450

4551
public async Task<HttpResponse<PagedResponseDto<PostDto>>> SearchPostsAsync(SearchPosts searchPosts)
4652
{
@@ -119,10 +125,10 @@ public Task<IEnumerable<PostDto>> GetPostsAsync(Guid eventId)
119125
return _httpClient.GetAsync<IEnumerable<PostDto>>($"posts?eventId={eventId}");
120126
}
121127

122-
public Task<HttpResponse<object>> UpdatePostAsync(Guid postId, string textContent, IEnumerable<Guid> mediaFiles)
128+
public Task<HttpResponse<object>> UpdatePostAsync(UpdatePostCommand command)
123129
{
124130
_httpClient.SetAccessToken(_identityService.JwtDto.AccessToken);
125-
return _httpClient.PutAsync<object, object>($"posts/{postId}", new {postId, textContent, mediaFiles});
131+
return _httpClient.PutAsync<UpdatePostCommand, object>($"posts/{command.PostId}", command);
126132
}
127133
}
128134
}

MiniSpace.Web/src/Astravent.Web.Wasm/Shared/MainLayout.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,6 @@
356356

357357
<style>
358358
.mud-nav-link {
359-
padding: 8px 5px 8px 5px;
359+
padding: 8px 8px 8px 8px;
360360
}
361361
</style>

MiniSpace.Web/src/Astravent.Web.Wasm/wwwroot/css/site.css

+16-37
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ html, body {
521521

522522

523523

524-
#components-reconnect-modal {
524+
/* #components-reconnect-modal {
525525
display: none;
526526
position: fixed;
527527
top: 0px;
@@ -650,7 +650,6 @@ div.connectionRejected {
650650
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.15);
651651
}
652652
653-
/* Adding unique delays for a cascading spiral effect */
654653
.circle:nth-child(1) { animation-delay: 0s; }
655654
.circle:nth-child(2) { animation-delay: 0.25s; }
656655
.circle:nth-child(3) { animation-delay: 0.5s; }
@@ -663,7 +662,6 @@ div.connectionRejected {
663662
.circle:nth-child(10) { animation-delay: 2.25s; }
664663
.circle:nth-child(11) { animation-delay: 2.5s; }
665664
666-
/* Keyframes for modern spiral movement with scaling, rotation, and color changes */
667665
@keyframes modernSpiral {
668666
0% {
669667
transform: translate(-150px, 0) scale(0.5) rotate(0deg);
@@ -712,7 +710,7 @@ div.connectionRejected {
712710
opacity: 0;
713711
background-color: #3498db;
714712
}
715-
}
713+
} */
716714

717715
/* Text loading dots animation */
718716
.loading {
@@ -955,15 +953,14 @@ div.connectionRejected {
955953

956954

957955
/* webassembly loader */
958-
959956
#app {
960957
display: flex;
958+
flex-direction: column;
961959
justify-content: center;
962960
align-items: center;
963961
height: 100vh;
964-
/* background-color: #ffffff; */
965962
position: relative;
966-
transition: opacity 0.5s ease, visibility 0.5s ease;
963+
transition: opacity 0.3s ease, visibility 0.3s ease;
967964
}
968965

969966
/* Hide the loader when the app is loaded */
@@ -977,54 +974,36 @@ div.connectionRejected {
977974
.loading-progress {
978975
width: 100px;
979976
height: 100px;
980-
animation: rotate 2s linear infinite;
981977
}
982978

983979
.loading-progress circle {
984980
fill: none;
985-
stroke-width: 8;
981+
stroke-width: 5;
986982
stroke-linecap: round;
987-
}
988-
989-
.outer-circle {
990983
stroke: #3f51b5;
991-
opacity: 0.2;
992-
}
993-
994-
.inner-circle {
995-
stroke: #ff4081;
996-
stroke-dasharray: 251.2; /* Circumference of the circle */
997-
stroke-dashoffset: 251.2;
998-
animation: dash 1.5s ease-in-out infinite;
984+
stroke-dasharray: 188.4; /* Circumference of the circle */
985+
stroke-dashoffset: 188.4;
986+
animation: dashSpin 0.5s linear infinite;
999987
}
1000988

1001989
/* Text Style */
1002990
.loading-progress-text {
1003-
font-size: 18px;
991+
font-size: 14px;
1004992
font-weight: bold;
1005993
color: #3f51b5;
1006-
margin-top: 20px;
994+
margin-top: 10px;
1007995
text-align: center;
1008-
animation: textFade 1.5s ease-in-out infinite;
996+
animation: textFade 0.8s ease-in-out infinite;
1009997
}
1010998

1011999
/* Animations */
1012-
@keyframes rotate {
1013-
100% {
1014-
transform: rotate(360deg);
1015-
}
1016-
}
1017-
1018-
@keyframes dash {
1000+
@keyframes dashSpin {
10191001
0% {
1020-
stroke-dashoffset: 251.2;
1021-
}
1022-
50% {
1023-
stroke-dashoffset: 125.6;
1024-
transform: rotate(45deg);
1002+
stroke-dashoffset: 188.4;
1003+
transform: rotate(0deg);
10251004
}
10261005
100% {
1027-
stroke-dashoffset: 251.2;
1006+
stroke-dashoffset: 0;
10281007
transform: rotate(360deg);
10291008
}
10301009
}
@@ -1036,4 +1015,4 @@ div.connectionRejected {
10361015
50% {
10371016
opacity: 0.5;
10381017
}
1039-
}
1018+
}

MiniSpace.Web/src/Astravent.Web.Wasm/wwwroot/index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
<div id="app">
4141
<!-- Animated Loading SVG -->
4242
<svg class="loading-progress" viewBox="0 0 100 100">
43-
<circle class="outer-circle" r="40%" cx="50%" cy="50%" />
44-
<circle class="inner-circle" r="40%" cx="50%" cy="50%" />
43+
<circle class="loading-circle" r="40%" cx="50%" cy="50%" />
4544
</svg>
4645
<!-- Loading Text -->
4746
<div class="loading-progress-text">Loading, please wait...</div>

0 commit comments

Comments
 (0)