diff --git a/JustBigO(Fun).Tests/Controllers/HomeControllerTests.cs b/JustBigO(Fun).Tests/Controllers/HomeControllerTests.cs
index 0a42306..c73d868 100644
--- a/JustBigO(Fun).Tests/Controllers/HomeControllerTests.cs
+++ b/JustBigO(Fun).Tests/Controllers/HomeControllerTests.cs
@@ -25,7 +25,7 @@ public HomeControllerTests()
}
[Fact]
- public async Task Index_ReturnsViewWithProblems()
+ public async Task Problems_ReturnsViewWithProblems()
{
// Arrange
using var db = new ApplicationDbContext(_options);
@@ -44,7 +44,7 @@ public async Task Index_ReturnsViewWithProblems()
};
// Act
- var result = await controller.Index(null, null);
+ var result = await controller.Problems(null, null);
// Assert
var viewResult = Assert.IsType(result);
@@ -53,7 +53,7 @@ public async Task Index_ReturnsViewWithProblems()
}
[Fact]
- public async Task Index_FiltersByDifficulty()
+ public async Task Problems_FiltersByDifficulty()
{
// Arrange
using var db = new ApplicationDbContext(_options);
@@ -72,7 +72,7 @@ public async Task Index_FiltersByDifficulty()
};
// Act
- var result = await controller.Index(null, "Easy");
+ var result = await controller.Problems(null, "Easy");
// Assert
var viewResult = Assert.IsType(result);
diff --git a/JustBigO(Fun)/Controllers/HomeController.cs b/JustBigO(Fun)/Controllers/HomeController.cs
index 2fa0712..3d92f70 100644
--- a/JustBigO(Fun)/Controllers/HomeController.cs
+++ b/JustBigO(Fun)/Controllers/HomeController.cs
@@ -24,9 +24,18 @@ public HomeController(ILogger logger, ApplicationDbContext db, I
_markdown = markdown;
}
- // --- INCEPUT MODIFICARE ---
- // Am adăugat parametrul `difficultyFilter` și am implementat logica de filtrare `.Where(...)`
- public async Task Index(string sortOrder, string difficultyFilter)
+ public IActionResult Index()
+ {
+ return View();
+ }
+
+ public async Task Problems(string sortOrder, string difficultyFilter)
+ {
+ var problemItems = await BuildProblemListAsync(sortOrder, difficultyFilter);
+ return View(problemItems);
+ }
+
+ private async Task> BuildProblemListAsync(string sortOrder, string difficultyFilter)
{
// Salvăm parametrii în ViewData pentru a menține starea în butoanele de pe UI
ViewData["DifficultySortParm"] = sortOrder == "diff_asc" ? "diff_desc" : "diff_asc";
@@ -76,7 +85,7 @@ public async Task Index(string sortOrder, string difficultyFilter
_ => problemItems.OrderBy(p => problems.First(x => x.Id == p.Id).OrderIndex)
};
- return View(problemItems.ToList());
+ return problemItems.ToList();
}
private static int GetDifficultyWeight(string difficulty)
@@ -89,8 +98,6 @@ private static int GetDifficultyWeight(string difficulty)
_ => 0
};
}
- // --- SFARSIT MODIFICARE ---
-
public async Task Solve(int? id)
{
Problem? problem;
diff --git a/JustBigO(Fun)/JustBigO(Fun).csproj b/JustBigO(Fun)/JustBigO(Fun).csproj
index fbfdd4c..906bd03 100644
--- a/JustBigO(Fun)/JustBigO(Fun).csproj
+++ b/JustBigO(Fun)/JustBigO(Fun).csproj
@@ -25,6 +25,7 @@
+
diff --git a/JustBigO(Fun)/Services/HtmlSanitizerService.cs b/JustBigO(Fun)/Services/HtmlSanitizerService.cs
index fdfbfb6..21924e2 100644
--- a/JustBigO(Fun)/Services/HtmlSanitizerService.cs
+++ b/JustBigO(Fun)/Services/HtmlSanitizerService.cs
@@ -1,3 +1,8 @@
+// To fix CS0246, you must add a reference to the Ganss.Xss NuGet package.
+// In Visual Studio, right-click your project > Manage NuGet Packages > Browse > search for "Ganss.Xss" > Install.
+// Or, run the following command in the Package Manager Console:
+// Install-Package Ganss.Xss
+
using Ganss.Xss;
namespace JustBigO_Fun_.Services;
diff --git a/JustBigO(Fun)/Views/Home/Index.cshtml b/JustBigO(Fun)/Views/Home/Index.cshtml
index 246398f..2d2c963 100644
--- a/JustBigO(Fun)/Views/Home/Index.cshtml
+++ b/JustBigO(Fun)/Views/Home/Index.cshtml
@@ -1,7 +1,5 @@
-@model IEnumerable
@{
- ViewData["Title"] = "Dashboard";
- string GetDifficultyClass(string d) => d?.ToLowerInvariant() switch { "medium" => "medium", "hard" => "hard", _ => "easy" };
+ ViewData["Title"] = "Home";
}
@@ -25,7 +23,7 @@
and get instant feedback from smart agents on complexity, transpilations, and hints.
-
+
-
-
-
-
-
- | Problem |
- Tags |
-
-
- Difficulty ↕
-
- |
- Best status |
-
-
-
- @foreach (var p in Model ?? Enumerable.Empty())
- {
-
-
- | @p.Title |
- @p.Tags |
- @p.Difficulty |
-
-
- @{
- string statusClass = "";
- if (p.BestStatus == "Accepted") statusClass = "jbo-status-chip--accepted";
- else if (p.BestStatus == "TimeLimitExceeded") statusClass = "jbo-status-chip--tle";
- else if (p.BestStatus != "—") statusClass = "jbo-status-chip--wa";
- }
- @p.BestStatus
- |
-
- }
-
-
-
-
-