diff --git a/build/Build.cs b/build/Build.cs index 186deb46..670e7fa8 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using Nuke.Common; using Nuke.Common.CI; using Nuke.Common.IO; @@ -11,7 +12,6 @@ using Nuke.Common.Tools.GitVersion; using Nuke.Common.Utilities.Collections; using Renci.SshNet; -using static Nuke.Common.IO.FileSystemTasks; using static Nuke.Common.Tools.Docker.DockerTasks; using static Nuke.Common.Tools.DotNet.DotNetTasks; @@ -52,16 +52,16 @@ public sealed class Build : NukeBuild [Solution] private readonly Solution Solution; - [GitVersion(Framework = "net6.0")] + [GitVersion(Framework = "net7.0")] private readonly GitVersion GitVersion; Target Clean => _ => _ .Before(Restore) .Executes(() => { - SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); - TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory); - EnsureCleanDirectory(OutputDirectory); + SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory()); + TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(x => x.DeleteDirectory()); + OutputDirectory.CreateOrCleanDirectory(); }); Target Restore => _ => _ @@ -95,7 +95,7 @@ public sealed class Build : NukeBuild .When(IsServerBuild, c => c.EnableUseSourceLink()) .EnableNoRestore() .EnableNoBuild() - .CombineWith(Solution.GetProjects("*Tests"), (_, p) => _ + .CombineWith(Solution.GetAllProjects("*Tests"), (_, p) => _ .SetProjectFile(p) .SetLoggers($"junit;LogFileName={p.Name}-results.xml;MethodFormat=Class;FailureBodyFormat=Verbose"))); }); @@ -109,7 +109,7 @@ public sealed class Build : NukeBuild .EnableNoBuild() .EnableNoRestore() .CombineWith(ProjectsForPublish, (ss, p) => ss - .SetProject(Solution.GetProject(p)) + .SetProject(Solution.GetAllProjects(p).SingleOrDefault()) .SetOutput(OutputDirectory / p))); }); diff --git a/build/_build.csproj b/build/_build.csproj index d385a51e..4d01ac82 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -1,5 +1,4 @@ - Exe net7.0 @@ -9,11 +8,9 @@ .. 1 - - + - diff --git a/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToAssessmentSession/ConnectToAssessmentSessionCommandHandler.cs b/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToAssessmentSession/ConnectToAssessmentSessionCommandHandler.cs index e2775ff3..32e625f9 100644 --- a/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToAssessmentSession/ConnectToAssessmentSessionCommandHandler.cs +++ b/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToAssessmentSession/ConnectToAssessmentSessionCommandHandler.cs @@ -27,20 +27,27 @@ public Task Handle( { if (command is null) throw new ArgumentNullException(nameof(command)); - + var existSessionAssessmentSession = _repository.Find(command.AppraiserId); - if (existSessionAssessmentSession?.Participants.Any(p => p.Id == command.AppraiserId) == true) + if (existSessionAssessmentSession is not null) { - var messageId = existSessionAssessmentSession.Id == command.AssessmentSessionId - ? Messages.AppraiserConnectWithError - : Messages.AppraiserConnectedToOtherSession; + if (existSessionAssessmentSession.Participants.Any(p => p.Id == command.AppraiserId)) + { + var messageId = existSessionAssessmentSession.Id == command.AssessmentSessionId + ? Messages.AppraiserConnectWithError + : Messages.AppraiserConnectedToOtherSession; - throw new AppraiserUserException(messageId, command.AppraiserName, existSessionAssessmentSession.Title); - } + throw new AppraiserUserException(messageId, command.AppraiserName, existSessionAssessmentSession.Title); + } + if (existSessionAssessmentSession.Moderator.Id == command.AppraiserId + && existSessionAssessmentSession.Id != command.AssessmentSessionId) + throw new AppraiserUserException(Messages.AppraiserConnectedToOtherSession, command.AppraiserName, existSessionAssessmentSession.Title); + } + + // TODO: remove nullable check if (command.AssessmentSessionId is null) throw new ApplicationException("AssessmentSessionId is empty."); - var assessmentSession = _repository .Find(command.AssessmentSessionId) .EnsureForAppraiser(command.AppraiserName); diff --git a/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToDashboard/ConnectToDashboardCommandHandler.cs b/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToDashboard/ConnectToDashboardCommandHandler.cs deleted file mode 100644 index a41681f2..00000000 --- a/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToDashboard/ConnectToDashboardCommandHandler.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Inc.TeamAssistant.Appraiser.Application.Contracts; -using Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToDashboard; -using MediatR; -using Inc.TeamAssistant.Appraiser.Application.Extensions; - -namespace Inc.TeamAssistant.Appraiser.Application.CommandHandlers.ConnectToDashboard; - -internal sealed class ConnectToDashboardCommandHandler - : IRequestHandler -{ - private readonly IAssessmentSessionRepository _repository; - - public ConnectToDashboardCommandHandler(IAssessmentSessionRepository repository) - { - _repository = repository ?? throw new ArgumentNullException(nameof(repository)); - } - - public Task Handle(ConnectToDashboardCommand command, CancellationToken cancellationToken) - { - if (command is null) - throw new ArgumentNullException(nameof(command)); - - var assessmentSession = _repository - .Find(command.AppraiserId) - .EnsureForAppraiser(command.AppraiserName); - - return Task.FromResult(new ConnectToDashboardResult( - assessmentSession.Id, - assessmentSession.LanguageId, - assessmentSession.Title)); - } -} \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToDashboard/Validators/ConnectToDashboardCommandValidator.cs b/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToDashboard/Validators/ConnectToDashboardCommandValidator.cs deleted file mode 100644 index 2d1a44e3..00000000 --- a/src/Inc.TeamAssistant.Appraiser.Application/CommandHandlers/ConnectToDashboard/Validators/ConnectToDashboardCommandValidator.cs +++ /dev/null @@ -1,16 +0,0 @@ -using FluentValidation; -using Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToDashboard; -using Inc.TeamAssistant.Appraiser.Model.Common; - -namespace Inc.TeamAssistant.Appraiser.Application.CommandHandlers.ConnectToDashboard.Validators; - -internal sealed class ConnectToDashboardCommandValidator : AbstractValidator -{ - public ConnectToDashboardCommandValidator(IValidator appraiserValidator) - { - if (appraiserValidator is null) - throw new ArgumentNullException(nameof(appraiserValidator)); - - RuleFor(e => e).SetValidator(appraiserValidator); - } -} \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Application/Contracts/IQuickResponseCodeGenerator.cs b/src/Inc.TeamAssistant.Appraiser.Application/Contracts/IQuickResponseCodeGenerator.cs index c3d0fd14..21d76c1b 100644 --- a/src/Inc.TeamAssistant.Appraiser.Application/Contracts/IQuickResponseCodeGenerator.cs +++ b/src/Inc.TeamAssistant.Appraiser.Application/Contracts/IQuickResponseCodeGenerator.cs @@ -2,5 +2,5 @@ namespace Inc.TeamAssistant.Appraiser.Application.Contracts; public interface IQuickResponseCodeGenerator { - string Generate(string data, int width, int height, bool drawQuietZones); + string Generate(string data); } \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Application/Inc.TeamAssistant.Appraiser.Application.csproj b/src/Inc.TeamAssistant.Appraiser.Application/Inc.TeamAssistant.Appraiser.Application.csproj index 616b79c7..dd75b99d 100644 --- a/src/Inc.TeamAssistant.Appraiser.Application/Inc.TeamAssistant.Appraiser.Application.csproj +++ b/src/Inc.TeamAssistant.Appraiser.Application/Inc.TeamAssistant.Appraiser.Application.csproj @@ -4,10 +4,9 @@ - - + + - diff --git a/src/Inc.TeamAssistant.Appraiser.Application/Messages.cs b/src/Inc.TeamAssistant.Appraiser.Application/Messages.cs index 3334f8e0..0989ccf0 100644 --- a/src/Inc.TeamAssistant.Appraiser.Application/Messages.cs +++ b/src/Inc.TeamAssistant.Appraiser.Application/Messages.cs @@ -17,7 +17,6 @@ internal static class Messages public static readonly MessageId ExitFromAssessmentSessionHelp = new(nameof(ExitFromAssessmentSessionHelp)); public static readonly MessageId CreateAssessmentSessionHelp = new(nameof(CreateAssessmentSessionHelp)); public static readonly MessageId AllowUseNameHelp = new(nameof(AllowUseNameHelp)); - public static readonly MessageId ConnectToDashboardHelp = new(nameof(ConnectToDashboardHelp)); public static readonly MessageId ShowParticipantsHelp = new(nameof(ShowParticipantsHelp)); public static readonly MessageId AddStoryToAssessmentSessionHelp = new(nameof(AddStoryToAssessmentSessionHelp)); public static readonly MessageId ChangeLanguageHelp = new(nameof(ChangeLanguageHelp)); diff --git a/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/GetLinkForConnect/GetLinkForConnectQueryHandler.cs b/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/GetLinkForConnect/GetLinkForConnectQueryHandler.cs index fdac2451..1768d0a3 100644 --- a/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/GetLinkForConnect/GetLinkForConnectQueryHandler.cs +++ b/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/GetLinkForConnect/GetLinkForConnectQueryHandler.cs @@ -21,7 +21,7 @@ public Task Handle(GetLinkForConnectQuery query, Cancel throw new ArgumentNullException(nameof(query)); var link = _linkBuilder.BuildLinkMoveToBot(); - var code = _codeGenerator.Generate(link, query.Width, query.Height, query.DrawQuietZones); + var code = _codeGenerator.Generate(link); return Task.FromResult(new GetLinkForConnectResult(code)); } diff --git a/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/GetStoryDetails/GetStoryDetailsQueryHandler.cs b/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/GetStoryDetails/GetStoryDetailsQueryHandler.cs index 2e4ab154..6b10c66f 100644 --- a/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/GetStoryDetails/GetStoryDetailsQueryHandler.cs +++ b/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/GetStoryDetails/GetStoryDetailsQueryHandler.cs @@ -28,22 +28,18 @@ public GetStoryDetailsQueryHandler( throw new ArgumentNullException(nameof(query)); var assessmentSession = _repository.Find(query.AssessmentSessionId); - - var result = assessmentSession is not null - ? Get(assessmentSession, query.Width, query.Height, query.DrawQuietZones) - : null; - + var result = assessmentSession is not null ? Get(assessmentSession) : null; return Task.FromResult(result); } - private GetStoryDetailsResult Get(AssessmentSession assessmentSession, int width, int height, bool drawQuietZones) + private GetStoryDetailsResult Get(AssessmentSession assessmentSession) { if (assessmentSession is null) throw new ArgumentNullException(nameof(assessmentSession)); var estimateEnded = assessmentSession.EstimateEnded(); var link = _linkBuilder.BuildLinkForConnect(assessmentSession.Id); - var code = _codeGenerator.Generate(link, width, height, drawQuietZones); + var code = _codeGenerator.Generate(link); var items = assessmentSession.CurrentStory.StoryForEstimates .Select(e => new StoryForEstimateDto( diff --git a/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/ShowHelp/ShowHelpQueryHandler.cs b/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/ShowHelp/ShowHelpQueryHandler.cs index 82761d4e..881c27b4 100644 --- a/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/ShowHelp/ShowHelpQueryHandler.cs +++ b/src/Inc.TeamAssistant.Appraiser.Application/QueryHandlers/ShowHelp/ShowHelpQueryHandler.cs @@ -3,7 +3,6 @@ using Inc.TeamAssistant.Appraiser.Model.Commands.AddStoryToAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.AllowUseName; using Inc.TeamAssistant.Appraiser.Model.Commands.ChangeLanguage; -using Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToDashboard; using Inc.TeamAssistant.Appraiser.Model.Commands.CreateAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.ExitFromAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.FinishAssessmentSession; @@ -60,12 +59,6 @@ public async Task Handle(ShowHelpQuery query, CancellationToken languageInfo.LanguageId.Value)); } - var connectToDashboardCommand = _commandProvider.GetCommand(typeof(ConnectToDashboardCommand)); - commandsHelp.Add(await _messageBuilder.Build( - Messages.ConnectToDashboardHelp, - query.LanguageId, - connectToDashboardCommand)); - var addStoryToAssessmentSessionCommand = _commandProvider.GetCommand(typeof(AddStoryToAssessmentSessionCommand)); commandsHelp.Add(await _messageBuilder.Build( Messages.AddStoryToAssessmentSessionHelp, diff --git a/src/Inc.TeamAssistant.Appraiser.Application/ServiceCollectionExtensions.cs b/src/Inc.TeamAssistant.Appraiser.Application/ServiceCollectionExtensions.cs index 85c53396..58f9460c 100644 --- a/src/Inc.TeamAssistant.Appraiser.Application/ServiceCollectionExtensions.cs +++ b/src/Inc.TeamAssistant.Appraiser.Application/ServiceCollectionExtensions.cs @@ -28,7 +28,11 @@ public static IServiceCollection AddApplication(this IServiceCollection services services .AddSingleton(addStoryOptions) - .AddMediatR(c => c.AsScoped(), typeof(AddStoryToAssessmentSessionCommandHandler)) + .AddMediatR(c => + { + c.Lifetime = ServiceLifetime.Scoped; + c.RegisterServicesFromAssemblyContaining(); + }) .AddValidatorsFromAssemblyContaining( ServiceLifetime.Scoped, includeInternalTypes: true) diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/CommandList.cs b/src/Inc.TeamAssistant.Appraiser.Backend/CommandList.cs index a82df4e3..0c3b7cc1 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/CommandList.cs +++ b/src/Inc.TeamAssistant.Appraiser.Backend/CommandList.cs @@ -7,7 +7,6 @@ internal static class CommandList public const string AllowUseName = "/allow_use_name"; public const string CreateAssessmentSession = "/new"; public const string ChangeLanguageForAssessmentSession = "/{0}"; - public const string ConnectToDashboard = "/dashboard"; public const string ShowParticipants = "/users"; public const string AddStoryToAssessmentSession = "/add"; public const string AcceptEstimate = "/accept"; diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/Controllers/AssessmentSessionsController.cs b/src/Inc.TeamAssistant.Appraiser.Backend/Controllers/AssessmentSessionsController.cs index 223e4570..4deb026f 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/Controllers/AssessmentSessionsController.cs +++ b/src/Inc.TeamAssistant.Appraiser.Backend/Controllers/AssessmentSessionsController.cs @@ -15,19 +15,10 @@ public AssessmentSessionsController(IAssessmentSessionsService service) } [HttpGet("story/{assessmentSessionId}")] - public async Task GetStoryDetails( - Guid assessmentSessionId, - int width, - int height, - bool drawQuietZones, - CancellationToken cancellationToken) - => Ok(await _service.GetStoryDetails(new(assessmentSessionId), width, height, drawQuietZones, cancellationToken)); + public async Task GetStoryDetails(Guid assessmentSessionId, CancellationToken cancellationToken) + => Ok(await _service.GetStoryDetails(new(assessmentSessionId), cancellationToken)); [HttpGet("link-for-connect")] - public async Task LinkForConnect( - int width, - int height, - bool drawQuietZones, - CancellationToken cancellationToken) - => Ok(await _service.GetLinkForConnect(width, height, drawQuietZones, cancellationToken)); + public async Task LinkForConnect(CancellationToken cancellationToken) + => Ok(await _service.GetLinkForConnect(cancellationToken)); } \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/Inc.TeamAssistant.Appraiser.Backend.csproj b/src/Inc.TeamAssistant.Appraiser.Backend/Inc.TeamAssistant.Appraiser.Backend.csproj index d516e2b7..1109cd7f 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/Inc.TeamAssistant.Appraiser.Backend.csproj +++ b/src/Inc.TeamAssistant.Appraiser.Backend/Inc.TeamAssistant.Appraiser.Backend.csproj @@ -14,12 +14,13 @@ - - - - - - + + + + + + + diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/Pages/_Host.cshtml b/src/Inc.TeamAssistant.Appraiser.Backend/Pages/_Host.cshtml index d39068c9..d4197173 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/Pages/_Host.cshtml +++ b/src/Inc.TeamAssistant.Appraiser.Backend/Pages/_Host.cshtml @@ -156,7 +156,10 @@ - + + \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/Services/AssessmentSessionsService.cs b/src/Inc.TeamAssistant.Appraiser.Backend/Services/AssessmentSessionsService.cs index a3617adf..fc016813 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/Services/AssessmentSessionsService.cs +++ b/src/Inc.TeamAssistant.Appraiser.Backend/Services/AssessmentSessionsService.cs @@ -16,15 +16,12 @@ public AssessmentSessionsService(IMediator mediator) public async Task> GetStoryDetails( AssessmentSessionId assessmentSessionId, - int width, - int height, - bool drawQuietZones, CancellationToken cancellationToken) { try { var result = await _mediator.Send( - new GetStoryDetailsQuery(assessmentSessionId, width, height, drawQuietZones), + new GetStoryDetailsQuery(assessmentSessionId), cancellationToken); return result is null @@ -37,16 +34,12 @@ public AssessmentSessionsService(IMediator mediator) } } - public async Task> GetLinkForConnect( - int width, - int height, - bool drawQuietZones, - CancellationToken cancellationToken) + public async Task> GetLinkForConnect(CancellationToken cancellationToken) { try { var result = await _mediator.Send( - new GetLinkForConnectQuery(width, height, drawQuietZones), + new GetLinkForConnectQuery(), cancellationToken); return ServiceResult.Success(result); diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/Services/CommandFactories/CommandProvider.cs b/src/Inc.TeamAssistant.Appraiser.Backend/Services/CommandFactories/CommandProvider.cs index f161a959..dd2ee38b 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/Services/CommandFactories/CommandProvider.cs +++ b/src/Inc.TeamAssistant.Appraiser.Backend/Services/CommandFactories/CommandProvider.cs @@ -3,7 +3,6 @@ using Inc.TeamAssistant.Appraiser.Model.Commands.AddStoryToAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.AllowUseName; using Inc.TeamAssistant.Appraiser.Model.Commands.ChangeLanguage; -using Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToDashboard; using Inc.TeamAssistant.Appraiser.Model.Commands.CreateAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.ExitFromAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.FinishAssessmentSession; @@ -21,7 +20,6 @@ internal sealed class CommandProvider : ICommandProvider [typeof(CreateAssessmentSessionCommand)] = CommandList.CreateAssessmentSession, [typeof(AllowUseNameCommand)] = CommandList.AllowUseName, [typeof(ChangeLanguageCommand)] = CommandList.ChangeLanguageForAssessmentSession, - [typeof(ConnectToDashboardCommand)] = CommandList.ConnectToDashboard, [typeof(AddStoryToAssessmentSessionCommand)] = CommandList.AddStoryToAssessmentSession, [typeof(ReVoteEstimateCommand)] = CommandList.ReVoteEstimate, [typeof(AcceptEstimateCommand)] = CommandList.AcceptEstimate, diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/Services/CommandFactories/StaticCommandFactory.cs b/src/Inc.TeamAssistant.Appraiser.Backend/Services/CommandFactories/StaticCommandFactory.cs index bb90b94e..17924526 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/Services/CommandFactories/StaticCommandFactory.cs +++ b/src/Inc.TeamAssistant.Appraiser.Backend/Services/CommandFactories/StaticCommandFactory.cs @@ -4,7 +4,6 @@ using Inc.TeamAssistant.Appraiser.Model.Commands.AllowUseName; using Inc.TeamAssistant.Appraiser.Model.Commands.ChangeLanguage; using Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToAssessmentSession; -using Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToDashboard; using Inc.TeamAssistant.Appraiser.Model.Commands.CreateAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.ExitFromAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.FinishAssessmentSession; @@ -51,7 +50,6 @@ public StaticCommandFactory() [CommandList.AllowUseName] = c => new AllowUseNameCommand(c.UserId, c.RealUserName), [CommandList.ExitFromAssessmentSession] = c => new ExitFromAssessmentSessionCommand(c.UserId, c.UserName), [CommandList.CreateAssessmentSession] = c => new CreateAssessmentSessionCommand(c.ChatId, c.UserId, c.UserName, c.LanguageId), - [CommandList.ConnectToDashboard] = c => new ConnectToDashboardCommand(c.UserId, c.UserName), [CommandList.ShowParticipants] = c => new ShowParticipantsQuery(c.UserId, c.UserName), [CommandList.AddStoryToAssessmentSession] = CreateStartStorySelectionCommand }; diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/Services/CookieService.cs b/src/Inc.TeamAssistant.Appraiser.Backend/Services/CookieService.cs index d1f3600c..ecb51fa3 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/Services/CookieService.cs +++ b/src/Inc.TeamAssistant.Appraiser.Backend/Services/CookieService.cs @@ -11,6 +11,8 @@ public CookieService(IHttpContextAccessor httpContextAccessor) _httpContextAccessor = httpContextAccessor ?? throw new ArgumentNullException(nameof(httpContextAccessor)); } + public bool IsServerRender => true; + public Task GetValue(string name) { var httpContext = _httpContextAccessor.HttpContext; diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/Services/QuickResponseCodeGenerator.cs b/src/Inc.TeamAssistant.Appraiser.Backend/Services/QuickResponseCodeGenerator.cs index 6a924a76..fcdd033c 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/Services/QuickResponseCodeGenerator.cs +++ b/src/Inc.TeamAssistant.Appraiser.Backend/Services/QuickResponseCodeGenerator.cs @@ -1,20 +1,16 @@ using Inc.TeamAssistant.Appraiser.Application.Contracts; -using QRCoder; +using Net.Codecrete.QrCodeGenerator; namespace Inc.TeamAssistant.Appraiser.Backend.Services; internal sealed class QuickResponseCodeGenerator : IQuickResponseCodeGenerator { - public string Generate(string data, int width, int height, bool drawQuietZones) + public string Generate(string data) { if (string.IsNullOrWhiteSpace(data)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(data)); - - var eccLevel = QRCodeGenerator.ECCLevel.Q; - - using var qrGenerator = new QRCodeGenerator(); - using var qrCode = new SvgQRCode(qrGenerator.CreateQrCode(data, eccLevel)); - - return qrCode.GetGraphic(new(width, height), drawQuietZones); + + var qr = QrCode.EncodeText(data, QrCode.Ecc.Quartile); + return qr.ToSvgString(border: 0); } } \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/Services/QuickResponseCodeGeneratorCached.cs b/src/Inc.TeamAssistant.Appraiser.Backend/Services/QuickResponseCodeGeneratorCached.cs index 8a7d97fc..62c2409b 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/Services/QuickResponseCodeGeneratorCached.cs +++ b/src/Inc.TeamAssistant.Appraiser.Backend/Services/QuickResponseCodeGeneratorCached.cs @@ -22,31 +22,26 @@ public QuickResponseCodeGeneratorCached( _cacheAbsoluteExpiration = cacheAbsoluteExpiration; } - public string Generate(string data, int width, int height, bool drawQuietZones) + public string Generate(string data) { if (string.IsNullOrWhiteSpace(data)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(data)); - - var cacheKey = GetKey(data, width, height, drawQuietZones); var cacheItem = _memoryCache.GetOrCreate( - cacheKey, + data, c => { c.SetAbsoluteExpiration(_cacheAbsoluteExpiration); - return _generator.Generate(data, width, height, drawQuietZones); + return _generator.Generate(data); }); if (cacheItem is null) { - _logger.LogWarning("Can not get object with key {CacheKey} from cache", cacheKey); - return _generator.Generate(data, width, height, drawQuietZones); + _logger.LogWarning("Can not get object with key {CacheKey} from cache", data); + return _generator.Generate(data); } return cacheItem; } - - private string GetKey(string data, int width, int height, bool drawQuietZones) - => $"{data}_w{width}_h{height}_d{drawQuietZones}"; } \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/wwwroot/langs/en.json b/src/Inc.TeamAssistant.Appraiser.Backend/wwwroot/langs/en.json index d809efde..2ddabd27 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/wwwroot/langs/en.json +++ b/src/Inc.TeamAssistant.Appraiser.Backend/wwwroot/langs/en.json @@ -33,7 +33,6 @@ "ExitFromAssessmentSessionHelp": "{0} - disconnect from current assessment session", "CreateAssessmentSessionHelp": "{0} - create new session", "AllowUseNameHelp": "{0} - allow to use username", - "ConnectToDashboardHelp": "{0} - get assessment session dashboard link", "ShowParticipantsHelp": "{0} - show list of users", "AddStoryToAssessmentSessionHelp": "{0} - add task for estimating", "ChangeLanguageHelp": "{0} - change {1} language", @@ -100,6 +99,14 @@ "OgDescription": "Telegram bot to estimate tasks via planning poker", "GUI_AcceptCookieText": "We use cookies to make our site as convenient as possible for you. By continuing to use our site, you agree to the use of cookies.", "GUI_AcceptCookieButton": "Accept", + "GUI_MainTitle": "Teamwork products", + "GUI_MainDescription": "We are happy to help you with optimizing your teamwork processes: evaluating tasks, conducting reviews, and communicating at a distance.", + "GUI_AppraiserDescription": "Telegram bot to estimate tasks via planning poker", + "GUI_AppraiserImageAlt": "Telegram bot to estimate tasks via planning poker", + "GUI_ReviewerDescription": "Telegram bot for timely reviews", + "GUI_ReviewerImageAlt": "Telegram bot for timely reviews", + "GUI_CheckInDescription": "Telegram bot to display the team's movements", + "GUI_CheckInImageAlt": "Telegram bot to display the team's movements", "CheckIn_GetStarted": "Add the bot to the chat room to get started", "CheckIn_OgTitle": "CheckIn", diff --git a/src/Inc.TeamAssistant.Appraiser.Backend/wwwroot/langs/ru.json b/src/Inc.TeamAssistant.Appraiser.Backend/wwwroot/langs/ru.json index d949cc1b..eac7e012 100644 --- a/src/Inc.TeamAssistant.Appraiser.Backend/wwwroot/langs/ru.json +++ b/src/Inc.TeamAssistant.Appraiser.Backend/wwwroot/langs/ru.json @@ -33,7 +33,6 @@ "ExitFromAssessmentSessionHelp": "{0} - отключиться от сессии оценки", "CreateAssessmentSessionHelp": "{0} - создать сессию", "AllowUseNameHelp": "{0} - разрешить использовать имя пользователя", - "ConnectToDashboardHelp": "{0} - получить ссылку на доску сессии оценки", "ShowParticipantsHelp": "{0} - список пользователей", "AddStoryToAssessmentSessionHelp": "{0} - добавление задачи для оценки", "ChangeLanguageHelp": "{0} - set the {1} language", @@ -100,6 +99,14 @@ "OgDescription": "Телеграм бот для оценки задач через planning poker", "GUI_AcceptCookieText": "Мы используем файлы cookies, чтобы сделать работу нашего сайта наиболее удобной для Вас. Продолжая пользоваться нашим сайтом, Вы соглашаетесь с использованием файлов cookies (куки-файлов).", "GUI_AcceptCookieButton": "Принять", + "GUI_MainTitle": "Продукты для организации работы в команде", + "GUI_MainDescription": "Мы рады помочь вам с оптимизацией процессов работы в команде: оценкой задач, проведением ревью, общением на расстоянии.", + "GUI_AppraiserDescription": "Телеграм бот для оценки задач через planning poker", + "GUI_AppraiserImageAlt": "Телеграм бот для оценки задач через planning poker", + "GUI_ReviewerDescription": "Телеграм бот для своевременного проведения ревью", + "GUI_ReviewerImageAlt": "Телеграм бот для своевременного проведения ревью", + "GUI_CheckInDescription": "Телеграм бот для отображения перемещений команды", + "GUI_CheckInImageAlt": "Телеграм бот для отображения перемещений команды", "CheckIn_GetStarted": "Добавьте бота в чат для начала работы", "CheckIn_OgTitle": "Перемещения", diff --git a/src/Inc.TeamAssistant.Appraiser.DataAccess.Postgres/Inc.TeamAssistant.Appraiser.DataAccess.Postgres.csproj b/src/Inc.TeamAssistant.Appraiser.DataAccess.Postgres/Inc.TeamAssistant.Appraiser.DataAccess.Postgres.csproj index 18bf1b86..87fca86e 100644 --- a/src/Inc.TeamAssistant.Appraiser.DataAccess.Postgres/Inc.TeamAssistant.Appraiser.DataAccess.Postgres.csproj +++ b/src/Inc.TeamAssistant.Appraiser.DataAccess.Postgres/Inc.TeamAssistant.Appraiser.DataAccess.Postgres.csproj @@ -3,9 +3,9 @@ - + - - + + diff --git a/src/Inc.TeamAssistant.Appraiser.Domain/States/Idle.cs b/src/Inc.TeamAssistant.Appraiser.Domain/States/Idle.cs index f938cbe0..abe8378e 100644 --- a/src/Inc.TeamAssistant.Appraiser.Domain/States/Idle.cs +++ b/src/Inc.TeamAssistant.Appraiser.Domain/States/Idle.cs @@ -31,7 +31,12 @@ public override void Connect(ParticipantId participantId, string name) if (AssessmentSession.Participants.Any(p => p.Id == participantId)) throw new AppraiserUserException(Messages.AppraiserConnectWithError, name, AssessmentSession.Title); - AssessmentSession.AddParticipant(new(participantId, name)); + var participant = new Participant(participantId, name); + + AssessmentSession.AddParticipant(participant); + + if (AssessmentSession.Story != Story.Empty) + AssessmentSession.Story.AddStoryForEstimate(new (participant)); } public override void Disconnect(ParticipantId participantId) diff --git a/src/Inc.TeamAssistant.Appraiser.Migrations/Inc.TeamAssistant.Appraiser.Migrations.csproj b/src/Inc.TeamAssistant.Appraiser.Migrations/Inc.TeamAssistant.Appraiser.Migrations.csproj index 88612cec..5b8624ce 100644 --- a/src/Inc.TeamAssistant.Appraiser.Migrations/Inc.TeamAssistant.Appraiser.Migrations.csproj +++ b/src/Inc.TeamAssistant.Appraiser.Migrations/Inc.TeamAssistant.Appraiser.Migrations.csproj @@ -1,9 +1,9 @@ - + - + diff --git a/src/Inc.TeamAssistant.Appraiser.MigrationsRunner/Inc.TeamAssistant.Appraiser.MigrationsRunner.csproj b/src/Inc.TeamAssistant.Appraiser.MigrationsRunner/Inc.TeamAssistant.Appraiser.MigrationsRunner.csproj index 6b0cc1ba..cf795761 100644 --- a/src/Inc.TeamAssistant.Appraiser.MigrationsRunner/Inc.TeamAssistant.Appraiser.MigrationsRunner.csproj +++ b/src/Inc.TeamAssistant.Appraiser.MigrationsRunner/Inc.TeamAssistant.Appraiser.MigrationsRunner.csproj @@ -3,7 +3,7 @@ Exe - + diff --git a/src/Inc.TeamAssistant.Appraiser.Model/Commands/ActivateAssessment/ActivateAssessmentResult.cs b/src/Inc.TeamAssistant.Appraiser.Model/Commands/ActivateAssessment/ActivateAssessmentResult.cs index 2b403174..471b499e 100644 --- a/src/Inc.TeamAssistant.Appraiser.Model/Commands/ActivateAssessment/ActivateAssessmentResult.cs +++ b/src/Inc.TeamAssistant.Appraiser.Model/Commands/ActivateAssessment/ActivateAssessmentResult.cs @@ -5,4 +5,4 @@ namespace Inc.TeamAssistant.Appraiser.Model.Commands.ActivateAssessment; public sealed record ActivateAssessmentResult( AssessmentSessionId AssessmentSessionId, LanguageId AssessmentSessionLanguageId, - string Title); \ No newline at end of file + string AssessmentSessionTitle); \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Model/Commands/ConnectToDashboard/ConnectToDashboardCommand.cs b/src/Inc.TeamAssistant.Appraiser.Model/Commands/ConnectToDashboard/ConnectToDashboardCommand.cs deleted file mode 100644 index 8962d641..00000000 --- a/src/Inc.TeamAssistant.Appraiser.Model/Commands/ConnectToDashboard/ConnectToDashboardCommand.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Inc.TeamAssistant.Appraiser.Model.Common; -using Inc.TeamAssistant.Appraiser.Primitives; -using MediatR; - -namespace Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToDashboard; - -public sealed record ConnectToDashboardCommand(ParticipantId AppraiserId, string AppraiserName) - : IRequest, IWithAppraiser; \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Model/Commands/ConnectToDashboard/ConnectToDashboardResult.cs b/src/Inc.TeamAssistant.Appraiser.Model/Commands/ConnectToDashboard/ConnectToDashboardResult.cs deleted file mode 100644 index 3475e553..00000000 --- a/src/Inc.TeamAssistant.Appraiser.Model/Commands/ConnectToDashboard/ConnectToDashboardResult.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Inc.TeamAssistant.Appraiser.Primitives; - -namespace Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToDashboard; - -public sealed record ConnectToDashboardResult( - AssessmentSessionId AssessmentSessionId, - LanguageId AssessmentSessionLanguageId, - string AssessmentSessionTitle); \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Model/IAssessmentSessionsService.cs b/src/Inc.TeamAssistant.Appraiser.Model/IAssessmentSessionsService.cs index d4280b8a..c6acde9e 100644 --- a/src/Inc.TeamAssistant.Appraiser.Model/IAssessmentSessionsService.cs +++ b/src/Inc.TeamAssistant.Appraiser.Model/IAssessmentSessionsService.cs @@ -9,14 +9,7 @@ public interface IAssessmentSessionsService { Task> GetStoryDetails( AssessmentSessionId assessmentSessionId, - int width, - int height, - bool drawQuietZones, CancellationToken cancellationToken = default); - Task> GetLinkForConnect( - int width, - int height, - bool drawQuietZones, - CancellationToken cancellationToken = default); + Task> GetLinkForConnect(CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Model/ICookieService.cs b/src/Inc.TeamAssistant.Appraiser.Model/ICookieService.cs index c2f3b2d2..0d6c89bb 100644 --- a/src/Inc.TeamAssistant.Appraiser.Model/ICookieService.cs +++ b/src/Inc.TeamAssistant.Appraiser.Model/ICookieService.cs @@ -2,6 +2,8 @@ namespace Inc.TeamAssistant.Appraiser.Model; public interface ICookieService { + bool IsServerRender { get; } + Task GetValue(string name); Task SetValue(string name, string value, int lifetimeInDays); diff --git a/src/Inc.TeamAssistant.Appraiser.Model/Inc.TeamAssistant.Appraiser.Model.csproj b/src/Inc.TeamAssistant.Appraiser.Model/Inc.TeamAssistant.Appraiser.Model.csproj index 7ec1d49d..59218d6c 100644 --- a/src/Inc.TeamAssistant.Appraiser.Model/Inc.TeamAssistant.Appraiser.Model.csproj +++ b/src/Inc.TeamAssistant.Appraiser.Model/Inc.TeamAssistant.Appraiser.Model.csproj @@ -1,6 +1,6 @@ - + diff --git a/src/Inc.TeamAssistant.Appraiser.Model/Queries/GetLinkForConnect/GetLinkForConnectQuery.cs b/src/Inc.TeamAssistant.Appraiser.Model/Queries/GetLinkForConnect/GetLinkForConnectQuery.cs index 765dd256..429ef60b 100644 --- a/src/Inc.TeamAssistant.Appraiser.Model/Queries/GetLinkForConnect/GetLinkForConnectQuery.cs +++ b/src/Inc.TeamAssistant.Appraiser.Model/Queries/GetLinkForConnect/GetLinkForConnectQuery.cs @@ -2,5 +2,4 @@ namespace Inc.TeamAssistant.Appraiser.Model.Queries.GetLinkForConnect; -public sealed record GetLinkForConnectQuery(int Width, int Height, bool DrawQuietZones) - : IRequest; \ No newline at end of file +public sealed record GetLinkForConnectQuery : IRequest; \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Model/Queries/GetStoryDetails/GetStoryDetailsQuery.cs b/src/Inc.TeamAssistant.Appraiser.Model/Queries/GetStoryDetails/GetStoryDetailsQuery.cs index c436f26e..98484bdb 100644 --- a/src/Inc.TeamAssistant.Appraiser.Model/Queries/GetStoryDetails/GetStoryDetailsQuery.cs +++ b/src/Inc.TeamAssistant.Appraiser.Model/Queries/GetStoryDetails/GetStoryDetailsQuery.cs @@ -3,9 +3,5 @@ namespace Inc.TeamAssistant.Appraiser.Model.Queries.GetStoryDetails; -public sealed record GetStoryDetailsQuery( - AssessmentSessionId AssessmentSessionId, - int Width, - int Height, - bool DrawQuietZones) +public sealed record GetStoryDetailsQuery(AssessmentSessionId AssessmentSessionId) : IRequest; \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Notifications/Builders/ActivateAssessmentNotificationBuilder.cs b/src/Inc.TeamAssistant.Appraiser.Notifications/Builders/ActivateAssessmentNotificationBuilder.cs index c5ec2513..bf9ca18f 100644 --- a/src/Inc.TeamAssistant.Appraiser.Notifications/Builders/ActivateAssessmentNotificationBuilder.cs +++ b/src/Inc.TeamAssistant.Appraiser.Notifications/Builders/ActivateAssessmentNotificationBuilder.cs @@ -21,14 +21,24 @@ public async IAsyncEnumerable Build(ActivateAssessmentResul if (commandResult is null) throw new ArgumentNullException(nameof(commandResult)); + var linkForDashboard = _linkBuilder.BuildLinkForDashboard( + commandResult.AssessmentSessionId, + commandResult.AssessmentSessionLanguageId); + var connectToDashboardMessage = await _messageBuilder.Build( + Messages.ConnectToDashboard, + commandResult.AssessmentSessionLanguageId, + commandResult.AssessmentSessionTitle, + linkForDashboard); + var linkForConnect = _linkBuilder.BuildLinkForConnect(commandResult.AssessmentSessionId); - var message = await _messageBuilder.Build( + var connectToSessionMessage = await _messageBuilder.Build( Messages.ConnectToSession, commandResult.AssessmentSessionLanguageId, - commandResult.Title, + commandResult.AssessmentSessionTitle, linkForConnect, commandResult.AssessmentSessionId.Value.ToString("N")); - yield return NotificationMessage.Create(fromId, message); + yield return NotificationMessage.Create(fromId, connectToDashboardMessage); + yield return NotificationMessage.Create(fromId, connectToSessionMessage); } } \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Notifications/Builders/ConnectToDashboardNotificationBuilder.cs b/src/Inc.TeamAssistant.Appraiser.Notifications/Builders/ConnectToDashboardNotificationBuilder.cs deleted file mode 100644 index 7992c9d2..00000000 --- a/src/Inc.TeamAssistant.Appraiser.Notifications/Builders/ConnectToDashboardNotificationBuilder.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Inc.TeamAssistant.Appraiser.Application.Contracts; -using Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToDashboard; -using Inc.TeamAssistant.Appraiser.Notifications.Contracts; - -namespace Inc.TeamAssistant.Appraiser.Notifications.Builders; - -internal sealed class ConnectToDashboardNotificationBuilder : INotificationBuilder -{ - private readonly ILinkBuilder _linkBuilder; - private readonly IMessageBuilder _messageBuilder; - - public ConnectToDashboardNotificationBuilder(ILinkBuilder linkBuilder, IMessageBuilder messageBuilder) - { - _linkBuilder = linkBuilder ?? throw new ArgumentNullException(nameof(linkBuilder)); - _messageBuilder = messageBuilder ?? throw new ArgumentNullException(nameof(messageBuilder)); - } - - public async IAsyncEnumerable Build(ConnectToDashboardResult commandResult, long fromId) - { - if (commandResult is null) - throw new ArgumentNullException(nameof(commandResult)); - - var linkForDashboard = _linkBuilder.BuildLinkForDashboard( - commandResult.AssessmentSessionId, - commandResult.AssessmentSessionLanguageId); - var message = await _messageBuilder.Build( - Messages.ConnectToDashboard, - commandResult.AssessmentSessionLanguageId, - commandResult.AssessmentSessionTitle, - linkForDashboard); - - yield return NotificationMessage.Create(fromId, message); - } -} \ No newline at end of file diff --git a/src/Inc.TeamAssistant.Appraiser.Notifications/ServiceCollectionExtensions.cs b/src/Inc.TeamAssistant.Appraiser.Notifications/ServiceCollectionExtensions.cs index a93fc7c0..48fe1679 100644 --- a/src/Inc.TeamAssistant.Appraiser.Notifications/ServiceCollectionExtensions.cs +++ b/src/Inc.TeamAssistant.Appraiser.Notifications/ServiceCollectionExtensions.cs @@ -4,7 +4,6 @@ using Inc.TeamAssistant.Appraiser.Model.Commands.AllowUseName; using Inc.TeamAssistant.Appraiser.Model.Commands.ChangeLanguage; using Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToAssessmentSession; -using Inc.TeamAssistant.Appraiser.Model.Commands.ConnectToDashboard; using Inc.TeamAssistant.Appraiser.Model.Commands.CreateAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.ExitFromAssessmentSession; using Inc.TeamAssistant.Appraiser.Model.Commands.FinishAssessmentSession; @@ -33,7 +32,6 @@ public static IServiceCollection AddNotifications(this IServiceCollection servic .AddScoped, ChangeLanguageNotificationBuilder>() .AddScoped, ActivateAssessmentNotificationBuilder>() - .AddScoped, ConnectToDashboardNotificationBuilder>() .AddScoped, AddStoryToAssessmentSessionNotificationBuilder>() .AddScoped, ConnectToAssessmentSessionNotificationBuilder>() .AddScoped, CreateAssessmentSessionNotificationBuilder>() diff --git a/src/Inc.TeamAssistant.CheckIn.All/Inc.TeamAssistant.CheckIn.All.csproj b/src/Inc.TeamAssistant.CheckIn.All/Inc.TeamAssistant.CheckIn.All.csproj index bfbae1ed..ae79f1b0 100644 --- a/src/Inc.TeamAssistant.CheckIn.All/Inc.TeamAssistant.CheckIn.All.csproj +++ b/src/Inc.TeamAssistant.CheckIn.All/Inc.TeamAssistant.CheckIn.All.csproj @@ -1,10 +1,10 @@ - - - - + + + + diff --git a/src/Inc.TeamAssistant.Reviewer.All/Inc.TeamAssistant.Reviewer.All.csproj b/src/Inc.TeamAssistant.Reviewer.All/Inc.TeamAssistant.Reviewer.All.csproj index aad48e5a..ebe0f501 100644 --- a/src/Inc.TeamAssistant.Reviewer.All/Inc.TeamAssistant.Reviewer.All.csproj +++ b/src/Inc.TeamAssistant.Reviewer.All/Inc.TeamAssistant.Reviewer.All.csproj @@ -2,10 +2,10 @@ - - - - + + + + diff --git a/src/Inc.TeamAssistant.Reviewer.All/Internal/LanguageIdTypeHandler.cs b/src/Inc.TeamAssistant.Reviewer.All/Internal/LanguageIdTypeHandler.cs index 932add0f..3ceff20f 100644 --- a/src/Inc.TeamAssistant.Reviewer.All/Internal/LanguageIdTypeHandler.cs +++ b/src/Inc.TeamAssistant.Reviewer.All/Internal/LanguageIdTypeHandler.cs @@ -6,15 +6,13 @@ namespace Inc.TeamAssistant.Reviewer.All.Internal; internal sealed class LanguageIdTypeHandler : SqlMapper.TypeHandler { - public override void SetValue(IDbDataParameter parameter, LanguageId languageId) + public override void SetValue(IDbDataParameter parameter, LanguageId? languageId) { if (parameter is null) throw new ArgumentNullException(nameof(parameter)); - if (languageId is null) - throw new ArgumentNullException(nameof(languageId)); parameter.DbType = DbType.String; - parameter.Value = languageId.Value; + parameter.Value = languageId?.Value; } public override LanguageId Parse(object value) diff --git a/src/Inc.TeamAssistant.WebUI/Components/About.razor b/src/Inc.TeamAssistant.WebUI/Components/About.razor index 619716f9..c2203351 100644 --- a/src/Inc.TeamAssistant.WebUI/Components/About.razor +++ b/src/Inc.TeamAssistant.WebUI/Components/About.razor @@ -44,10 +44,7 @@ resources[Messages.GUI_Scan], resources[Messages.GUI_ToStart]); - _model = await Service.GetLinkForConnect( - QrCode.DefaultWidth, - QrCode.DefaultHeight, - QrCode.DefaultDrawQuietZones); + _model = await Service.GetLinkForConnect(); await InvokeAsync(StateHasChanged); } diff --git a/src/Inc.TeamAssistant.WebUI/Components/Features/ViewModels/FeatureViewModel.cs b/src/Inc.TeamAssistant.WebUI/Components/Features/ViewModels/FeatureViewModel.cs index e5aee125..26f8a337 100644 --- a/src/Inc.TeamAssistant.WebUI/Components/Features/ViewModels/FeatureViewModel.cs +++ b/src/Inc.TeamAssistant.WebUI/Components/Features/ViewModels/FeatureViewModel.cs @@ -1,3 +1,5 @@ +using Inc.TeamAssistant.WebUI.ViewModels; + namespace Inc.TeamAssistant.WebUI.Components.Features.ViewModels; internal sealed record FeatureViewModel(ImageViewModel Image, Type Description); \ No newline at end of file diff --git a/src/Inc.TeamAssistant.WebUI/Components/InlineDialog.razor b/src/Inc.TeamAssistant.WebUI/Components/InlineDialog.razor index cd9b4a1e..354b95c9 100644 --- a/src/Inc.TeamAssistant.WebUI/Components/InlineDialog.razor +++ b/src/Inc.TeamAssistant.WebUI/Components/InlineDialog.razor @@ -22,6 +22,9 @@ protected override async Task OnInitializedAsync() { + if (CookieService.IsServerRender) + return; + var resources = await LanguageManager.GetResource(); _text = resources[Messages.GUI_AcceptCookieText]; diff --git a/src/Inc.TeamAssistant.WebUI/Inc.TeamAssistant.WebUI.csproj b/src/Inc.TeamAssistant.WebUI/Inc.TeamAssistant.WebUI.csproj index 6284a482..288c3f2c 100644 --- a/src/Inc.TeamAssistant.WebUI/Inc.TeamAssistant.WebUI.csproj +++ b/src/Inc.TeamAssistant.WebUI/Inc.TeamAssistant.WebUI.csproj @@ -3,10 +3,10 @@ true - - - - + + + + diff --git a/src/Inc.TeamAssistant.WebUI/Messages.cs b/src/Inc.TeamAssistant.WebUI/Messages.cs index 0f5395cd..39c5b6cc 100644 --- a/src/Inc.TeamAssistant.WebUI/Messages.cs +++ b/src/Inc.TeamAssistant.WebUI/Messages.cs @@ -60,4 +60,13 @@ internal sealed class Messages public static readonly string GUI_AcceptCookieButton = new(nameof(GUI_AcceptCookieButton)); public static readonly string GUI_AcceptCookieText = new(nameof(GUI_AcceptCookieText)); + + public static readonly string GUI_MainTitle = new(nameof(GUI_MainTitle)); + public static readonly string GUI_MainDescription = new(nameof(GUI_MainDescription)); + public static readonly string GUI_AppraiserDescription = new(nameof(GUI_AppraiserDescription)); + public static readonly string GUI_AppraiserImageAlt = new(nameof(GUI_AppraiserImageAlt)); + public static readonly string GUI_ReviewerDescription = new(nameof(GUI_ReviewerDescription)); + public static readonly string GUI_ReviewerImageAlt = new(nameof(GUI_ReviewerImageAlt)); + public static readonly string GUI_CheckInDescription = new(nameof(GUI_CheckInDescription)); + public static readonly string GUI_CheckInImageAlt = new(nameof(GUI_CheckInImageAlt)); } \ No newline at end of file diff --git a/src/Inc.TeamAssistant.WebUI/Pages/Annotations/AppraiserPageAnnotation.cs b/src/Inc.TeamAssistant.WebUI/Pages/Annotations/AppraiserPageAnnotation.cs new file mode 100644 index 00000000..8439e142 --- /dev/null +++ b/src/Inc.TeamAssistant.WebUI/Pages/Annotations/AppraiserPageAnnotation.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Components; + +namespace Inc.TeamAssistant.WebUI.Pages.Annotations; + +internal sealed record AppraiserPageAnnotation +{ + public MarkupString Features { get; } + public MarkupString Tools { get; } + public MarkupString Feedback { get; } + + public AppraiserPageAnnotation(string advantages, string tools, string feedback) + { + Features = (MarkupString)advantages; + Tools = (MarkupString)tools; + Feedback = (MarkupString)feedback; + } + + public static readonly AppraiserPageAnnotation Empty = new(string.Empty, string.Empty, string.Empty); +} \ No newline at end of file diff --git a/src/Inc.TeamAssistant.WebUI/Pages/Annotations/MainPageAnnotation.cs b/src/Inc.TeamAssistant.WebUI/Pages/Annotations/MainPageAnnotation.cs index 58610bc8..3383deee 100644 --- a/src/Inc.TeamAssistant.WebUI/Pages/Annotations/MainPageAnnotation.cs +++ b/src/Inc.TeamAssistant.WebUI/Pages/Annotations/MainPageAnnotation.cs @@ -4,16 +4,14 @@ namespace Inc.TeamAssistant.WebUI.Pages.Annotations; internal sealed record MainPageAnnotation { - public MarkupString Features { get; } - public MarkupString Tools { get; } - public MarkupString Feedback { get; } + public MarkupString MainTitle { get; } + public MarkupString MainDescription { get; } - public MainPageAnnotation(string advantages, string tools, string feedback) + public MainPageAnnotation(string mainTitle, string mainDescription) { - Features = (MarkupString)advantages; - Tools = (MarkupString)tools; - Feedback = (MarkupString)feedback; + MainTitle = (MarkupString)mainTitle; + MainDescription = (MarkupString)mainDescription; } - - public static readonly MainPageAnnotation Empty = new(string.Empty, string.Empty, string.Empty); + + public static readonly MainPageAnnotation Empty = new(string.Empty, string.Empty); } \ No newline at end of file diff --git a/src/Inc.TeamAssistant.WebUI/Pages/Appraiser.razor b/src/Inc.TeamAssistant.WebUI/Pages/Appraiser.razor new file mode 100644 index 00000000..cbd799dd --- /dev/null +++ b/src/Inc.TeamAssistant.WebUI/Pages/Appraiser.razor @@ -0,0 +1,56 @@ +@page "/appraiser" +@page "/en/appraiser" +@page "/ru/appraiser" + +@using Inc.TeamAssistant.WebUI.Pages.Annotations + +@inject LanguageManager LanguageManager + +
+
+
+ + +
+
+
+
+

@_annotation.Features

+ +
+
+
+
+

@_annotation.Tools

+ +
+
+ + +@code{ + private Features? _features; + + private AppraiserPageAnnotation _annotation = AppraiserPageAnnotation.Empty; + private string _moveToFeaturesUrl = string.Empty; + + protected override async Task OnInitializedAsync() + { + var resources = await LanguageManager.GetResource(); + var linkBuilder = LanguageManager.CreateLinkBuilder(); + + _annotation = new( + resources[Messages.GUI_Features], + resources[Messages.GUI_Tools], + resources[Messages.GUI_Feedback]); + _moveToFeaturesUrl = linkBuilder("appraiser#features"); + + await InvokeAsync(StateHasChanged); + } +} \ No newline at end of file diff --git a/src/Inc.TeamAssistant.WebUI/Pages/Appraiser.razor.css b/src/Inc.TeamAssistant.WebUI/Pages/Appraiser.razor.css new file mode 100644 index 00000000..d2de7305 --- /dev/null +++ b/src/Inc.TeamAssistant.WebUI/Pages/Appraiser.razor.css @@ -0,0 +1,55 @@ +.about { + padding: 8.5rem 0 1rem 0; + background: url('main/about/about__bg.jpg') 0 0/cover no-repeat; + position: relative; +} +.development, .features, .feedback { + padding: 5rem 0; +} +.white { + background-color: #fff; + color: #616161 +} +.move-to__button { + width: 40px; + height: 40px; + border: .1875rem solid #fff; + border-radius: 20px; + display: block; + position: relative; + margin: 1rem auto; + transition: background-color 0.3s ease 0s; +} +.move-to__button::after { + content: ' '; + border: solid #fff; + border-width: 0 0.1875rem 0.1875rem 0; + transform: rotate(45deg); + position: absolute; + left: 10px; + top: 8px; + width: 14px; + height: 14px; +} +.move-to:hover .move-to__button { + background-color: #fff; +} +.move-to:hover .move-to__button::after { + border: solid #000; + border-width: 0 0.1875rem 0.1875rem 0; +} +@media (max-width: 991.98px) { + .about { + padding: 6rem 0 1rem 0; + } +} +@media (max-width: 767.98px) { + .about { + padding: 7rem 0 1rem 0; + } +} +@media (max-width: 479.98px) { + .features, .development, .feedback { + padding: 2rem 0; + } +} \ No newline at end of file diff --git a/src/Inc.TeamAssistant.WebUI/Pages/AssessmentSession.razor b/src/Inc.TeamAssistant.WebUI/Pages/AssessmentSession.razor index b5e16df4..d085255d 100644 --- a/src/Inc.TeamAssistant.WebUI/Pages/AssessmentSession.razor +++ b/src/Inc.TeamAssistant.WebUI/Pages/AssessmentSession.razor @@ -122,11 +122,7 @@ private async Task StoryChanged() { - _model = await Service.GetStoryDetails( - new(Id), - QrCode.DefaultWidth, - QrCode.DefaultHeight, - QrCode.DefaultDrawQuietZones); + _model = await Service.GetStoryDetails(new(Id)); await InvokeAsync(StateHasChanged); } diff --git a/src/Inc.TeamAssistant.WebUI/Pages/Main.razor b/src/Inc.TeamAssistant.WebUI/Pages/Main.razor index 17cc1435..8108f6a3 100644 --- a/src/Inc.TeamAssistant.WebUI/Pages/Main.razor +++ b/src/Inc.TeamAssistant.WebUI/Pages/Main.razor @@ -3,54 +3,72 @@ @page "/ru" @using Inc.TeamAssistant.WebUI.Pages.Annotations +@using Inc.TeamAssistant.WebUI.Pages.ViewModels +@using Inc.TeamAssistant.WebUI.ViewModels @inject LanguageManager LanguageManager -
-
-
- - -
-
-
-
-

@_annotation.Features

- -
-
-
-
-

@_annotation.Tools

- +@layout DefaultLayout + + -