From 257c710f1ba8fc420c87c61c4505889ad2aefce1 Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Wed, 29 Sep 2021 01:20:29 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=E8=A6=81=E3=82=89=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=81=AE=E3=81=A7=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bolide_front/Shared/NavMenu.razor | 37 --------------- bolide_front/Shared/NavMenu.razor.css | 62 -------------------------- bolide_front/Shared/SurveyPrompt.razor | 16 ------- 3 files changed, 115 deletions(-) delete mode 100644 bolide_front/Shared/NavMenu.razor delete mode 100644 bolide_front/Shared/NavMenu.razor.css delete mode 100644 bolide_front/Shared/SurveyPrompt.razor diff --git a/bolide_front/Shared/NavMenu.razor b/bolide_front/Shared/NavMenu.razor deleted file mode 100644 index c83eb08..0000000 --- a/bolide_front/Shared/NavMenu.razor +++ /dev/null @@ -1,37 +0,0 @@ - - -
- -
- -@code { - private bool collapseNavMenu = true; - - private string NavMenuCssClass => collapseNavMenu ? "collapse" : null; - - private void ToggleNavMenu() - { - collapseNavMenu = !collapseNavMenu; - } -} diff --git a/bolide_front/Shared/NavMenu.razor.css b/bolide_front/Shared/NavMenu.razor.css deleted file mode 100644 index acc5f9f..0000000 --- a/bolide_front/Shared/NavMenu.razor.css +++ /dev/null @@ -1,62 +0,0 @@ -.navbar-toggler { - background-color: rgba(255, 255, 255, 0.1); -} - -.top-row { - height: 3.5rem; - background-color: rgba(0,0,0,0.4); -} - -.navbar-brand { - font-size: 1.1rem; -} - -.oi { - width: 2rem; - font-size: 1.1rem; - vertical-align: text-top; - top: -2px; -} - -.nav-item { - font-size: 0.9rem; - padding-bottom: 0.5rem; -} - - .nav-item:first-of-type { - padding-top: 1rem; - } - - .nav-item:last-of-type { - padding-bottom: 1rem; - } - - .nav-item ::deep a { - color: #d7d7d7; - border-radius: 4px; - height: 3rem; - display: flex; - align-items: center; - line-height: 3rem; - } - -.nav-item ::deep a.active { - background-color: rgba(255,255,255,0.25); - color: white; -} - -.nav-item ::deep a:hover { - background-color: rgba(255,255,255,0.1); - color: white; -} - -@media (min-width: 641px) { - .navbar-toggler { - display: none; - } - - .collapse { - /* Never collapse the sidebar for wide screens */ - display: block; - } -} diff --git a/bolide_front/Shared/SurveyPrompt.razor b/bolide_front/Shared/SurveyPrompt.razor deleted file mode 100644 index 1ec40da..0000000 --- a/bolide_front/Shared/SurveyPrompt.razor +++ /dev/null @@ -1,16 +0,0 @@ - - -@code { - // Demonstrates how a parent component can supply parameters - [Parameter] - public string Title { get; set; } -} From 91671bbf00c54c1d301e6aa79e37fc4f1f3da85b Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Wed, 29 Sep 2021 01:20:49 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=E3=82=AF=E3=82=A8=E3=83=AA=E3=83=91?= =?UTF-8?q?=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF=E3=81=AB=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E3=81=AA=E3=83=A9=E3=82=A4=E3=83=96=E3=83=A9=E3=83=AA=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bolide_front/bolide_front.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/bolide_front/bolide_front.csproj b/bolide_front/bolide_front.csproj index 143d8e9..35f0b4f 100644 --- a/bolide_front/bolide_front.csproj +++ b/bolide_front/bolide_front.csproj @@ -7,6 +7,7 @@ + From 6239920d54f89476e886b78c1270651abdaf6ac1 Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Wed, 29 Sep 2021 01:21:09 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=E3=82=AF=E3=82=A8=E3=83=AA=E3=83=91?= =?UTF-8?q?=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF=E3=83=BC=E3=82=92=E6=8B=BE?= =?UTF-8?q?=E3=81=86=E5=87=A6=E7=90=86=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bolide_front/Pages/Index.razor | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/bolide_front/Pages/Index.razor b/bolide_front/Pages/Index.razor index d22e0ea..dad6f55 100644 --- a/bolide_front/Pages/Index.razor +++ b/bolide_front/Pages/Index.razor @@ -1,9 +1,11 @@ @page "/" +@using Microsoft.AspNetCore.WebUtilities +@inject NavigationManager NavigationManager

@state

@if (isConnected) { -

ルーム名:@roomName

+

ルーム名:@RoomName

@@ -17,7 +19,7 @@ } else { - + } @@ -28,17 +30,27 @@ else private Connection connection; string state = "未接続"; List logs = new List(); - string roomName = ""; + [Parameter] + public string RoomName { get; set; } = ""; string comment = ""; + protected override void OnInitialized() + { + var uri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri); + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("roomname", out var roomName)) + { + RoomName = roomName; + Connect(); + } + } private void Connect() { - if (roomName == "") + if (RoomName == "") { state = "room名が空です"; StateHasChanged(); return; } - connection = new Connection(false, roomName, "https://bolide.digicre.net/","wss://bolide.digicre.net/"); + connection = new Connection(false, RoomName, "https://bolide.digicre.net/","wss://bolide.digicre.net/"); connection.ConnectionStartHandler += (sender, e) => { state = "接続済"; From 3f51e3c1bbfcaf60a58063418edccd856dc60d7e Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Wed, 29 Sep 2021 02:19:40 +0900 Subject: [PATCH 4/7] =?UTF-8?q?Scroll=E5=87=A6=E7=90=86=E3=81=AEJS?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bolide_front/wwwroot/index.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bolide_front/wwwroot/index.html b/bolide_front/wwwroot/index.html index 8cafd86..72c2815 100644 --- a/bolide_front/wwwroot/index.html +++ b/bolide_front/wwwroot/index.html @@ -24,6 +24,13 @@ + + + From f74827c0230ffdc29ad1fd75a2fd2f3c3baae7ce Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Wed, 29 Sep 2021 02:20:05 +0900 Subject: [PATCH 5/7] =?UTF-8?q?YoutubeLive=E5=BD=A2=E5=BC=8F=E3=81=AE?= =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=83=9A=E3=83=BC=E3=82=B8=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bolide_front/Pages/Viewer.razor | 67 +++++++++++++++++++++++++++++ bolide_front/Pages/Viewer.razor.css | 21 +++++++++ 2 files changed, 88 insertions(+) create mode 100644 bolide_front/Pages/Viewer.razor create mode 100644 bolide_front/Pages/Viewer.razor.css diff --git a/bolide_front/Pages/Viewer.razor b/bolide_front/Pages/Viewer.razor new file mode 100644 index 0000000..8bece48 --- /dev/null +++ b/bolide_front/Pages/Viewer.razor @@ -0,0 +1,67 @@ +@page "/view" +@using Microsoft.AspNetCore.WebUtilities +@inject NavigationManager NavigationManager +@inject IJSRuntime JSRuntime; + +
+@if (isConnected) +{ +
+ @foreach (var log in logs) + { +

@log

+ } +
+ +} +else +{ +

Room名が未指定です

+} +
+ +@code { + bool isConnected = false; + private Connection connection; + List logs = new List(); + [Parameter] + public string RoomName { get; set; } = ""; + protected override void OnInitialized() + { + var uri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri); + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("roomname", out var roomName)) + { + RoomName = roomName; + Connect(); + } + } + private void Connect() + { + connection = new Connection(false, RoomName, "https://bolide.digicre.net/","wss://bolide.digicre.net/"); + connection.ConnectionStartHandler += (sender, e) => + { + isConnected = true; + StateHasChanged(); + }; + connection.CommentEventHandler += (sender, e) => + { + logs.Add(e.comment); + JSRuntime.InvokeVoidAsync("scrollToEnd"); + StateHasChanged(); + }; + connection.ConnectionErrorHandler += (sender, e) => + { + switch(e.erorrKind){ + case Connection.ErorrKind.WebsocketClosed: + StateHasChanged(); + Connect(); + break; + case Connection.ErorrKind.WebsocketError: + StateHasChanged(); + break; + } + }; + connection.StartConnection(); + + } +} diff --git a/bolide_front/Pages/Viewer.razor.css b/bolide_front/Pages/Viewer.razor.css new file mode 100644 index 0000000..738611f --- /dev/null +++ b/bolide_front/Pages/Viewer.razor.css @@ -0,0 +1,21 @@ +html { + height: 100%; +} + +#comment-view { + height: 85vh; + overflow-y: scroll; + -ms-overflow-style: none; + scrollbar-width: none; + overflow-wrap: break-word; +} +#comment-view::-webkit-scrollbar { + display: none; + white-space: pre-wrap; +} + +.comment-box { + background-color: rgb(216, 216, 216); + border-radius: 5px; + padding: 2px; +} From ba166699878aa671e911d24bd586b72bb94b46f9 Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Wed, 29 Sep 2021 03:29:05 +0900 Subject: [PATCH 6/7] =?UTF-8?q?Comment=E3=82=AF=E3=83=A9=E3=82=B9=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bolide_front/Comment.cs | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 bolide_front/Comment.cs diff --git a/bolide_front/Comment.cs b/bolide_front/Comment.cs new file mode 100644 index 0000000..2247a9e --- /dev/null +++ b/bolide_front/Comment.cs @@ -0,0 +1,5 @@ +class Comment +{ + public string text { get; set; } + public bool isQuestion { get; set; } +} \ No newline at end of file From 885e1fb47a280c27ba51146d73aa6f07f27b64b0 Mon Sep 17 00:00:00 2001 From: MogamiTsuchikawa Date: Wed, 29 Sep 2021 03:35:31 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=E8=B3=AA=E5=95=8F=E5=88=87=E6=9B=BF?= =?UTF-8?q?=E3=81=AB=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); +}