Skip to content

Commit

Permalink
Merge pull request #262 from SaintAngeLs/frontend_updates
Browse files Browse the repository at this point in the history
Frontend updates
  • Loading branch information
an2508374 authored Jun 2, 2024
2 parents c670391 + 54fd3bf commit d9fc79f
Show file tree
Hide file tree
Showing 25 changed files with 243 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="1rem">
<RadzenStack Gap="1em">
<RadzenStack></RadzenStack>
<RadzenText TextStyle="TextStyle.Body1" TextAlign="TextAlign.Left" Class="rz-mb-0">
<RadzenText TextStyle="TextStyle.Body1" TextAlign="TextAlign.Left" Class="rz-mb-0"
Style="word-wrap: anywhere">
<strong>@(Post.TextContent)</strong>
</RadzenText>
</RadzenStack>
Expand Down
1 change: 1 addition & 0 deletions MiniSpace.Web/src/MiniSpace.Web/DTO/StudentDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class StudentDto
public string Email { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string FullName => $"{FirstName} {LastName}";
public int NumberOfFriends { get; set; }
public Guid ProfileImage { get; set; }
public string Description { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class SearchEventsModel
public OrganizationModel Organization { get; set; }
public string Category { get; set; }
public string State { get; set; }
public IEnumerable<Guid> Friends { get; set; }
public HashSet<Guid> Friends { get; set; }
public string FriendsEngagementType { get; set; }
public DateTime DateFrom { get; set; }
public DateTime DateTo { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</RadzenStack>
}

<RadzenLabels Id="fullname" LabelText="Fullname:" Value="@studentDto.FirstName"/>
<RadzenLabels Id="fullname" LabelText="Fullname:" Value="@studentDto.FullName"/>
<RadzenLabels Id="email" LabelText="Email:" Value="@studentDto.Email"/>

@if (studentDto.State == "valid")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@

@if (!pageInitialized)
{
<h3 class="rz-p-12">Loading...</h3>
<div style="display: flex; justify-content: center; align-items: center;">
<RadzenProgressBarCircular ShowValue="true" ProgressBarStyle="ProgressBarStyle.Light"
Mode="ProgressBarMode.Indeterminate" Size="ProgressBarCircularSize.Large">
<Template>Loading...</Template>
</RadzenProgressBarCircular>
</div>
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@

@if (!pageInitialized)
{
<h3 class="rz-p-12">Loading...</h3>
<div style="display: flex; justify-content: center; align-items: center;">
<RadzenProgressBarCircular ShowValue="true" ProgressBarStyle="ProgressBarStyle.Light"
Mode="ProgressBarMode.Indeterminate" Size="ProgressBarCircularSize.Large">
<Template>Loading...</Template>
</RadzenProgressBarCircular>
</div>
}
@if (pageInitialized && adminId != Guid.Empty)
{
Expand Down Expand Up @@ -200,5 +205,6 @@
Width = "700px", Height = "600px", Resizable = true, Draggable = true,
AutoFocusFirstElement = false
});
StateHasChanged();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@

@if (!pageInitialized)
{
<h3 class="rz-p-12">Loading...</h3>
<div style="display: flex; justify-content: center; align-items: center;">
<RadzenProgressBarCircular ShowValue="true" ProgressBarStyle="ProgressBarStyle.Light"
Mode="ProgressBarMode.Indeterminate" Size="ProgressBarCircularSize.Large">
<Template>Loading...</Template>
</RadzenProgressBarCircular>
</div>
}
@if (pageInitialized && adminId != Guid.Empty)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
<h4>Select an organization (also suborganizations are included in results):</h4>

<RadzenTree Data="@rootOrganizations" Expand="@OnExpand" @bind-Value=@selectedItem>
<RadzenTreeLevel TextProperty="Name" ChildrenProperty="Children"/>
<RadzenTreeLevel TextProperty="Name" ChildrenProperty="Children"/>
<RadzenTreeLevel TextProperty="Name" ChildrenProperty="Children"/>
<RadzenTreeLevel TextProperty="Name" ChildrenProperty="Children"/>
<RadzenTreeLevel TextProperty="Name" ChildrenProperty="Children"/>
<RadzenTreeLevel TextProperty="Name" ChildrenProperty="Children"/>
<RadzenTreeLevel TextProperty="Name" ChildrenProperty="Children"/>
<RadzenTreeLevel TextProperty="Name" ChildrenProperty="Children"/>
Expand Down Expand Up @@ -188,18 +193,25 @@
StateHasChanged();
}

private static void ConvertOrganizationDtoList(IEnumerable<OrganizationDto> input, IList<OrganizationModel> result, Guid? rootId)
private void ConvertOrganizationDtoList(IEnumerable<OrganizationDto> input, IList<OrganizationModel> result, Guid? rootId)
{
result.Clear();
foreach (var organization in input)
{
result.Add(new OrganizationModel()
var newNode = new OrganizationModel()
{
Id = organization.Id,
Name = organization.Name,
RootId = rootId ?? organization.Id,
Children = new List<OrganizationModel>()
});
};

if (SearchEventsModel.Organization.Id == organization.Id)
{
selectedItem = newNode;
}

result.Add(newNode);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,20 @@

@foreach (var friend in friends)
{
<RadzenCard Class="rz-my-3 rz-mx-auto" Style="max-width: 420px">
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenImage Path=@GetImage(friend.FriendId) Style="width: 100px; height: 100px; object-fit: cover; border-radius: 50%;" />
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-2 rz-my-0">Friend</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@($"{friend.StudentDetails.FirstName} {friend.StudentDetails.LastName}")</b></RadzenText>
<RadzenCheckBox Value="@IsFriendSelected(friend.FriendId)"
Change="@((bool value) => SetFriendSelected(friend.FriendId, value))" />
@if (friend.StudentDetails != null)
{
<RadzenCard Class="rz-my-3 rz-mx-auto" Style="max-width: 420px">
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Start" Gap="1rem" Class="rz-p-4">
<RadzenImage Path=@GetImage(friend.FriendId) Style="width: 100px; height: 100px; object-fit: cover; border-radius: 50%;" />
<RadzenStack Gap="0">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-2 rz-my-0">Friend</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@($"{friend.StudentDetails?.FirstName} {friend.StudentDetails?.LastName}")</b></RadzenText>
<RadzenCheckBox Value="@IsFriendSelected(friend.FriendId)"
Change="@((bool value) => SetFriendSelected(friend.FriendId, value))" />
</RadzenStack>
</RadzenStack>
</RadzenStack>
</RadzenCard>
</RadzenCard>
}
}
</div>

Expand Down Expand Up @@ -60,8 +63,10 @@
{
foreach (var friend in friends)
{
if (friend.StudentDetails == null) continue;
Console.WriteLine(friend.StudentDetails.ProfileImage);
var result = await MediaFilesService.GetFileAsync(friend.StudentDetails.ProfileImage);
images[friend.FriendId] = result?.Base64Content ?? "images/user_default.png";
images[friend.StudentDetails.Id] = result?.Base64Content ?? "images/user_default.png";
}
}

Expand Down
11 changes: 6 additions & 5 deletions MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventCreate.razor
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@
</RadzenRadioButtonList>
@if (publishInfo == 2)
{
<RadzenFormField Text="Publish date" Variant="Variant.Outlined">
<RadzenFormField Text="Publish date" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenDatePicker @bind-Value="@_createEventModel.PublishDate" Name="publish-date"
ShowTime="true" MinutesStep="5" DateFormat="dd/MM/yyyy HH:mm" />
<RadzenCustomValidator Component="publish-date" Style="position: relative"
Expand Down Expand Up @@ -224,18 +225,18 @@
private CreateEventModel _createEventModel = new()
{
Name = "One of first events!",
Category = "Art",
Category = "Education",
StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0,0,0),
EndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0,0,0),
EndDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + 1, 0,0,0),
BuildingName = "Gmach Główny",
Street = "Plac Politechniki",
BuildingNumber = "1",
ApartmentNumber = "1",
City = "Warszawa",
ZipCode = "00-061",
ZipCode = "00-661",
Description = "Great event!",
Capacity = 30,
Fee = 34.44M
Fee = 15.00M
};
private bool showError = false;
private string errorMessage = string.Empty;
Expand Down
45 changes: 30 additions & 15 deletions MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventUpdate.razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,42 @@
<RadzenRow Gap="1rem" JustifyContent="JustifyContent.Center">
<RadzenColumn Size="12" SizeSM="4">
<RadzenStack>
<RadzenFormField Text="Name" Variant="Variant.Outlined">
<RadzenFormField Text="Name" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenTextBox @bind-Value="@updateEventModel.Name" Name="name" />
<RadzenRequiredValidator Component="name" Style="position: relative"
Text="Name is required" />
<RadzenLengthValidator Component="name" Max="300" Style="position: relative"
Text="Name should have at most 300 characters" />
</RadzenFormField>
<RadzenFormField Text="Start date" Variant="Variant.Outlined">
<RadzenFormField Text="Start date" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenDatePicker @bind-Value="@updateEventModel.StartDate" Name="start-date"
ShowTime="true" MinutesStep="5" DateFormat="@dateFormat" />
<RadzenCustomValidator Component="start-date" Style="position: relative"
Validator="@(() => ValidateDates(updateEventModel.StartDate, DateTime.Now))"
Text="Start date should be in the future"/>
</RadzenFormField>
<RadzenFormField Text="Building name" Variant="Variant.Outlined">
<RadzenFormField Text="Building name" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenTextBox @bind-Value="@updateEventModel.BuildingName" Name="building-name" />
<RadzenRequiredValidator Component="building-name" Style="position: relative"
Text="Building name is required" />
</RadzenFormField>
<RadzenFormField Text="Building number" Variant="Variant.Outlined">
<RadzenFormField Text="Building number" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenTextBox @bind-Value="@updateEventModel.BuildingNumber" Name="building-number" />
<RadzenRequiredValidator Component="building-number" Style="position: relative"
Text="Building number is required"/>
</RadzenFormField>
<RadzenFormField Text="City" Variant="Variant.Outlined">
<RadzenFormField Text="City" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenTextBox @bind-Value="@updateEventModel.City" Name="city" />
<RadzenRequiredValidator Component="city" Style="position: relative"
Text="City is required"/>
</RadzenFormField>
<RadzenFormField Text="Capacity" Variant="Variant.Outlined">
<RadzenFormField Text="Capacity" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenNumeric @bind-Value="@updateEventModel.Capacity" Name="capacity" />
<RadzenNumericRangeValidator Component="capacity" Min="1" Max="1000" Style="position: relative"
Text="Capacity should be between 1 and 1000" />
Expand All @@ -67,10 +73,12 @@
</RadzenColumn>
<RadzenColumn Size="12" SizeSM="4">
<RadzenStack>
<RadzenFormField Text="Category" Variant="Variant.Outlined">
<RadzenFormField Text="Category" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenDropDown Data=@categories @bind-Value="@updateEventModel.Category" />
</RadzenFormField>
<RadzenFormField Text="End date" Variant="Variant.Outlined">
<RadzenFormField Text="End date" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenDatePicker @bind-Value="@updateEventModel.EndDate" Name="end-date"
ShowTime="true" MinutesStep="5" DateFormat="@dateFormat" />
<RadzenCustomValidator Component="end-date" Style="position: relative"
Expand All @@ -80,25 +88,30 @@
Validator="@(() => ValidateDates(updateEventModel.EndDate, updateEventModel.StartDate))"
Text="End date should be later than start date"/>
</RadzenFormField>
<RadzenFormField Text="Street" Variant="Variant.Outlined">
<RadzenFormField Text="Street" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenTextBox @bind-Value="@updateEventModel.Street" Name="street" />
<RadzenRequiredValidator Component="street" Style="position: relative"
Text="Street is required" />
</RadzenFormField>
<RadzenFormField Text="Apartment number" Variant="Variant.Outlined">
<RadzenFormField Text="Apartment number" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenTextBox @bind-Value="@updateEventModel.ApartmentNumber" />
</RadzenFormField>
<RadzenFormField Text="Zip code" Variant="Variant.Outlined">
<RadzenFormField Text="Zip code" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenTextBox @bind-Value="@updateEventModel.ZipCode" Name="zip-code" />
<RadzenRequiredValidator Component="zip-code" Style="position: relative"
Text="Zip code is required" />
</RadzenFormField>
<RadzenFormField Text="Fee" Variant="Variant.Outlined">
<RadzenFormField Text="Fee" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenNumeric @bind-Value="@updateEventModel.Fee" Placeholder="0.00" Step="0.01" Name="fee"/>
<RadzenNumericRangeValidator Component="fee" Min="0.0" Max="1000.0" Style="position: relative"
Text="Fee should be between 0.0 and 1000.0" />
</RadzenFormField>
<RadzenFormField Text="Publish time" Variant="Variant.Outlined">
<RadzenFormField Text="Publish time" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenStack Orientation="Orientation.Vertical">
<RadzenRadioButtonList @bind-Value="@publishInfo" TValue="int" class="rz-m-4 rz-mt-8">
<Items>
Expand All @@ -108,7 +121,8 @@
</RadzenRadioButtonList>
@if (publishInfo == 2)
{
<RadzenFormField Text="Publish date" Variant="Variant.Outlined">
<RadzenFormField Text="Publish date" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenDatePicker @bind-Value="@updateEventModel.PublishDate" Name="publish-date"
ShowTime="true" MinutesStep="5" DateFormat="@dateFormat" />
<RadzenCustomValidator Component="publish-date" Style="position: relative"
Expand All @@ -131,7 +145,8 @@
<RadzenRow Gap="1rem" JustifyContent="JustifyContent.Center">
<RadzenColumn Size="12" SizeSM="8">
<RadzenStack>
<RadzenFormField Text="Description" Variant="Variant.Outlined">
<RadzenFormField Text="Description" Variant="Variant.Outlined"
AllowFloatingLabel="false">
<RadzenTextArea Style="height: 100px" @bind-Value="@updateEventModel.Description" Name="description"/>
<RadzenRequiredValidator Component="description" Style="position: relative"
Text="Description is required" />
Expand Down
Loading

0 comments on commit d9fc79f

Please sign in to comment.