From 885e1fb47a280c27ba51146d73aa6f07f27b64b0 Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Wed, 29 Sep 2021 03:35:31 +0900 Subject: [PATCH] =?UTF-8?q?=E8=B3=AA=E5=95=8F=E5=88=87=E6=9B=BF=E3=81=AB?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bolide_front/Pages/Index.razor | 36 ++++++++++++++++++++--------- bolide_front/Pages/Viewer.razor | 16 +++++++++---- bolide_front/Pages/Viewer.razor.css | 4 ++++ 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/bolide_front/Pages/Index.razor b/bolide_front/Pages/Index.razor index dad6f55..c8b1ec6 100644 --- a/bolide_front/Pages/Index.razor +++ b/bolide_front/Pages/Index.razor @@ -2,19 +2,32 @@ @using Microsoft.AspNetCore.WebUtilities @inject NavigationManager NavigationManager -

@state

+

@state - ルーム名:@RoomName

@if (isConnected) { -

ルーム名:@RoomName

-
- -
- + +
+ + +
+
+ +
+ +
- @foreach (var log in logs) + @foreach (var c in comments) { -

@log

+ @if (c.isQuestion) + { +

[質問]@c.text

+ } + else + { +

@c.text

+ } + } } else @@ -29,10 +42,11 @@ else bool isConnected = false; private Connection connection; string state = "未接続"; - List logs = new List(); + List comments = new List(); [Parameter] public string RoomName { get; set; } = ""; string comment = ""; + public bool isQuestion { get; set; } = false; protected override void OnInitialized() { var uri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri); @@ -59,7 +73,7 @@ else }; connection.CommentEventHandler += (sender, e) => { - logs.Insert(0, e.comment); + comments.Insert(0, new Comment(){ text=e.comment, isQuestion=e.isQuestion }); StateHasChanged(); }; connection.ConnectionErrorHandler += (sender, e) => @@ -83,7 +97,7 @@ else { if (connection == null) return; if(comment=="")return; - connection.PostComment(comment, false); + connection.PostComment(comment, isQuestion); comment = ""; StateHasChanged(); } diff --git a/bolide_front/Pages/Viewer.razor b/bolide_front/Pages/Viewer.razor index 8bece48..7e8fbc9 100644 --- a/bolide_front/Pages/Viewer.razor +++ b/bolide_front/Pages/Viewer.razor @@ -7,9 +7,17 @@ @if (isConnected) {
- @foreach (var log in logs) + @foreach (var c in comments) { -

@log

+ @if (c.isQuestion) + { +

@c.text

+ } + else + { +

@c.text

+ } + }
@@ -23,7 +31,7 @@ else @code { bool isConnected = false; private Connection connection; - List logs = new List(); + List comments = new List(); [Parameter] public string RoomName { get; set; } = ""; protected override void OnInitialized() @@ -45,7 +53,7 @@ else }; connection.CommentEventHandler += (sender, e) => { - logs.Add(e.comment); + comments.Add(new Comment(){ text=e.comment, isQuestion=e.isQuestion }); JSRuntime.InvokeVoidAsync("scrollToEnd"); StateHasChanged(); }; diff --git a/bolide_front/Pages/Viewer.razor.css b/bolide_front/Pages/Viewer.razor.css index 738611f..e66d032 100644 --- a/bolide_front/Pages/Viewer.razor.css +++ b/bolide_front/Pages/Viewer.razor.css @@ -19,3 +19,7 @@ html { border-radius: 5px; padding: 2px; } + +.question { + background-color: rgb(255, 194, 80); +}