-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from SIT-DigiCre/develop
9月アップデート分
- Loading branch information
Showing
9 changed files
with
154 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Comment | ||
{ | ||
public string text { get; set; } | ||
public bool isQuestion { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
@page "/view" | ||
@using Microsoft.AspNetCore.WebUtilities | ||
@inject NavigationManager NavigationManager | ||
@inject IJSRuntime JSRuntime; | ||
|
||
<div class="main"> | ||
@if (isConnected) | ||
{ | ||
<div id="comment-view"> | ||
@foreach (var c in comments) | ||
{ | ||
@if (c.isQuestion) | ||
{ | ||
<p class="comment-box question">@c.text</p> | ||
} | ||
else | ||
{ | ||
<p class="comment-box">@c.text</p> | ||
} | ||
|
||
} | ||
</div> | ||
|
||
} | ||
else | ||
{ | ||
<h1>Room名が未指定です</h1> | ||
} | ||
</div> | ||
|
||
@code { | ||
bool isConnected = false; | ||
private Connection connection; | ||
List<Comment> comments = new List<Comment>(); | ||
[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) => | ||
{ | ||
comments.Add(new Comment(){ text=e.comment, isQuestion=e.isQuestion }); | ||
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(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
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; | ||
} | ||
|
||
.question { | ||
background-color: rgb(255, 194, 80); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters