Skip to content

Commit

Permalink
(#57) update event card to differ colors depend on status
Browse files Browse the repository at this point in the history
  • Loading branch information
an2508374 committed May 16, 2024
1 parent f4120ca commit 40fc658
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 100 deletions.
46 changes: 46 additions & 0 deletions MiniSpace.Web/src/MiniSpace.Web/Components/RadzenEventCard.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
@using MiniSpace.Web.DTO
@inject NavigationManager NavigationManager

<RadzenCard Class="rz-border-radius-3" Style="cursor: pointer"
@onclick="@(() => NavigationManager.NavigateTo($"/events/{Event.Id}"))">
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Name</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(Event.Name)</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="5">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Status</RadzenText>
@switch (Event.Status)
{
case "Published":
<RadzenText TextStyle="TextStyle.Body1" Style="color: green"><b>@Event.Status</b></RadzenText>
break;
case "Archived":
<RadzenText TextStyle="TextStyle.Body1" Style="color: indianred"><b>@Event.Status</b></RadzenText>
break;
default:
<RadzenText TextStyle="TextStyle.Body1"><b>@Event.Status</b></RadzenText>
break;
}
</RadzenColumn>
</RadzenRow>
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">Start date</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(Event.StartDate.ToLocalTime().ToString(dateFormat))</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="5">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">End date</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(Event.EndDate.ToLocalTime().ToString(dateFormat))</b></RadzenText>
</RadzenColumn>
</RadzenRow>
<hr style="border: none; background-color: rgba(0,0,0,.2); height: 1px; margin: 1rem 0;"/>
</RadzenCard>

@code
{
[Parameter]
public EventDto Event { get; set; }

private const string dateFormat = "dd/MM/yyyy HH:mm";
}
51 changes: 3 additions & 48 deletions MiniSpace.Web/src/MiniSpace.Web/Pages/Events/Events.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using MiniSpace.Web.Areas.Students
@using MiniSpace.Web.DTO
@using MiniSpace.Web.Areas.Events
@using MiniSpace.Web.Components
@using MiniSpace.Web.Pages.Events.Dialogs
@using Radzen
@using DialogOptions = Radzen.DialogOptions
Expand Down Expand Up @@ -30,30 +31,7 @@
}
<RadzenDataList AllowPaging="false" Data="@signedUpEvents" TItem="EventDto">
<Template Context="ev">
<RadzenCard Class="rz-border-radius-3" Style="cursor: pointer"
@onclick="@(() => NavigationManager.NavigateTo($"/events/{ev.Id}"))">
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Name</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.Name)</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="5">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Status</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.Status)</b></RadzenText>
</RadzenColumn>
</RadzenRow>
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">Start date</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.StartDate.ToLocalTime().ToString(dateFormat))</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="5">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">End date</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.EndDate.ToLocalTime().ToString(dateFormat))</b></RadzenText>
</RadzenColumn>
</RadzenRow>
<hr style="border: none; background-color: rgba(0,0,0,.2); height: 1px; margin: 1rem 0;"/>
</RadzenCard>
<RadzenEventCard Event="ev" />
</Template>
</RadzenDataList>
</RadzenTabsItem>
Expand All @@ -65,30 +43,7 @@
}
<RadzenDataList AllowPaging="false" Data="@interestedEvents" TItem="EventDto">
<Template Context="ev">
<RadzenCard Class="rz-border-radius-3" Style="cursor: pointer"
@onclick="@(() => NavigationManager.NavigateTo($"/events/{ev.Id}"))">
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Name</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.Name)</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="5">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Status</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.Status)</b></RadzenText>
</RadzenColumn>
</RadzenRow>
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">Start date</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.StartDate.ToLocalTime().ToString(dateFormat))</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="5">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">Capacity</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.SignedUpStudents)/@(ev.Capacity)</b></RadzenText>
</RadzenColumn>
</RadzenRow>
<hr style="border: none; background-color: rgba(0,0,0,.2); height: 1px; margin: 1rem 0;" />
</RadzenCard>
<RadzenEventCard Event="ev" />
</Template>
</RadzenDataList>
</RadzenTabsItem>
Expand Down
28 changes: 2 additions & 26 deletions MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsOrganize.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/events/organize"
@using MiniSpace.Web.Areas.Events
@using MiniSpace.Web.Areas.Students
@using MiniSpace.Web.Components
@using MiniSpace.Web.DTO
@using MiniSpace.Web.DTO.Wrappers
@using MiniSpace.Web.Models.Events
Expand Down Expand Up @@ -48,30 +49,7 @@

<RadzenDataList AllowPaging="false" Data="@events" TItem="EventDto">
<Template Context="ev">
<RadzenCard Class="rz-border-radius-3" Style="cursor: pointer"
@onclick="@(() => NavigationManager.NavigateTo($"/events/{ev.Id}"))">
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Name</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.Name)</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="5">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Status</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.Status)</b></RadzenText>
</RadzenColumn>
</RadzenRow>
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">Start date</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.StartDate.ToLocalTime().ToString(dateFormat))</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="5">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">Capacity</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.SignedUpStudents)/@(ev.Capacity)</b></RadzenText>
</RadzenColumn>
</RadzenRow>
<hr style="border: none; background-color: rgba(0,0,0,.2); height: 1px; margin: 1rem 0;"/>
</RadzenCard>
<RadzenEventCard Event="ev" />
</Template>
</RadzenDataList>

Expand All @@ -85,8 +63,6 @@
}

@code {
private const string dateFormat = "dd/MM/yyyy HH:mm";

private SearchOrganizerEventsModel searchOrganizerEventsModel = new()
{
Name = "",
Expand Down
32 changes: 6 additions & 26 deletions MiniSpace.Web/src/MiniSpace.Web/Pages/Events/EventsSearch.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@using MiniSpace.Web.Areas.Identity
@using MiniSpace.Web.Areas.Events
@using MiniSpace.Web.Areas.Students
@using MiniSpace.Web.Components
@using MiniSpace.Web.DTO
@using MiniSpace.Web.DTO.Wrappers
@using MiniSpace.Web.Models.Events
Expand Down Expand Up @@ -35,44 +36,23 @@
@if (pageInitialized && totalElements != 0)
{
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.End">
<MudPagination Count="@totalPages" SelectedChanged="@SelectedPageChanged" Selected="@searchEventsModel.Pageable.Page"
<MudPagination Count="@totalPages" SelectedChanged="@SelectedPageChanged"
Selected="@searchEventsModel.Pageable.Page"
Rectangular="true" ShowFirstButton="true" ShowLastButton="true"/>
</RadzenStack>
}

<RadzenDataList AllowPaging="false" Data="@events" TItem="EventDto">
<Template Context="ev">
<RadzenCard Class="rz-border-radius-3" Style="cursor: pointer"
@onclick="@(() => NavigationManager.NavigateTo($"/events/{ev.Id}"))">
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Name</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.Name)</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-1 rz-my-0">Status</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.Status)</b></RadzenText>
</RadzenColumn>
</RadzenRow>
<RadzenRow Size="12">
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">Start date</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.StartDate.ToLocalTime().ToString(dateFormat))</b></RadzenText>
</RadzenColumn>
<RadzenColumn Size="12" SizeMD="6">
<RadzenText TextStyle="TextStyle.Overline" class="rz-display-flex rz-mt-3 rz-mb-0">Capacity</RadzenText>
<RadzenText TextStyle="TextStyle.Body1"><b>@(ev.SignedUpStudents)/@(ev.Capacity)</b></RadzenText>
</RadzenColumn>
</RadzenRow>
<hr style="border: none; background-color: rgba(0,0,0,.2); height: 1px; margin: 1rem 0;"/>
</RadzenCard>
<RadzenEventCard Event="ev" />
</Template>
</RadzenDataList>

@if (pageInitialized && totalElements != 0)
{
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.End">
<MudPagination Count="@totalPages" SelectedChanged="@SelectedPageChanged" Selected="@searchEventsModel.Pageable.Page"
<MudPagination Count="@totalPages" SelectedChanged="@SelectedPageChanged"
Selected="@searchEventsModel.Pageable.Page"
Rectangular="true" ShowFirstButton="true" ShowLastButton="true"/>
</RadzenStack>
}
Expand Down

0 comments on commit 40fc658

Please sign in to comment.