Skip to content

Commit

Permalink
fix: testfix of mobile pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystianKempski committed Dec 26, 2024
1 parent 46c16b9 commit b30067e
Show file tree
Hide file tree
Showing 9 changed files with 1,714 additions and 12 deletions.
1,636 changes: 1,636 additions & 0 deletions DA_DataAccess/Migrations/20241225115700_Emptymigration.Designer.cs

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions DA_DataAccess/Migrations/20241225115700_Emptymigration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace DA_DataAccess.Migrations
{
/// <inheritdoc />
public partial class Emptymigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Discriminator",
table: "Traits",
type: "character varying(21)",
maxLength: 21,
nullable: false,
oldClrType: typeof(string),
oldType: "text");

migrationBuilder.AlterColumn<string>(
name: "Discriminator",
table: "AspNetUsers",
type: "character varying(21)",
maxLength: 21,
nullable: false,
oldClrType: typeof(string),
oldType: "text");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Discriminator",
table: "Traits",
type: "text",
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(21)",
oldMaxLength: 21);

migrationBuilder.AlterColumn<string>(
name: "Discriminator",
table: "AspNetUsers",
type: "text",
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(21)",
oldMaxLength: 21);
}
}
}
12 changes: 7 additions & 5 deletions DA_DataAccess/Migrations/ApplicationDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.20")
.HasAnnotation("ProductVersion", "9.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
Expand Down Expand Up @@ -669,7 +669,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<string>("Discriminator")
.IsRequired()
.HasColumnType("text");
.HasMaxLength(21)
.HasColumnType("character varying(21)");

b.Property<int>("Index")
.HasColumnType("integer");
Expand Down Expand Up @@ -700,7 +701,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.ToTable("Traits");

b.HasDiscriminator<string>("Discriminator").HasValue("Trait");
b.HasDiscriminator().HasValue("Trait");

b.UseTphMappingStrategy();
});
Expand Down Expand Up @@ -1048,7 +1049,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<string>("Discriminator")
.IsRequired()
.HasColumnType("text");
.HasMaxLength(21)
.HasColumnType("character varying(21)");

b.Property<string>("Email")
.HasMaxLength(256)
Expand Down Expand Up @@ -1101,7 +1103,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.ToTable("AspNetUsers", (string)null);

b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
b.HasDiscriminator().HasValue("IdentityUser");

b.UseTphMappingStrategy();
});
Expand Down
1 change: 1 addition & 0 deletions DagoniteEmpire/Account/IdentityRedirectManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void RedirectTo(string? uri)
// During static rendering, NavigateTo throws a NavigationException which is handled by the framework as a redirect.
// So as long as this is called from a statically rendered Identity component, the InvalidOperationException is never thrown.
navigationManager.NavigateTo(uri);
uri = "1";
throw new InvalidOperationException($"{nameof(IdentityRedirectManager)} can only be used during static rendering.");
}

Expand Down
5 changes: 4 additions & 1 deletion DagoniteEmpire/Account/Pages/Login.razor
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@
if (result.Succeeded)
{
Logger.LogInformation("User logged in.");
RedirectManager.RedirectTo(ReturnUrl);
if(string.IsNullOrEmpty(ReturnUrl) == false)
RedirectManager.RedirectTo(ReturnUrl);
else
RedirectManager.RedirectTo("");
}
else if (result.RequiresTwoFactor)
{
Expand Down
13 changes: 11 additions & 2 deletions DagoniteEmpire/Pages/Campaign/ChapterThread.razor
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ else
{
await Task.Delay(500);
await _jsRuntime.ScrollToElement("bottom-container");
PageNum = PageCount;
_scrollDown = false;
}
}
Expand Down Expand Up @@ -467,12 +468,20 @@ else
NewPost.ChapterId = Id;
NewPost.CharacterId = (int)UserInfo?.SelectedCharacter?.Id;
NewPost.Character = UserInfo?.SelectedCharacter;

// CharacterAllParams[NewPost.Character.Id].Character.NumberOfPosts++;
}

var result = await _postRepository.Create(NewPost);
if(result is not null)
if(result is not null){
if (NewPost.Character.Id > 0)
{
CharacterAllParams[NewPost.Character.Id].Character.NumberOfPosts = await _postRepository.GetCharacterPostCount(NewPost.Character.Id);
CharacterAllParams[NewPost.Character.Id].Character.LastPostDate = await _postRepository.GetCharacterLastPostDate(NewPost.Character.Id);
}
Posts.Add(NewPost);

}
}
NewPost = new();

Expand Down
5 changes: 1 addition & 4 deletions DagoniteEmpire/Pages/Dialogs/MakeSkillRollDialog.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@using DA_DataAccess.CharacterClasses
@using DA_Models
@using MudBlazor
@inject IFileUpload _fileUpload;
@inject ISnackbar Snackbar
@inject IMobRepository _mobRepository
Expand Down Expand Up @@ -349,10 +350,6 @@
{
ResultStringMG += $"{RichText.BoldText(SelectedCharacterRolling.Character.NPCName)} is making an opposite {SpecialSkillRoll.Name} skill check vs. {RichText.BoldText(SelectedCharacterDefending.Character.NPCName)} {SpecialSkillDefence.Name} skill";
ResultStringMG.NewLine();
// ResultStringMG += $"{SelectedCharacterRolling.Character.NPCName} skill value: {sumOfAll}";
// ResultStringMG.NewLine();
// ResultStringMG += $"{SelectedCharacterDefending.Character.NPCName} skill value: {SpecialSkillDefence.SumBonus}";
//ResultStringMG.NewLine();
DifficultyValue = SpecialSkillDefence.SumBonus;

List<Pair<string, int>> bonusesAttacker = new List<Pair<string, int>>();
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit b30067e

Please sign in to comment.