Skip to content

Commit c493cbf

Browse files
committed
Added Filter for range
1 parent 7cde14a commit c493cbf

File tree

2 files changed

+55
-22
lines changed

2 files changed

+55
-22
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<div class="col-1">
2+
<p>Since: </p>
3+
</div>
4+
<div class="col-2">
5+
<select @onchange="RaiseDateTimeSpanChanged">
6+
@foreach (var (title, time) in options)
7+
{
8+
<option value="@time">@title</option>
9+
}
10+
</select>
11+
</div>
12+
@code {
13+
[Parameter]
14+
public EventCallback<DateTime> DateTimeSpanChanged { get; set; }
15+
16+
private readonly Dictionary<string, DateTime> options = new()
17+
{
18+
{ "Beginning of time", DateTime.MinValue },
19+
{ "Last 90 Days", DateTime.UtcNow.AddDays(-90) },
20+
{ "Last 30 Days", DateTime.UtcNow.AddDays(-30) },
21+
{ "Last 7 Days", DateTime.UtcNow.AddDays(-7) },
22+
{ "Since Today", DateTime.UtcNow.Date },
23+
};
24+
25+
private void RaiseDateTimeSpanChanged(ChangeEventArgs args)
26+
{
27+
Console.WriteLine(args.Value);
28+
}
29+
30+
}

LinkDotNet.Blog.Web/Shared/Admin/Dashboard/VisitCountPerPage.razor

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,33 @@
88
<div class="card">
99
<div class="card-header">Blog Post Visit Counts</div>
1010
<div class="card-body">
11-
<table class="table table-striped table-hover">
12-
<tbody>
13-
<tr>
14-
<th>Title</th>
15-
<th>Clicks</th>
16-
<th>Likes</th>
17-
</tr>
18-
@if (visitData != null)
19-
{
20-
@foreach (var date in visitData)
11+
<div class="row">
12+
<DateRangeSelector></DateRangeSelector>
13+
<table class="table table-striped table-hover">
14+
<tbody>
15+
<tr>
16+
<th>Title</th>
17+
<th>Clicks</th>
18+
<th>Likes</th>
19+
</tr>
20+
@if (visitData != null)
2121
{
22-
<tr>
23-
<td><a href="blogPost/@date.Id">@date.Title</a></td>
24-
<td>@date.ClickCount</td>
25-
<td>@date.Likes</td>
26-
</tr>
22+
@foreach (var date in visitData)
23+
{
24+
<tr>
25+
<td><a href="blogPost/@date.Id">@date.Title</a></td>
26+
<td>@date.ClickCount</td>
27+
<td>@date.Likes</td>
28+
</tr>
29+
}
2730
}
28-
}
29-
else
30-
{
31-
<Loading></Loading>
32-
}
33-
</tbody>
34-
</table>
31+
else
32+
{
33+
<Loading></Loading>
34+
}
35+
</tbody>
36+
</table>
37+
</div>
3538
</div>
3639
</div>
3740

0 commit comments

Comments
 (0)