diff --git a/SessionCompanion/SessionCompanion.Database/Migrations/20201228114303_Class name fix.Designer.cs b/SessionCompanion/SessionCompanion.Database/Migrations/20201228114303_Class name fix.Designer.cs new file mode 100644 index 0000000..7bbd955 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Migrations/20201228114303_Class name fix.Designer.cs @@ -0,0 +1,838 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using SessionCompanion.Database; + +namespace SessionCompanion.Database.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20201228114303_Class name fix")] + partial class Classnamefix + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseIdentityColumns() + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.0"); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.HasKey("Id"); + + b.ToTable("Alignments"); + + b.HasData( + new + { + Id = 1 + }, + new + { + Id = 2 + }, + new + { + Id = 3 + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.HasKey("Id"); + + b.ToTable("Backgrounds"); + + b.HasData( + new + { + Id = 1 + }, + new + { + Id = 2 + }, + new + { + Id = 3 + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("AlignmentId") + .HasColumnType("int"); + + b.Property("BackgroundId") + .HasColumnType("int"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("ClassId") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("RaceId") + .HasColumnType("int"); + + b.Property("Sex") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AlignmentId"); + + b.HasIndex("BackgroundId"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.HasIndex("ClassId"); + + b.HasIndex("RaceId"); + + b.ToTable("Biographies"); + + b.HasData( + new + { + Id = 1, + AlignmentId = 1, + BackgroundId = 1, + CharacterId = 1, + ClassId = 1, + Name = "Bob", + RaceId = 1, + Sex = "Male" + }, + new + { + Id = 2, + AlignmentId = 2, + BackgroundId = 2, + CharacterId = 2, + ClassId = 2, + Name = "Queen Daenerys Stormborn of the House Targaryen, the First of Her Name, Queen of the Andals, the Rhoynar and the First Men, Lady of the Seven Kingdoms and Protector of the Realm, Lady of Dragonstone, Queen of Meereen, Khaleesi of the Great Grass Sea, the Unburnt, Breaker of Chains and Mother of Dragons.", + RaceId = 2, + Sex = "Female" + }, + new + { + Id = 3, + AlignmentId = 3, + BackgroundId = 3, + CharacterId = 3, + ClassId = 3, + Name = "Gandalf the White", + RaceId = 3, + Sex = "Both" + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Characters"); + + b.HasData( + new + { + Id = 1, + UserId = 1 + }, + new + { + Id = 2, + UserId = 2 + }, + new + { + Id = 3, + UserId = 3 + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("CanDeception") + .HasColumnType("bit"); + + b.Property("CanIntimidation") + .HasColumnType("bit"); + + b.Property("CanPerformance") + .HasColumnType("bit"); + + b.Property("CanPersuasion") + .HasColumnType("bit"); + + b.Property("CanSaveThrows") + .HasColumnType("bit"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("Deception") + .HasColumnType("int"); + + b.Property("Intimidation") + .HasColumnType("int"); + + b.Property("Modification") + .HasColumnType("int"); + + b.Property("Performance") + .HasColumnType("int"); + + b.Property("Persuasion") + .HasColumnType("int"); + + b.Property("SavingThrows") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.ToTable("Charismas"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Classes"); + + b.HasData( + new + { + Id = 1, + Name = "Fighter" + }, + new + { + Id = 2, + Name = "Paladin" + }, + new + { + Id = 3, + Name = "Cleric" + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("CanSaveThrows") + .HasColumnType("bit"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("Modification") + .HasColumnType("int"); + + b.Property("SavingThrows") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.ToTable("Constitutions"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Acrobatics") + .HasColumnType("int"); + + b.Property("CanAcrobatics") + .HasColumnType("bit"); + + b.Property("CanSaveThrows") + .HasColumnType("bit"); + + b.Property("CanSleightOfHand") + .HasColumnType("bit"); + + b.Property("CanStealth") + .HasColumnType("bit"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("Modification") + .HasColumnType("int"); + + b.Property("SavingThrows") + .HasColumnType("int"); + + b.Property("SleightOfHand") + .HasColumnType("int"); + + b.Property("Stealth") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.ToTable("Dexterities"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Arcana") + .HasColumnType("int"); + + b.Property("CanArcana") + .HasColumnType("bit"); + + b.Property("CanHistory") + .HasColumnType("bit"); + + b.Property("CanInvestigation") + .HasColumnType("bit"); + + b.Property("CanNature") + .HasColumnType("bit"); + + b.Property("CanReligion") + .HasColumnType("bit"); + + b.Property("CanSaveThrows") + .HasColumnType("bit"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("History") + .HasColumnType("int"); + + b.Property("Investigation") + .HasColumnType("int"); + + b.Property("Modification") + .HasColumnType("int"); + + b.Property("Nature") + .HasColumnType("int"); + + b.Property("Religion") + .HasColumnType("int"); + + b.Property("SavingThrows") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.ToTable("Intelligences"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Races"); + + b.HasData( + new + { + Id = 1, + Name = "Human" + }, + new + { + Id = 2, + Name = "Dwarf" + }, + new + { + Id = 3, + Name = "Elf" + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("ArmorClass") + .HasColumnType("int"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("CurrentHealthPoints") + .HasColumnType("int"); + + b.Property("ExperiencePoints") + .HasColumnType("int"); + + b.Property("HealthPoints") + .HasColumnType("int"); + + b.Property("Initiative") + .HasColumnType("int"); + + b.Property("Level") + .HasColumnType("int"); + + b.Property("Proficiency") + .HasColumnType("int"); + + b.Property("Speed") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.ToTable("Statistics"); + + b.HasData( + new + { + Id = 1, + ArmorClass = 9, + CharacterId = 1, + CurrentHealthPoints = 18, + ExperiencePoints = 2, + HealthPoints = 20, + Initiative = 12, + Level = 1, + Proficiency = 1, + Speed = 5 + }, + new + { + Id = 2, + ArmorClass = 12, + CharacterId = 2, + CurrentHealthPoints = 26, + ExperiencePoints = 0, + HealthPoints = 26, + Initiative = 7, + Level = 1, + Proficiency = 1, + Speed = 10 + }, + new + { + Id = 3, + ArmorClass = 2, + CharacterId = 3, + CurrentHealthPoints = 7, + ExperiencePoints = 24, + HealthPoints = 7, + Initiative = 18, + Level = 1, + Proficiency = 2, + Speed = 15 + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Athletics") + .HasColumnType("int"); + + b.Property("CanAthletics") + .HasColumnType("bit"); + + b.Property("CanSaveThrows") + .HasColumnType("bit"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("Modification") + .HasColumnType("int"); + + b.Property("SavingThrows") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.ToTable("Strengths"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("Password") + .HasColumnType("nvarchar(max)"); + + b.Property("Username") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Users"); + + b.HasData( + new + { + Id = 1, + Password = "123", + Username = "Morwiec" + }, + new + { + Id = 2, + Password = "123", + Username = "Cichoklepiec" + }, + new + { + Id = 3, + Password = "123", + Username = "Ruletka" + }); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Wisdom", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .UseIdentityColumn(); + + b.Property("AnimalHandling") + .HasColumnType("int"); + + b.Property("CanAnimalHandling") + .HasColumnType("bit"); + + b.Property("CanInsight") + .HasColumnType("bit"); + + b.Property("CanMedicine") + .HasColumnType("bit"); + + b.Property("CanPerception") + .HasColumnType("bit"); + + b.Property("CanSaveThrows") + .HasColumnType("bit"); + + b.Property("CanSurvival") + .HasColumnType("bit"); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("Insight") + .HasColumnType("int"); + + b.Property("Medicine") + .HasColumnType("int"); + + b.Property("Modification") + .HasColumnType("int"); + + b.Property("Perception") + .HasColumnType("int"); + + b.Property("SavingThrows") + .HasColumnType("int"); + + b.Property("Survival") + .HasColumnType("int"); + + b.Property("Value") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CharacterId") + .IsUnique(); + + b.ToTable("Wisdoms"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Biography", b => + { + b.HasOne("SessionCompanion.Database.Tables.Alignment", "Alignment") + .WithMany("Biography") + .HasForeignKey("AlignmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Background", "Background") + .WithMany("Biography") + .HasForeignKey("BackgroundId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Biography") + .HasForeignKey("SessionCompanion.Database.Tables.Biography", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Class", "Class") + .WithMany("Biography") + .HasForeignKey("ClassId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SessionCompanion.Database.Tables.Race", "Race") + .WithMany("Biography") + .HasForeignKey("RaceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alignment"); + + b.Navigation("Background"); + + b.Navigation("Character"); + + b.Navigation("Class"); + + b.Navigation("Race"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => + { + b.HasOne("SessionCompanion.Database.Tables.User", "User") + .WithMany("Character") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Charisma", b => + { + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Charisma") + .HasForeignKey("SessionCompanion.Database.Tables.Charisma", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Constitution", b => + { + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Constitution") + .HasForeignKey("SessionCompanion.Database.Tables.Constitution", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Dexterity", b => + { + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Dexterity") + .HasForeignKey("SessionCompanion.Database.Tables.Dexterity", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Intelligence", b => + { + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Intelligence") + .HasForeignKey("SessionCompanion.Database.Tables.Intelligence", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Statistics", b => + { + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Statistics") + .HasForeignKey("SessionCompanion.Database.Tables.Statistics", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Strength", b => + { + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Strength") + .HasForeignKey("SessionCompanion.Database.Tables.Strength", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Wisdom", b => + { + b.HasOne("SessionCompanion.Database.Tables.Character", "Character") + .WithOne("Wisdom") + .HasForeignKey("SessionCompanion.Database.Tables.Wisdom", "CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Alignment", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Background", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Character", b => + { + b.Navigation("Biography"); + + b.Navigation("Charisma"); + + b.Navigation("Constitution"); + + b.Navigation("Dexterity"); + + b.Navigation("Intelligence"); + + b.Navigation("Statistics"); + + b.Navigation("Strength"); + + b.Navigation("Wisdom"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Class", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.Race", b => + { + b.Navigation("Biography"); + }); + + modelBuilder.Entity("SessionCompanion.Database.Tables.User", b => + { + b.Navigation("Character"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/Migrations/20201228114303_Class name fix.cs b/SessionCompanion/SessionCompanion.Database/Migrations/20201228114303_Class name fix.cs new file mode 100644 index 0000000..c0633fa --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Migrations/20201228114303_Class name fix.cs @@ -0,0 +1,55 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace SessionCompanion.Database.Migrations +{ + public partial class Classnamefix : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Classes", + keyColumn: "Id", + keyValue: 1, + column: "Name", + value: "Fighter"); + + migrationBuilder.UpdateData( + table: "Classes", + keyColumn: "Id", + keyValue: 2, + column: "Name", + value: "Paladin"); + + migrationBuilder.UpdateData( + table: "Classes", + keyColumn: "Id", + keyValue: 3, + column: "Name", + value: "Cleric"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Classes", + keyColumn: "Id", + keyValue: 1, + column: "Name", + value: "Warrior"); + + migrationBuilder.UpdateData( + table: "Classes", + keyColumn: "Id", + keyValue: 2, + column: "Name", + value: "Knight"); + + migrationBuilder.UpdateData( + table: "Classes", + keyColumn: "Id", + keyValue: 3, + column: "Name", + value: "Priest"); + } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/Migrations/ApplicationDbContextModelSnapshot.cs b/SessionCompanion/SessionCompanion.Database/Migrations/ApplicationDbContextModelSnapshot.cs index 7898310..e4915a1 100644 --- a/SessionCompanion/SessionCompanion.Database/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/SessionCompanion/SessionCompanion.Database/Migrations/ApplicationDbContextModelSnapshot.cs @@ -255,17 +255,17 @@ namespace SessionCompanion.Database.Migrations new { Id = 1, - Name = "Warrior" + Name = "Fighter" }, new { Id = 2, - Name = "Knight" + Name = "Paladin" }, new { Id = 3, - Name = "Priest" + Name = "Cleric" }); }); diff --git a/SessionCompanion/SessionCompanion.Database/SeedData.cs b/SessionCompanion/SessionCompanion.Database/SeedData.cs index 81a9f5e..38fda48 100644 --- a/SessionCompanion/SessionCompanion.Database/SeedData.cs +++ b/SessionCompanion/SessionCompanion.Database/SeedData.cs @@ -66,17 +66,17 @@ namespace SessionCompanion.Database new Class { Id = 1, - Name = "Warrior" + Name = "Fighter" }, new Class { Id = 2, - Name = "Knight" + Name = "Paladin" }, new Class { Id = 3, - Name = "Priest" + Name = "Cleric" } }; return classes; diff --git a/SessionCompanion/SessionCompanion.Services/Profiles/CharacterProfile.cs b/SessionCompanion/SessionCompanion.Services/Profiles/CharacterProfile.cs index 7f1417b..0262a5f 100644 --- a/SessionCompanion/SessionCompanion.Services/Profiles/CharacterProfile.cs +++ b/SessionCompanion/SessionCompanion.Services/Profiles/CharacterProfile.cs @@ -23,7 +23,8 @@ namespace SessionCompanion.Services.Profiles CreateMap() .ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name)) .ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level)) - .ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints)).ReverseMap(); + .ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints)) + .ForMember(vm => vm.Class, conf => conf.MapFrom(charact => charact.Biography.Class.Name)).ReverseMap(); } } } diff --git a/SessionCompanion/SessionCompanion.Services/Services/CharacterService.cs b/SessionCompanion/SessionCompanion.Services/Services/CharacterService.cs index a336d42..a07f53c 100644 --- a/SessionCompanion/SessionCompanion.Services/Services/CharacterService.cs +++ b/SessionCompanion/SessionCompanion.Services/Services/CharacterService.cs @@ -46,6 +46,7 @@ namespace SessionCompanion.Services.Services { var characters = await Repository.Get(c => charactersId.Contains(c.Id)) .Include(x => x.Biography) + .ThenInclude(x => x.Class) .Include(x => x.Statistics).ToListAsync(); var result = Mapper.Map>(characters); return result; diff --git a/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterBasicStatsViewModel.cs b/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterBasicStatsViewModel.cs index 525419f..adbfafd 100644 --- a/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterBasicStatsViewModel.cs +++ b/SessionCompanion/SessionCompanion.ViewModels/CharacterViewModels/CharacterBasicStatsViewModel.cs @@ -21,5 +21,10 @@ /// Aktualna ilość życia postaci /// public int CurrentHealthPoints { get; set; } + + /// + /// Klasa postaci + /// + public string Class { get; set; } } } diff --git a/SessionCompanion/SessionCompanion.ViewModels/SessionCompanion.ViewModels.xml b/SessionCompanion/SessionCompanion.ViewModels/SessionCompanion.ViewModels.xml index 71e048b..20c6929 100644 --- a/SessionCompanion/SessionCompanion.ViewModels/SessionCompanion.ViewModels.xml +++ b/SessionCompanion/SessionCompanion.ViewModels/SessionCompanion.ViewModels.xml @@ -100,6 +100,11 @@ Aktualna ilość życia postaci + + + Klasa postaci + + Identyfikator postaci diff --git a/SessionCompanion/SessionCompanion/ClientApp/.prettierrc b/SessionCompanion/SessionCompanion/ClientApp/.prettierrc new file mode 100644 index 0000000..544138b --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/package-lock.json b/SessionCompanion/SessionCompanion/ClientApp/package-lock.json index a4391a2..d012404 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/package-lock.json +++ b/SessionCompanion/SessionCompanion/ClientApp/package-lock.json @@ -2976,12 +2976,6 @@ "integrity": "sha512-JNbGaHFCLwgHn/iCckiGSOZ1XYHsKFwREtzPwSGCVld1SGhOlmZw2D4ZI94HQCrBHbADzW9m4LER/8olJTRGHA==", "dev": true }, - "@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", - "dev": true - }, "@types/q": { "version": "0.0.32", "resolved": "https://registry.npmjs.org/@types/q/-/q-0.0.32.tgz", @@ -3880,12 +3874,6 @@ "multicast-dns-service-types": "^1.1.0" } }, - "boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", - "dev": true - }, "bootstrap": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.4.1.tgz", @@ -4321,12 +4309,6 @@ "restore-cursor": "^3.1.0" } }, - "cli-spinners": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.5.0.tgz", - "integrity": "sha512-PC+AmIuK04E6aeSs/pUccSujsTzBhu4HzC2dL+CfJB/Jcc2qTRbEwZQDfIUpt2Xl8BodYBEq8w4fc0kU2I9DjQ==", - "dev": true - }, "cli-width": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.1.tgz", @@ -4361,54 +4343,6 @@ "shallow-clone": "^3.0.0" } }, - "coa": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/coa/-/coa-2.0.2.tgz", - "integrity": "sha512-q5/jG+YQnSy4nRTV4F7lPepBJZ8qBNJJDBuJdoejDyLXgmL7IEo+Le2JDZudFTFt7mrCqIRaSjws4ygRCTCAXA==", - "dev": true, - "requires": { - "@types/q": "^1.5.1", - "chalk": "^2.4.1", - "q": "^1.1.2" - }, - "dependencies": { - "@types/q": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz", - "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -4947,24 +4881,6 @@ "integrity": "sha1-Mh9s9zeCpv91ERE5D8BeLGV9jJs=", "dev": true }, - "css-select": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-2.1.0.tgz", - "integrity": "sha512-Dqk7LQKpwLoH3VovzZnkzegqNSuAziQyNZUcrdDM401iY+R5NkGBXGmtO05/yaXQziALuPogeG0b7UAgjnTJTQ==", - "dev": true, - "requires": { - "boolbase": "^1.0.0", - "css-what": "^3.2.1", - "domutils": "^1.7.0", - "nth-check": "^1.0.2" - } - }, - "css-select-base-adapter": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz", - "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==", - "dev": true - }, "css-selector-tokenizer": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.1.tgz", @@ -5016,30 +4932,6 @@ } } }, - "css-tree": { - "version": "1.0.0-alpha.37", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz", - "integrity": "sha512-DMxWJg0rnz7UgxKT0Q1HU/L9BeJI0M6ksor0OgqOnF+aRCDWg/N2641HmVyU9KVIu0OVVWOb2IpC9A+BJRnejg==", - "dev": true, - "requires": { - "mdn-data": "2.0.4", - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "css-what": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-3.4.2.tgz", - "integrity": "sha512-ACUm3L0/jiZTqfzRM3Hi9Q8eZqd6IK37mMWPLz9PJxkLWllYeRf+EHUSHYEtFop2Eqytaq1FizFVh7XfBnXCDQ==", - "dev": true - }, "cssauron": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/cssauron/-/cssauron-1.4.0.tgz", @@ -5049,39 +4941,6 @@ "through": "X.X.X" } }, - "csso": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/csso/-/csso-4.2.0.tgz", - "integrity": "sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==", - "dev": true, - "requires": { - "css-tree": "^1.1.2" - }, - "dependencies": { - "css-tree": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.1.2.tgz", - "integrity": "sha512-wCoWush5Aeo48GLhfHPbmvZs59Z+M7k5+B1xDnXbdWNcEF423DoFdqSWE0PM5aNk5nI5cp1q7ms36zGApY/sKQ==", - "dev": true, - "requires": { - "mdn-data": "2.0.14", - "source-map": "^0.6.1" - } - }, - "mdn-data": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.14.tgz", - "integrity": "sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, "currently-unhandled": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", @@ -5189,23 +5048,6 @@ } } }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "dev": true, - "requires": { - "clone": "^1.0.2" - }, - "dependencies": { - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - } - } - }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -5412,24 +5254,6 @@ "void-elements": "^2.0.0" } }, - "dom-serializer": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", - "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", - "dev": true, - "requires": { - "domelementtype": "^2.0.1", - "entities": "^2.0.0" - }, - "dependencies": { - "domelementtype": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz", - "integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w==", - "dev": true - } - } - }, "domain-browser": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", @@ -5451,27 +5275,11 @@ "isomorphic-fetch": "^2.2.1" } }, - "domelementtype": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.1.tgz", - "integrity": "sha512-BSKB+TSpMpFI/HOxCNr1O8aMOTZ8hT3pM3GQ0w/mWRmkhEDSFJkkyzz4XQsBV44BChwGkrDfMyjVD0eA2aFV3w==", - "dev": true - }, "domino": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/domino/-/domino-2.1.4.tgz", "integrity": "sha512-l70mlQ7IjPKC8kT7GljQXJZmt5OqFL+RE91ik5y5WWQtsd9wP8R7gpFnNu96fK5MqAAZRXfLLsnzKtkty5fWGQ==" }, - "domutils": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.7.0.tgz", - "integrity": "sha512-Lgd2XcJ/NjEw+7tFvfKxOzCYKZsdct5lczQ2ZaQY8Djz7pfAD3Gbp8ySJWtreII/vDlMVmxwa6pHmdxIYgttDg==", - "dev": true, - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, "duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", @@ -5685,12 +5493,6 @@ "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", "dev": true }, - "entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", - "dev": true - }, "err-code": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/err-code/-/err-code-1.1.2.tgz", @@ -7375,12 +7177,6 @@ "is-extglob": "^2.1.1" } }, - "is-interactive": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", - "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", - "dev": true - }, "is-negative-zero": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", @@ -8240,12 +8036,6 @@ "immediate": "~3.0.5" } }, - "lines-and-columns": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", - "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", - "dev": true - }, "load-json-file": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", @@ -8297,90 +8087,12 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, - "lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", - "dev": true - }, "lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", "dev": true }, - "lodash.kebabcase": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", - "integrity": "sha1-hImxyw0p/4gZXM7KRI/21swpXDY=", - "dev": true - }, - "lodash.snakecase": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz", - "integrity": "sha1-OdcUo1NXFHg3rv1ktdy7Fr7Nj40=", - "dev": true - }, - "log-symbols": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", - "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", - "dev": true, - "requires": { - "chalk": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "log4js": { "version": "4.5.1", "resolved": "https://registry.npmjs.org/log4js/-/log4js-4.5.1.tgz", @@ -8555,12 +8267,6 @@ "safe-buffer": "^5.1.2" } }, - "mdn-data": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.4.tgz", - "integrity": "sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA==", - "dev": true - }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -9248,15 +8954,6 @@ "set-blocking": "~2.0.0" } }, - "nth-check": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", - "integrity": "sha512-WeBOdju8SnzPN5vTUJYxYUxLeXpCaVP5i5e0LF8fg7WORF2Wd7wFX/pk0tYZk7s8T+J7VLy0Da6J1+wCT0AtHg==", - "dev": true, - "requires": { - "boolbase": "~1.0.0" - } - }, "num2fraction": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", @@ -9454,73 +9151,6 @@ "isobject": "^3.0.1" } }, - "object.values": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.2.tgz", - "integrity": "sha512-MYC0jvJopr8EK6dPBiO8Nb9mvjdypOachO5REGk6MXzujbBrAisKo3HmdEI6kZDL6fC31Mwee/5YbtMebixeag==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1", - "has": "^1.0.3" - }, - "dependencies": { - "es-abstract": { - "version": "1.18.0-next.1", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.1.tgz", - "integrity": "sha512-I4UGspA0wpZXWENrdA0uHbnhte683t3qT/1VFH9aX2dA5PPSf6QW5HHXf5HImaqPmjXaVeVk4RGWnaylmV7uAA==", - "dev": true, - "requires": { - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1", - "is-callable": "^1.2.2", - "is-negative-zero": "^2.0.0", - "is-regex": "^1.1.1", - "object-inspect": "^1.8.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.1", - "string.prototype.trimend": "^1.0.1", - "string.prototype.trimstart": "^1.0.1" - } - }, - "is-callable": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.2.tgz", - "integrity": "sha512-dnMqspv5nU3LoewK2N/y7KLtxtakvTuaCsU9FU50/QDmdbHNy/4/JuRtMHqRU22o3q+W89YQndQEeCVwK+3qrA==", - "dev": true - }, - "is-regex": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", - "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", - "dev": true, - "requires": { - "has-symbols": "^1.0.1" - } - }, - "object-inspect": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", - "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", - "dev": true - }, - "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - } - } - }, "obuf": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", @@ -9595,88 +9225,6 @@ "is-wsl": "^1.1.0" } }, - "ora": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ora/-/ora-5.1.0.tgz", - "integrity": "sha512-9tXIMPvjZ7hPTbk8DFq1f7Kow/HU/pQYB60JbNq+QnGwcyhWVZaQ4hM9zQDEsPxw/muLpgiHSaumUZxCAmod/w==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-spinners": "^2.4.0", - "is-interactive": "^1.0.0", - "log-symbols": "^4.0.0", - "mute-stream": "0.0.8", - "strip-ansi": "^6.0.0", - "wcwidth": "^1.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "original": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/original/-/original-1.0.2.tgz", @@ -9865,23 +9413,6 @@ "readable-stream": "^2.1.5" } }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "requires": { - "callsites": "^3.0.0" - }, - "dependencies": { - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true - } - } - }, "parse-asn1": { "version": "5.1.5", "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", @@ -10217,9 +9748,9 @@ "dev": true }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", "dev": true }, "private": { @@ -10526,7 +10057,8 @@ "q": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/q/-/q-1.4.1.tgz", - "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=" + "integrity": "sha1-VXBbzZPF82c1MMLCy8DCs63cKG4=", + "optional": true }, "qjobs": { "version": "1.2.0", @@ -11077,7 +10609,8 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "optional": true }, "schema-utils": { "version": "1.0.0", @@ -11923,12 +11456,6 @@ "figgy-pudding": "^3.5.1" } }, - "stable": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", - "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", - "dev": true - }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", @@ -12208,187 +11735,6 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "optional": true }, - "svg-to-ts": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/svg-to-ts/-/svg-to-ts-6.0.0.tgz", - "integrity": "sha512-QdznpIJfuTjP//zY007BhOYAe4ZOII1XviNgmvhgfEnl6MxTyLJWL20JgECvjGJHD+F8DqKOnt7YU7UmUFD6LQ==", - "dev": true, - "requires": { - "chalk": "^3.0.0", - "commander": "^4.0.1", - "cosmiconfig": "^6.0.0", - "glob": "^7.1.6", - "lodash.camelcase": "^4.3.0", - "lodash.kebabcase": "^4.1.1", - "lodash.snakecase": "^4.1.1", - "ora": "^5.1.0", - "prettier": "^1.19.1", - "svgo": "^1.3.2", - "typescript": "^3.7.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "commander": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", - "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", - "dev": true - }, - "cosmiconfig": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", - "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", - "dev": true, - "requires": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.1.0", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.7.2" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "parse-json": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.1.0.tgz", - "integrity": "sha512-+mi/lmVVNKFNVyLXV31ERiy2CY5E1/F6QtJFEzoChPRwwngMNXRDQ9GJ5WdE2Z2P4AujsOi0/+2qHID68KwfIQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "typescript": { - "version": "3.9.7", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", - "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", - "dev": true - } - } - }, - "svgo": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.3.2.tgz", - "integrity": "sha512-yhy/sQYxR5BkC98CY7o31VGsg014AKLEPxdfhora76l36hD9Rdy5NZA/Ocn6yayNPgSamYdtX2rFJdcv07AYVw==", - "dev": true, - "requires": { - "chalk": "^2.4.1", - "coa": "^2.0.2", - "css-select": "^2.0.0", - "css-select-base-adapter": "^0.1.1", - "css-tree": "1.0.0-alpha.37", - "csso": "^4.0.2", - "js-yaml": "^3.13.1", - "mkdirp": "~0.5.1", - "object.values": "^1.1.0", - "sax": "~1.2.4", - "stable": "^0.1.8", - "unquote": "~1.1.1", - "util.promisify": "~1.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, "symbol-observable": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", @@ -12700,6 +12046,12 @@ } } }, + "tslint-config-prettier": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz", + "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", + "dev": true + }, "tsutils": { "version": "2.29.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", @@ -12860,12 +12212,6 @@ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", "dev": true }, - "unquote": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", - "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=", - "dev": true - }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -12990,18 +12336,6 @@ "object.getownpropertydescriptors": "^2.0.3" } }, - "util.promisify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.1.tgz", - "integrity": "sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==", - "dev": true, - "requires": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.2", - "has-symbols": "^1.0.1", - "object.getownpropertydescriptors": "^2.1.0" - } - }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -13766,15 +13100,6 @@ "minimalistic-assert": "^1.0.0" } }, - "wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", - "dev": true, - "requires": { - "defaults": "^1.0.3" - } - }, "webdriver-js-extender": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/webdriver-js-extender/-/webdriver-js-extender-2.1.0.tgz", @@ -14992,12 +14317,6 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "optional": true }, - "yaml": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz", - "integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==", - "dev": true - }, "yargs": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-7.1.0.tgz", diff --git a/SessionCompanion/SessionCompanion/ClientApp/package.json b/SessionCompanion/SessionCompanion/ClientApp/package.json index 35cdd9e..5e89112 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/package.json +++ b/SessionCompanion/SessionCompanion/ClientApp/package.json @@ -6,23 +6,10 @@ "start": "ng serve", "build": "ng build", "build:ssr": "ng run SessionCompanion:server:dev", - "generate-icons": "svg-to-ts", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, - "svg-to-ts": { - "conversionType": "constants", - "srcFiles": [ - "./src/app/shared/sc-icons/icons/**/*.svg" - ], - "outputDirectory": "./src/app/shared/sc-icons/icons", - "interfaceName": "SessionCompanionIcon", - "typeName": "scIcon", - "prefix": "scIcon", - "fileName": "sc-icon.model", - "compileSources": true - }, "private": true, "dependencies": { "@angular/animations": "8.2.12", @@ -66,7 +53,7 @@ "karma-coverage-istanbul-reporter": "~2.1.0", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.2", - "svg-to-ts": "^6.0.0", + "prettier": "2.2.1", "typescript": "3.5.3" }, "optionalDependencies": { diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.component.ts index b7b309e..96d886d 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.component.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.component.ts @@ -1,9 +1,17 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {SessionCompanionIconsRegistry} from './shared/sc-icons/session-companion-icons-registry.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html' }) -export class AppComponent { +export class AppComponent implements OnInit{ title = 'Session Companion'; + + constructor(private iconService: SessionCompanionIconsRegistry) { + } + + ngOnInit() { + this.iconService.registerIcons(); + } } diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts index 9a1d8a8..29d4a9b 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts @@ -24,9 +24,8 @@ import {UserService} from '../services/user.service'; import { StoreModule } from '@ngrx/store'; import { StoreDevtoolsModule } from '@ngrx/store-devtools'; import {environment} from '../environments/environment'; -import {SessionCompanionIconsModule} from './shared/sc-icons/session-companion-icons.module'; import {reducers} from './store/models/app-state.model'; -import {CharacterService} from "../services/character.service"; +import {CharacterService} from '../services/character.service'; @NgModule({ declarations: [ @@ -55,7 +54,6 @@ BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }), MatSidenavModule, MatToolbarModule, MatListModule, - SessionCompanionIconsModule, StoreModule.forRoot(reducers), StoreDevtoolsModule.instrument({ logOnly: environment.production diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.html index 6b72c96..34918b5 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.html +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.html @@ -1,56 +1,96 @@ -
- - -
- -
- - - - folder - Link 1 - - - folder - Link 2 - - - folder - Link 3 - - -
- - - SessionCompanion - - - -
- - -
- - - - folder - Link 1 - - - folder - Link 2 - - - folder - Link 3 - - -
-
+
+ + +
+ +
+ + + + folder + Link 1 + + + folder + Link 2 + + + folder + Link 3 + + +
+ + + SessionCompanion + + + +
+ + +
+ + + + + {{ + loggedCharacter.name.length > 12 + ? (loggedCharacter.name | slice: 0:12) + '..' + : loggedCharacter.name + }} + + +
+
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts index 1b303b8..d93a20e 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts @@ -1,20 +1,37 @@ -import {Component, OnInit} from '@angular/core'; -import {animateText, onSideNavChange} from '../../shared/animations/sidenav-animations'; -import {GMSignalRService} from '../../shared/signalR-service/gm-signalR.service'; +import { Component, OnDestroy, OnInit } from '@angular/core'; +import { + animateText, + onSideNavChange, +} from '../../shared/animations/sidenav-animations'; +import { GMSignalRService } from '../../shared/signalR-service/gm-signalR.service'; +import { CharacterService } from '../../../services/character.service'; +import { Subscription } from 'rxjs'; +import { ErrorResponse } from '../../../types/ErrorResponse'; +import { HttpErrorResponse } from '@angular/common/http'; +import { LoggedCharactersViewModel } from '../../../types/viewmodels/character-viewmodels/LoggedCharactersViewModel'; +import { first } from 'rxjs/operators'; @Component({ selector: 'app-game-master-dashboard', templateUrl: './game-master-dashboard.component.html', styleUrls: ['./game-master-dashboard.component.css'], - animations: [onSideNavChange, animateText] + animations: [onSideNavChange, animateText], }) -export class GameMasterDashboardComponent implements OnInit { +export class GameMasterDashboardComponent implements OnInit, OnDestroy { + allSubscriptions = new Subscription(); leftSidenavExpanded = false; leftSidenavTextExpanded = false; rightSidenavExpanded = false; rightSidenavTextExpanded = false; - constructor(private signalRService: GMSignalRService) {} + loggedCharacters: LoggedCharactersViewModel[]; + + constructor( + private signalRService: GMSignalRService, + private characterService: CharacterService + ) { + this.SubscribeToEvents(); + } ngOnInit() { this.signalRService.Login(); @@ -36,4 +53,36 @@ export class GameMasterDashboardComponent implements OnInit { break; } } + + UpdateCharactersList(): void { + this.characterService + .getLoggedCharacters() + .pipe(first()) + .subscribe( + (success) => { + this.loggedCharacters = success; + }, + (error: ErrorResponse | HttpErrorResponse) => { + if (error instanceof HttpErrorResponse) { + error = error.error as ErrorResponse; + } + console.error(error.message); + } + ); + } + + private SubscribeToEvents(): void { + this.signalRService.message.subscribe((message: string) => { + if ( + message === 'New player connected' || + message === 'Player disconnected' + ) { + this.UpdateCharactersList(); + } + }); + } + + ngOnDestroy() { + this.allSubscriptions.unsubscribe(); + } } diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/select-character/select-character.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/select-character/select-character.component.ts index 5331821..bb796df 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/select-character/select-character.component.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/select-character/select-character.component.ts @@ -1,14 +1,14 @@ import {Component, OnInit} from '@angular/core'; import { Router } from '@angular/router'; -import {first} from "rxjs/operators"; -import {ClearUserId} from "../../store/actions/app.actions"; -import {ErrorResponse} from "../../../types/ErrorResponse"; -import {HttpErrorResponse} from "@angular/common/http"; -import {Store} from "@ngrx/store"; -import {AppState} from "../../store/models/app-state.model"; -import {CharacterService} from "../../../services/character.service"; -import {CharacterForLoginViewModel} from "../../../types/viewmodels/character-viewmodels/CharacterForLoginViewModel"; -import {AddCharacterId} from "../../store/actions/player.action"; +import {first} from 'rxjs/operators'; +import {ClearUserId} from '../../store/actions/app.actions'; +import {ErrorResponse} from '../../../types/ErrorResponse'; +import {HttpErrorResponse} from '@angular/common/http'; +import {Store} from '@ngrx/store'; +import {AppState} from '../../store/models/app-state.model'; +import {CharacterService} from '../../../services/character.service'; +import {CharacterForLoginViewModel} from '../../../types/viewmodels/character-viewmodels/CharacterForLoginViewModel'; +import {AddCharacterId} from '../../store/actions/player.action'; @Component({ selector: 'app-select-character', @@ -29,21 +29,21 @@ export class SelectCharacterComponent implements OnInit { this.characterService.getUserCharactersList(userId).pipe(first()).subscribe((charactersList) => { this.charactersList = charactersList; }, (error: ErrorResponse | HttpErrorResponse) => { - if(error instanceof HttpErrorResponse){ - error = error.error as ErrorResponse + if (error instanceof HttpErrorResponse) { + error = error.error as ErrorResponse; } - console.error(error.message) - } ) + console.error(error.message); + } ); }); } - onCharacterClick(characterId: number){ - this.store.dispatch(new AddCharacterId({characterId})) - this.router.navigate(['player']) + onCharacterClick(characterId: number) { + this.store.dispatch(new AddCharacterId({characterId})); + this.router.navigate(['player']); } - onArrowBackClick(){ - this.store.dispatch(new ClearUserId()) - this.router.navigate(['login']) + onArrowBackClick() { + this.store.dispatch(new ClearUserId()); + this.router.navigate(['login']); } } diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/reducers/index.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/reducers/index.ts deleted file mode 100644 index 4f57bb0..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/reducers/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { - ActionReducer, - ActionReducerMap, - createFeatureSelector, - createSelector, - MetaReducer -} from '@ngrx/store'; -import { environment } from '../../environments/environment'; - -export interface State { - -} - -export const reducers: ActionReducerMap = { - -}; - - -export const metaReducers: MetaReducer[] = !environment.production ? [] : []; diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/how-to.RMD b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/how-to.RMD index 5ba5504..b0d9081 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/how-to.RMD +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/how-to.RMD @@ -1,29 +1,4 @@ Moduł został już dodany i wstrzyknięty do roota apki. -Aby dodać nową ikonkę, plik svg wstawiamy do folderu icons/svg-icons. -Następnie wpisujemy w konsoli polecenie: -npm run generate-icons - -Zostaną wtedy utworzone nowe klasy z dodaną ikonką. - -Jeśli po tym będziemy chcieli użyć gdzieś naszej ikonki, nie pojawi się ona... -Jest to spowodowane tym, że nie chcemy, aby aplikacja wczytywała w jednym momencie wszystkie nasze ikonki a jedynie te potrzebne -Musi więc ją dodać w odpowiednim momencie do rejestru, w innym wypadku w konsoli dostaniemy komunikat: -![img.png](warning.png) - -Teraz zarejestrujmy naszą ikonkę: - -Dodajemy w konstruktorze danego komponentu: -```typescript -iconRegister: SessionCompanionIconsRegistry -``` - -Następnie dodajemy interesującą nas ikonkę: -```typescript -this.iconRegister.registerIcon(scIconBarbarian); -``` - -Samą ikonkę ładujemy w tagu -```html - -``` +Aby dodać nową ikonkę, plik svg wstawiamy do folderu assets/icons/svg-icons. +Oraz dodajym kolejnego enuma w pliku sc-icon.model.ts diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/sc-icon.model.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/sc-icon.model.ts deleted file mode 100644 index 840ea40..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/sc-icon.model.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* 🤖 this file was generated by svg-to-ts*/ -export const scIconBarbarian: { - name: 'barbarian'; - data: string; -} = { - name: 'barbarian', - data: `` -}; -export const scIconBard: { - name: 'bard'; - data: string; -} = { - name: 'bard', - data: `` -}; -export const scIconCleric: { - name: 'cleric'; - data: string; -} = { - name: 'cleric', - data: `` -}; -export const scIconDruid: { - name: 'druid'; - data: string; -} = { - name: 'druid', - data: `` -}; -export const scIconFighter: { - name: 'fighter'; - data: string; -} = { - name: 'fighter', - data: `` -}; -export const scIconMonk: { - name: 'monk'; - data: string; -} = { - name: 'monk', - data: `` -}; -export const scIconPaladin: { - name: 'paladin'; - data: string; -} = { - name: 'paladin', - data: `` -}; -export const scIconRanger: { - name: 'ranger'; - data: string; -} = { - name: 'ranger', - data: `` -}; -export const scIconRogue: { - name: 'rogue'; - data: string; -} = { - name: 'rogue', - data: `` -}; -export const scIconSorcerer: { - name: 'sorcerer'; - data: string; -} = { - name: 'sorcerer', - data: `` -}; -export const scIconWarlock: { - name: 'warlock'; - data: string; -} = { - name: 'warlock', - data: `` -}; -export const scIconWizard: { - name: 'wizard'; - data: string; -} = { - name: 'wizard', - data: `` -}; -export type scIcon = - | 'barbarian' - | 'bard' - | 'cleric' - | 'druid' - | 'fighter' - | 'monk' - | 'paladin' - | 'ranger' - | 'rogue' - | 'sorcerer' - | 'warlock' - | 'wizard'; -export interface SessionCompanionIcon { - name: scIcon; - data: string; -} -export type SessionCompanionIconNameSubset< - T extends Readonly -> = T[number]['name']; diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/barbarian.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/barbarian.svg deleted file mode 100644 index a4d948e..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/barbarian.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/bard.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/bard.svg deleted file mode 100644 index 565ebe9..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/bard.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/cleric.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/cleric.svg deleted file mode 100644 index df1b7e5..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/cleric.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/druid.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/druid.svg deleted file mode 100644 index 036adc9..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/druid.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/fighter.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/fighter.svg deleted file mode 100644 index 4fa6997..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/fighter.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/monk.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/monk.svg deleted file mode 100644 index 3590be6..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/monk.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/paladin.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/paladin.svg deleted file mode 100644 index 0fb47a7..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/paladin.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/ranger.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/ranger.svg deleted file mode 100644 index 4d9aca2..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/ranger.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/rogue.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/rogue.svg deleted file mode 100644 index 2e89550..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/rogue.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/sorcerer.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/sorcerer.svg deleted file mode 100644 index e26b851..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/sorcerer.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/warlock.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/warlock.svg deleted file mode 100644 index 329c82f..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/warlock.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/wizard.svg b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/wizard.svg deleted file mode 100644 index c61b956..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/icons/svg-icons/wizard.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons-registry.service.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons-registry.service.ts index 0870b10..6d48cad 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons-registry.service.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons-registry.service.ts @@ -1,31 +1,22 @@ import {Injectable} from '@angular/core'; -import { SessionCompanionIcon } from './icons/sc-icon.model'; +import {scIcon} from '../../../assets/icons/sc-icon.model'; +import {MatIconRegistry} from '@angular/material'; +import {DomSanitizer} from '@angular/platform-browser'; @Injectable({ providedIn: 'root' }) export class SessionCompanionIconsRegistry { + constructor(private registry: MatIconRegistry, private sanitizer: DomSanitizer) { + } - private registry = new Map(); + public registerIcons(): void { + this.loadIcons(Object.values(scIcon), '../assets/icons/svg-icons'); + } - public registerIcons(icons: SessionCompanionIcon[]): void { - icons.forEach((icon: SessionCompanionIcon) => { - if (!this.registry.has(icon.name)) { - this.registry.set(icon.name, icon.data); - } + private loadIcons(iconKeys: string[], iconUrl: string): void { + iconKeys.forEach((icon: string) => { + this.registry.addSvgIcon(icon, this.sanitizer.bypassSecurityTrustResourceUrl(`${iconUrl}/${icon}.svg`)); }); } - - public registerIcon(icon: SessionCompanionIcon): void { - if (!this.registry.has(icon.name)) { - this.registry.set(icon.name, icon.data); - } - } - - public getIcon(iconName: string): string | undefined { - if (!this.registry.has(iconName)) { - console.warn(`We could not find the Icon with the name ${iconName}, did you add it to the Icon registry?`); - } - return this.registry.get(iconName); - } } diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons.component.ts deleted file mode 100644 index 5752798..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {ChangeDetectionStrategy, Component, ElementRef, Inject, Input, Optional} from '@angular/core'; -import {SessionCompanionIconsRegistry} from './session-companion-icons-registry.service'; -import { DOCUMENT } from '@angular/common'; - -@Component({ - selector: 'app-sc-icons', - template: ` - - `, - styles: [':host::ng-deep svg{width: 50px; height: 50px}'], - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class SessionCompanionIconsComponent { - - private svgIcon: SVGElement; - - @Input() - set name(iconName: string) { - if (this.svgIcon) { - this.element.nativeElement.removeChild(this.svgIcon); - } - const svgData = this.scIconRegistry.getIcon(iconName); - this.svgIcon = this.svgElementFromString(svgData); - this.element.nativeElement.appendChild(this.svgIcon); - } - - constructor(private element: ElementRef, private scIconRegistry: SessionCompanionIconsRegistry, - @Optional() @Inject(DOCUMENT) private document: any) { - } - - private svgElementFromString(svgContent: string): SVGElement { - const div = this.document.createElement('DIV'); - div.innerHTML = svgContent; - return div.querySelector('svg') || this.document.createElementNS('http://www.w3.org/2000/svg', 'path'); - } -} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons.module.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons.module.ts deleted file mode 100644 index eb9152a..0000000 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/session-companion-icons.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import {NgModule} from '@angular/core'; -import {SessionCompanionIconsComponent} from './session-companion-icons.component'; - -@NgModule({ - declarations: [SessionCompanionIconsComponent], - imports: [], - exports: [ - SessionCompanionIconsComponent - ] -}) -export class SessionCompanionIconsModule { -} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/warning.png b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/warning.png deleted file mode 100644 index d36ffcb..0000000 Binary files a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/sc-icons/warning.png and /dev/null differ diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/gm-signalR.service.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/gm-signalR.service.ts index 4ca94db..08cf425 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/gm-signalR.service.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/shared/signalR-service/gm-signalR.service.ts @@ -1,12 +1,15 @@ import { Inject, Injectable } from '@angular/core'; import { SignalRService } from './base/signalR.service'; +import {Subject} from 'rxjs'; @Injectable({ providedIn: 'root' }) export class GMSignalRService { signalR: SignalRService; + message: Subject; constructor(@Inject('BASE_URL') baseUrl: string) { this.signalR = new SignalRService(baseUrl); + this.message = new Subject(); this.registerOnServerEvents(); } @@ -17,10 +20,15 @@ export class GMSignalRService { if (this.signalR.connectionEstablished$.getValue() === true) { this.signalR.hubConnection.send('GameMasterLogin'); } - }); + }).unsubscribe(); } private registerOnServerEvents(): void { - + this.signalR.hubConnection.on('Welcome', (message: string) => { + this.message.next('New player connected'); + }); + this.signalR.hubConnection.on('GoodBye', (message: string) => { + this.message.next('Player disconnected'); + }); } } diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/store/models/app-state.model.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/models/app-state.model.ts index 7fda9a7..fe999ff 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/store/models/app-state.model.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/models/app-state.model.ts @@ -1,8 +1,8 @@ import {AppStoreModel} from './app-store.model'; import {ActionReducerMap} from '@ngrx/store'; import {AppReducer} from '../reducers/app.reducer'; -import {PlayerStoreModel} from "./player-store.model"; -import {PlayerReducer} from "../reducers/player.reducer"; +import {PlayerStoreModel} from './player-store.model'; +import {PlayerReducer} from '../reducers/player.reducer'; export interface AppState { appStore: AppStoreModel; diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/store/reducers/player.reducer.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/reducers/player.reducer.ts index 33cc4b6..3077834 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/store/reducers/player.reducer.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/store/reducers/player.reducer.ts @@ -1,5 +1,5 @@ -import {PlayerStoreModel} from "../models/player-store.model"; -import {PlayerAction, PlayerActionTypes} from "../actions/player.action"; +import {PlayerStoreModel} from '../models/player-store.model'; +import {PlayerAction, PlayerActionTypes} from '../actions/player.action'; const initialState: PlayerStoreModel = { characterId: null diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/sc-icon.model.ts b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/sc-icon.model.ts new file mode 100644 index 0000000..e3537d1 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/sc-icon.model.ts @@ -0,0 +1,14 @@ +export enum scIcon { + Barbarian = 'barbarian', + Bard = 'bard', + Cleric = 'cleric', + Druid = 'druid', + Fighter = 'fighter', + Monk = 'monk', + Paladin = 'paladin', + Ranger = 'ranger', + rogue = 'rogue', + Sorcerer = 'sorcerer', + Warlock = 'warlock', + Wizard = 'wizard' +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/barbarian.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/barbarian.svg new file mode 100644 index 0000000..ea18fd3 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/barbarian.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/bard.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/bard.svg new file mode 100644 index 0000000..1e139d8 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/bard.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/cleric.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/cleric.svg new file mode 100644 index 0000000..f7a6586 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/cleric.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/druid.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/druid.svg new file mode 100644 index 0000000..8290333b --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/druid.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/fighter.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/fighter.svg new file mode 100644 index 0000000..0f55a43 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/fighter.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/monk.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/monk.svg new file mode 100644 index 0000000..dccf6ac --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/monk.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/paladin.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/paladin.svg new file mode 100644 index 0000000..615bc8f --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/paladin.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/ranger.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/ranger.svg new file mode 100644 index 0000000..8defce6 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/ranger.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/rogue.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/rogue.svg new file mode 100644 index 0000000..a5ebf42 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/rogue.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/sorcerer.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/sorcerer.svg new file mode 100644 index 0000000..6fa42fb --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/sorcerer.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/warlock.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/warlock.svg new file mode 100644 index 0000000..d84762e --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/warlock.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/wizard.svg b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/wizard.svg new file mode 100644 index 0000000..1df2853 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/assets/icons/svg-icons/wizard.svg @@ -0,0 +1 @@ + diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/services/character.service.ts b/SessionCompanion/SessionCompanion/ClientApp/src/services/character.service.ts index 01180af..c390a44 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/services/character.service.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/services/character.service.ts @@ -3,8 +3,9 @@ import {HttpClient, HttpParams} from '@angular/common/http'; import {Observable, of, throwError} from 'rxjs'; import {ErrorResponse} from '../types/ErrorResponse'; import {Either} from '../types/Either'; -import {switchMap} from 'rxjs/operators'; -import {CharacterForLoginViewModel} from "../types/viewmodels/character-viewmodels/CharacterForLoginViewModel"; +import {CharacterForLoginViewModel} from '../types/viewmodels/character-viewmodels/CharacterForLoginViewModel'; +import {switchMap, retry} from 'rxjs/operators'; +import {LoggedCharactersViewModel} from '../types/viewmodels/character-viewmodels/LoggedCharactersViewModel'; Injectable({ providedIn: 'root' @@ -15,6 +16,19 @@ export class CharacterService { this.baseUrl = baseUrl + this.baseUrl; } + getLoggedCharacters(): Observable { + return this.http.get>(this.baseUrl + 'loggedCharacters').pipe( + switchMap(response => { + if (response.isLeft) { + return of(response.left); + } else { + return throwError(response.right); + } + }), + retry(3) + ); + } + getUserCharactersList(userId: number): Observable { const params = new HttpParams().set('userId', userId.toString()) return this.http.get>(this.baseUrl + 'userCharactersList', {params}).pipe( diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/character-viewmodels/LoggedCharactersViewModel.ts b/SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/character-viewmodels/LoggedCharactersViewModel.ts new file mode 100644 index 0000000..36ea974 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/types/viewmodels/character-viewmodels/LoggedCharactersViewModel.ts @@ -0,0 +1,7 @@ +export interface LoggedCharactersViewModel { + id: number; + name: string; + level: number; + currentHealthPoints: number; + class: string; +}