Skip to content

Commit

Permalink
Minifying
Browse files Browse the repository at this point in the history
Fixed:
- Performance by minifying js and css
  • Loading branch information
RespectMathias committed Dec 12, 2024
1 parent f9bec7a commit c566579
Show file tree
Hide file tree
Showing 16 changed files with 489 additions and 513 deletions.
54 changes: 11 additions & 43 deletions GameLibrary/Pages/Admin/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -62,48 +62,16 @@
</div>

@section Scripts {
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
var gameGenresCtx = document.getElementById('gameGenresChart').getContext('2d');
var gameGenresChart = new Chart(gameGenresCtx, {
type: 'pie',
data: {
labels: @Html.Raw(Json.Serialize(Model.GameGenres.Keys)),
datasets: [{
data: @Html.Raw(Json.Serialize(Model.GameGenres.Values)),
backgroundColor: ['#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0', '#9966FF', '#FF9F40']
}]
}
});
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.min.js"></script>
<script src="~/js/charts.min.js" asp-append-version="true"></script>

var userActivityCtx = document.getElementById('userActivityChart').getContext('2d');
var userActivityChart = new Chart(userActivityCtx, {
type: 'line',
data: {
labels: @Html.Raw(Json.Serialize(Model.UserActivity.Keys)),
datasets: [{
label: 'User Activity',
data: @Html.Raw(Json.Serialize(Model.UserActivity.Values)),
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1
}]
}
});
var reviewRatingsCtx = document.getElementById('reviewRatingsChart').getContext('2d');
var reviewRatingsChart = new Chart(reviewRatingsCtx, {
type: 'bar',
data: {
labels: @Html.Raw(Json.Serialize(Model.ReviewRatings.Keys)),
datasets: [{
label: 'Review Ratings',
data: @Html.Raw(Json.Serialize(Model.ReviewRatings.Values)),
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 1
}]
}
});
</script>
<div id="gameGenresLabels" style="display: none;">@Html.Raw(Json.Serialize(Model.GameGenres.Keys))</div>
<div id="gameGenresData" style="display: none;">@Html.Raw(Json.Serialize(Model.GameGenres.Values))</div>

<div id="userActivityLabels" style="display: none;">@Html.Raw(Json.Serialize(Model.UserActivity.Keys))</div>
<div id="userActivityData" style="display: none;">@Html.Raw(Json.Serialize(Model.UserActivity.Values))</div>

<div id="reviewRatingsLabels" style="display: none;">@Html.Raw(Json.Serialize(Model.ReviewRatings.Keys))</div>
<div id="reviewRatingsData" style="display: none;">@Html.Raw(Json.Serialize(Model.ReviewRatings.Values))</div>
}

54 changes: 4 additions & 50 deletions GameLibrary/Pages/Games/Details.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
ViewData["Title"] = Model.Game.Title;
}

@section Styles {
<link rel="stylesheet" href="~/css/Games/details.min.css" asp-append-version="true" />
}

<div class="container">
<div class="row">
<div class="col-md-4">
Expand Down Expand Up @@ -160,53 +164,3 @@
</div>
</div>
</div>

<style>
.placeholder-image {
background-color: #2b3035;
height: 300px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 0.375rem;
}
.game-details {
background-color: #2b3035;
}
.game-details p {
margin-bottom: 0.5rem;
}
.game-rating {
font-size: 1.25rem;
}
.review-stats {
border-bottom: 1px solid #495057;
padding-bottom: 1rem;
}
.average-rating {
text-align: center;
}
.rating-stars {
font-size: 1.5rem;
color: #ffc107;
}
.add-review {
margin-top: 2rem;
}
.card {
border: none;
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}
.card-body {
padding: 2rem;
}
</style>
50 changes: 5 additions & 45 deletions GameLibrary/Pages/Games/_ReviewsList.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@model IEnumerable<GameLibrary.Models.Review>

@section Styles {
<link rel="stylesheet" href="~/css/Games/_reviewsList.min.css" asp-append-version="true" />
}


<div class="reviews-container">
@if (Model != null && Model.Any())
{
Expand Down Expand Up @@ -48,48 +53,3 @@
</div>
}
</div>

<style>
.reviews-container {
margin-top: 20px;
}
.review-card {
background-color: #f8f9fa;
border-radius: 8px;
padding: 15px;
margin-bottom: 15px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.review-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.review-rating {
color: #ffc107;
}
.review-date {
color: #6c757d;
font-size: 0.9em;
}
.review-content {
color: #212529;
line-height: 1.5;
}
.review-status .badge {
margin-top: 5px;
}
.no-reviews {
text-align: center;
color: #6c757d;
padding: 20px;
}
</style>
Loading

0 comments on commit c566579

Please sign in to comment.