File tree Expand file tree Collapse file tree 3 files changed +22
-4
lines changed
LinkDotNet.Blog.Web/Pages/Admin Expand file tree Collapse file tree 3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 1
1
@page " /dashboard"
2
2
@using LinkDotNet .Blog .Web .Shared .Admin .Dashboard
3
3
@inject IDashboardService dashboardService
4
+ @inject AppConfiguration appConfiguration
4
5
@attribute [Authorize]
5
6
6
7
<div class =" page container-fluid ms-3" >
18
19
TotalAmount =" @data.TotalPageClicks"
19
20
AmountLast30Days =" @data.PageClicksLast30Days" ></DashboardCard >
20
21
</div >
22
+ @if (appConfiguration .IsAboutMeEnabled )
23
+ {
24
+ <div class =" col-auto" >
25
+ <DashboardCard Text =" About Me:"
26
+ TotalAmount =" @data.TotalAboutMeClicks"
27
+ AmountLast30Days =" @data.AboutMeClicksLast30Days" ></DashboardCard >
28
+ </div >
29
+ }
21
30
</div >
22
31
<div class =" row" >
23
- <div class =" col-auto" >
24
- <VisitCountPerPage PageVisitCount =" @data.BlogPostVisitCount" ></VisitCountPerPage >
25
- </div >
26
- </div >
32
+ <div class =" col-auto" >
33
+ <VisitCountPerPage PageVisitCount =" @data.BlogPostVisitCount" ></VisitCountPerPage >
34
+ </div >
35
+ </div >
27
36
</div >
28
37
</div >
29
38
Original file line number Diff line number Diff line change @@ -14,5 +14,9 @@ public class DashboardData
14
14
public int PageClicksLast30Days { get ; set ; }
15
15
16
16
public IOrderedEnumerable < KeyValuePair < string , int > > BlogPostVisitCount { get ; set ; }
17
+
18
+ public int TotalAboutMeClicks { get ; set ; }
19
+
20
+ public int AboutMeClicksLast30Days { get ; set ; }
17
21
}
18
22
}
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ public async Task<DashboardData> GetDashboardDataAsync()
33
33
var clicks = records . Count ;
34
34
var clicks30Days = records . Count ( r => r . DateTimeUtcClicked >= DateTime . UtcNow . AddDays ( - 30 ) ) ;
35
35
36
+ var aboutMeClicks = records . Count ( r => r . UrlClicked . Contains ( "AboutMe" ) ) ;
37
+ var aboutMeClicksLast30Days = records . Count ( r => r . UrlClicked . Contains ( "AboutMe" ) && r . DateTimeUtcClicked >= DateTime . UtcNow . AddDays ( - 30 ) ) ;
38
+
36
39
var visitCount = GetPageVisitCount ( records ) ;
37
40
38
41
return new DashboardData
@@ -41,6 +44,8 @@ public async Task<DashboardData> GetDashboardDataAsync()
41
44
AmountOfUsersLast30Days = users30Days ,
42
45
TotalPageClicks = clicks ,
43
46
PageClicksLast30Days = clicks30Days ,
47
+ TotalAboutMeClicks = aboutMeClicks ,
48
+ AboutMeClicksLast30Days = aboutMeClicksLast30Days ,
44
49
BlogPostVisitCount = visitCount ,
45
50
} ;
46
51
}
You can’t perform that action at this time.
0 commit comments