-
Notifications
You must be signed in to change notification settings - Fork 14
/
MessagePage.razor
149 lines (136 loc) · 5.5 KB
/
MessagePage.razor
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
@page "/messages/{MessageId:int}"
<Title Value="@string.Join(" - ", $"Message #{MessageId}", "Unturned Store")"></Title>
<Meta name="description" content="Marketplace of products for Unturned" />
<Meta property="og:title" content="@($"Message #{MessageId}")" />
<Meta property="og:image" content="/img/logo.png" />
<Meta property="og:image:width" content="128" />
<Meta property="og:image:height" content="128" />
<Meta property="og:description" content="Marketplace of products for Unturned" />
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/messages">Messages</a></li>
<li class="breadcrumb-item active" aria-current="page">@MessageId</li>
</ol>
</nav>
@if (Message != null)
{
<div class="mb-3">
<div class="mb-3">
<h2><span class="fw-bold">Topic:</span> @Message.Title</h2>
</div>
@foreach (var reply in Message.Replies.OrderBy(x => x.CreateDate))
{
<div class="mb-3">
<div class="card">
<div class="card-header">
<div class="d-flex align-items-center">
<Username User="User(reply.UserId)" />
<div class="ms-auto">
@if (steamAuth.User.Id == reply.UserId)
{
<button class="btn btn-sm btn-outline-danger" @onclick="() => DeleteReplyAsync(reply)">
<i class="bi bi-trash-fill"></i>
</button>
}
</div>
</div>
</div>
<div class="card-body">
<div>
@(new MarkupString(reply.Content))
</div>
<div class="text-muted">
@reply.CreateDate
</div>
</div>
</div>
</div>
}
@if (!Message.IsClosed)
{
<div class="mb-3">
<div class="card">
<div class="card-header">
<div class="fw-bold">
Write a new reply
</div>
</div>
<div class="card-body">
<div class="mb-3">
<BlazoredTextEditor @ref="editor" DebugLevel="error">
<ToolbarContent>
<select class="ql-header">
<option selected=""></option>
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
<option value="4"></option>
<option value="5"></option>
</select>
<span class="ql-formats">
<button class="ql-bold"></button>
<button class="ql-italic"></button>
<button class="ql-underline"></button>
<button class="ql-strike"></button>
</span>
<span class="ql-formats">
<select class="ql-color"></select>
<select class="ql-background"></select>
</span>
<span class="ql-formats">
<button class="ql-list" value="ordered"></button>
<button class="ql-list" value="bullet"></button>
</span>
<span class="ql-formats">
<button class="ql-code-block"></button>
</span>
</ToolbarContent>
</BlazoredTextEditor>
</div>
<div class="mb-3 d-flex align-content-center">
<div>
@if (msg != null)
{
<span class="text-danger">@msg</span>
}
</div>
<div class="ms-auto">
<button class="btn btn-secondary me-2" @onclick="CloseAsync"><i class="bi bi-exclamation-circle"></i> Close</button>
@if (isLoading)
{
<LoadingButton />
}
else
{
<button class="btn btn-primary" @onclick="AddReplyAsync">Send Reply</button>
}
</div>
</div>
</div>
</div>
</div>
} else
{
<div class="mb-3">
<div class="alert alert-secondary" role="alert">
This message was closed by @User(Message.ClosingUserId)
</div>
</div>
}
</div>
}
else
{
if (statusCode == System.Net.HttpStatusCode.NoContent)
{
<h4>Message not found</h4>
}
else if (statusCode == System.Net.HttpStatusCode.BadRequest)
{
<h4>You don't have access to this message</h4>
}
else
{
<Progressbar />
}
}