Skip to content

Commit af3f9ea

Browse files
Merge pull request #326 from michaelchessall/persistence_testing
Persistence testing
2 parents 1175ce5 + 73b5b1d commit af3f9ea

25 files changed

Lines changed: 817 additions & 53 deletions

File tree

Content.Client/Content.Client.csproj

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
<WarningsAsErrors>RA0032;nullable</WarningsAsErrors>
77
</PropertyGroup>
88
<Import Project="../MSBuild/Content.props" />
9+
<ItemGroup>
10+
<None Remove="MessageBoard\UI\MessageBoard.xaml~RF197aa77f.TMP" />
11+
</ItemGroup>
912
<ItemGroup>
1013
<PackageReference Include="Nett" />
1114
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" />
@@ -30,6 +33,18 @@
3033
<AdditionalFiles Update="GridControl\UI\StationTaggerWindow.xaml">
3134
<Generator>MSBuild:Compile</Generator>
3235
</AdditionalFiles>
36+
<AdditionalFiles Update="MessageBoard\UI\CommentHeader.xaml">
37+
<Generator>MSBuild:Compile</Generator>
38+
</AdditionalFiles>
39+
<AdditionalFiles Update="MessageBoard\UI\CreateEntry.xaml">
40+
<Generator>MSBuild:Compile</Generator>
41+
</AdditionalFiles>
42+
<AdditionalFiles Update="MessageBoard\UI\EntryHeader.xaml">
43+
<Generator>MSBuild:Compile</Generator>
44+
</AdditionalFiles>
45+
<AdditionalFiles Update="MessageBoard\UI\EntryWindow.xaml">
46+
<Generator>MSBuild:Compile</Generator>
47+
</AdditionalFiles>
3348
</ItemGroup>
3449

3550
<ItemGroup>
@@ -82,6 +97,9 @@
8297
<ItemGroup>
8398
<EmbeddedResource Update="CrewAssignments\UI\StationModificationMenu.xaml" />
8499
</ItemGroup>
100+
<ItemGroup>
101+
<EmbeddedResource Update="MessageBoard\UI\MessageBoard.xaml" />
102+
</ItemGroup>
85103
<ItemGroup>
86104
<EmbeddedResource Update="_NF\Bank\UI\BankATMMenu.xaml">
87105
<Generator>MSBuild:Compile</Generator>
@@ -93,4 +111,7 @@
93111
<Generator>MSBuild:Compile</Generator>
94112
</EmbeddedResource>
95113
</ItemGroup>
114+
<ItemGroup>
115+
<Folder Include="MessageBoard\Systems\" />
116+
</ItemGroup>
96117
</Project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<PanelContainer xmlns="https://spacestation14.io" StyleClasses="BackgroundPanel" HorizontalExpand="True" MinHeight="30" Margin="10 10 10 0">
2+
<BoxContainer HorizontalExpand="True" Orientation="Vertical">
3+
<BoxContainer Orientation="Horizontal">
4+
<Label Name="CommentLabel" Text="Looks Very Cool!" />
5+
</BoxContainer>
6+
<BoxContainer Orientation="Horizontal">
7+
<Label Access="Public" Name="AuthorLabel" Text="Posted by Chester Cheetah on 2248-05-01 14:17" />
8+
<Control HorizontalExpand="True" />
9+
<Button Text="Delete" Name="DeleteButton" Access="Public" />
10+
</BoxContainer>
11+
</BoxContainer>
12+
</PanelContainer>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Robust.Client.AutoGenerated;
2+
using Robust.Client.UserInterface.Controls;
3+
using Robust.Client.UserInterface.CustomControls;
4+
using Robust.Client.UserInterface.XAML;
5+
6+
namespace Content.Client.MessageBoard.UI;
7+
8+
[GenerateTypedNameReferences]
9+
public sealed partial class CommentHeader : PanelContainer
10+
{
11+
public CommentHeader(string content, string author, string date, bool deleteEnabled)
12+
{
13+
RobustXamlLoader.Load(this);
14+
IoCManager.InjectDependencies(this);
15+
16+
CommentLabel.Text = content;
17+
AuthorLabel.Text = $"Posted by {author} on {date}";
18+
DeleteButton.Visible = deleteEnabled;
19+
}
20+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<DefaultWindow xmlns="https://spacestation14.io"
2+
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
3+
Title="Create Entry">
4+
<BoxContainer Orientation="Vertical" MinSize="550 350">
5+
<BoxContainer Orientation="Horizontal">
6+
<Label Text ="Title:"></Label>
7+
<LineEdit Name="MainTitleLabel" PlaceHolder="Title Label" Access="Public" HorizontalExpand="True"/>
8+
</BoxContainer>
9+
<customControls:HSeparator Margin="5 10 5 10"/>
10+
<Label Text ="Content:"></Label>
11+
<PanelContainer StyleIdentifier="PaperEditBackground" VerticalExpand="True" HorizontalExpand="True">
12+
<TextEdit Name="DescriptionLabel" Access="Public" HorizontalExpand="True" VerticalExpand="True"/>
13+
</PanelContainer>
14+
<Button Name="PostButton" Text="Post Entry" Access="Public" />
15+
</BoxContainer>
16+
</DefaultWindow>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Robust.Client.AutoGenerated;
2+
using Robust.Client.UserInterface.CustomControls;
3+
4+
namespace Content.Client.MessageBoard.UI;
5+
[GenerateTypedNameReferences]
6+
public sealed partial class CreateEntry : DefaultWindow
7+
{
8+
public enum EntryType : byte
9+
{
10+
Public,
11+
Direct
12+
}
13+
14+
public EntryType CurrentEntryType = EntryType.Public;
15+
16+
}
17+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<PanelContainer xmlns="https://spacestation14.io" StyleClasses="BackgroundPanel" HorizontalExpand="True" MinHeight="30" Margin="10 10 10 0">
2+
<BoxContainer HorizontalExpand="True" Orientation="Vertical">
3+
<BoxContainer Orientation="Horizontal">
4+
<Label Name="TitleLabel" Text="(JOB) Looking for engineers to help with a shuttle." StyleClasses="LabelKeyText" />
5+
<Control HorizontalExpand="True" />
6+
<Button Text="View" Name="ViewButton" Access="Public" />
7+
</BoxContainer>
8+
<BoxContainer Orientation="Horizontal">
9+
<Label Access="Public" Name="AuthorLabel" Text="Posted by Chester Cheetah" />
10+
<Control HorizontalExpand="True" />
11+
<Button Text="Delete" Name="DeleteButton" Access="Public" />
12+
</BoxContainer>
13+
<BoxContainer Orientation="Horizontal">
14+
<Label Access="Public" Name="DateLabel" Text="14:17 2246-05-01" />
15+
<Control HorizontalExpand="True" />
16+
<Label Access="Public" Name="CommentsLabel" Text="0 Comments" />
17+
</BoxContainer>
18+
</BoxContainer>
19+
</PanelContainer>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Robust.Client.AutoGenerated;
2+
using Robust.Client.UserInterface.Controls;
3+
using Robust.Client.UserInterface.CustomControls;
4+
using Robust.Client.UserInterface.XAML;
5+
6+
namespace Content.Client.MessageBoard.UI;
7+
8+
[GenerateTypedNameReferences]
9+
public sealed partial class EntryHeader : PanelContainer
10+
{
11+
public EntryHeader(string title, string author, string date, int commentCount, bool deleteEnabled)
12+
{
13+
RobustXamlLoader.Load(this);
14+
IoCManager.InjectDependencies(this);
15+
16+
TitleLabel.Text = title;
17+
AuthorLabel.Text = $"Posted by {author}";
18+
DateLabel.Text = date;
19+
CommentsLabel.Text = $"{commentCount} Comments";
20+
DeleteButton.Visible = deleteEnabled;
21+
}
22+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<DefaultWindow xmlns="https://spacestation14.io"
2+
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
3+
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
4+
Title="Entry Title">
5+
<BoxContainer Orientation="Vertical" MinSize="550 550">
6+
<BoxContainer Orientation="Vertical">
7+
<Label Text ="Title:" Name="MainTitleLabel"></Label>
8+
<Label Name="AuthorLabel"></Label>
9+
</BoxContainer>
10+
<customControls:HSeparator Margin="5 10 5 10"/>
11+
<PanelContainer StyleIdentifier="PaperEditBackground" MinHeight="300" HorizontalExpand="True">
12+
<ScrollContainer HorizontalExpand="True" VerticalExpand="True">
13+
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical" Margin="5 10 5 10">
14+
<RichTextLabel Name="MainContentLabel" Access="Public" HorizontalExpand="True" VerticalExpand="True" VerticalAlignment="Top"/>
15+
</BoxContainer>
16+
</ScrollContainer>
17+
</PanelContainer>
18+
<PanelContainer VerticalExpand="True" HorizontalExpand="True" Name="PublicBoardEntriesPC">
19+
<PanelContainer.PanelOverride>
20+
<gfx:StyleBoxFlat BackgroundColor="#000000" />
21+
</PanelContainer.PanelOverride>
22+
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" HScrollEnabled="False">
23+
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical" Margin="5 10 5 10">
24+
<PanelContainer StyleClasses="BackgroundPanel" HorizontalExpand="True" MinHeight="30" Margin="10 10 10 0">
25+
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
26+
<LineEdit Name="AddCommentLE" HorizontalExpand="True" PlaceHolder="Add a comment" Access="Public"/>
27+
<Button Name="AddCommentBtn" Text="Add Comment" Access="Public"/>
28+
</BoxContainer>
29+
</PanelContainer>
30+
<BoxContainer Orientation="Vertical" Name="CommentBC"></BoxContainer>
31+
</BoxContainer>
32+
</ScrollContainer>
33+
</PanelContainer>
34+
35+
</BoxContainer>
36+
</DefaultWindow>
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using Content.Client.Message;
2+
using Content.Shared.CCVar;
3+
using Content.Shared.MessageBoard.Components;
4+
using Robust.Client.AutoGenerated;
5+
using Robust.Client.UserInterface.Controls;
6+
using Robust.Client.UserInterface.CustomControls;
7+
using Robust.Client.UserInterface.XAML;
8+
using Robust.Shared.Configuration;
9+
10+
11+
namespace Content.Client.MessageBoard.UI;
12+
13+
[GenerateTypedNameReferences]
14+
public sealed partial class EntryWindow : DefaultWindow
15+
{
16+
[Dependency] private readonly IConfigurationManager _cfg = default!;
17+
18+
public MessageBoardEntry Entry;
19+
private bool _isAdmin;
20+
private string _playerName;
21+
private MessageBoardBoundUserInterface _owner;
22+
23+
public EntryWindow(MessageBoardEntry entry, bool isAdmin, string playerName, MessageBoardBoundUserInterface owner)
24+
{
25+
_owner = owner;
26+
RobustXamlLoader.Load(this);
27+
IoCManager.InjectDependencies(this);
28+
Entry = entry;
29+
this.Title = entry.Title;
30+
_isAdmin = isAdmin;
31+
_playerName = playerName;
32+
MainTitleLabel.Text = entry.Title;
33+
var adjustedMainTime = entry.CreationTime.AddYears(_cfg.GetCVar(CCVars.YearOffset));
34+
AuthorLabel.Text = $"Posted by {entry.Author} on {adjustedMainTime.ToString()}";
35+
MainContentLabel.SetMarkup(entry.Body);
36+
entry.Comments.Reverse();
37+
foreach (var comment in entry.Comments)
38+
{
39+
var adjustedTime = comment.CreationTime.AddYears(_cfg.GetCVar(CCVars.YearOffset));
40+
bool delete = false;
41+
if (_isAdmin || _playerName == comment.Author) delete = true;
42+
var item = new CommentHeader(comment.Body, comment.Author, $"{adjustedTime.ToString()}", delete);
43+
CommentBC.AddChild(item);
44+
item.DeleteButton.OnPressed += (args) =>
45+
{
46+
var ID = comment.UID;
47+
_owner.SendMessage(new MessageBoardDeleteCommentPublicMessage(ID, Entry.UID));
48+
};
49+
}
50+
51+
}
52+
53+
public void UpdateEntry(MessageBoardEntry entry)
54+
{
55+
Entry = entry;
56+
this.Title = entry.Title;
57+
MainTitleLabel.Text = entry.Title;
58+
var adjustedMainTime = entry.CreationTime.AddYears(_cfg.GetCVar(CCVars.YearOffset));
59+
AuthorLabel.Text = $"Posted by {entry.Author} on {adjustedMainTime.ToString()}";
60+
MainContentLabel.SetMarkup(entry.Body);
61+
CommentBC.RemoveAllChildren();
62+
entry.Comments.Reverse();
63+
foreach (var comment in entry.Comments)
64+
{
65+
var adjustedTime = comment.CreationTime.AddYears(_cfg.GetCVar(CCVars.YearOffset));
66+
bool delete = false;
67+
if (_isAdmin || _playerName == comment.Author) delete = true;
68+
CommentBC.AddChild(new CommentHeader(comment.Body, comment.Author, $"{adjustedTime.ToString()}", delete));
69+
}
70+
}
71+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<controls:FancyWindow xmlns="https://spacestation14.io"
2+
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
3+
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
4+
SetSize="600 690"
5+
MinSize="600 690">
6+
<BoxContainer Orientation="Vertical">
7+
<ScrollContainer VerticalExpand="True">
8+
<TabContainer>
9+
<BoxContainer Orientation="Vertical" Name="PublicBoard">
10+
<Button Text="Create A New Entry" Name="CreateEntryPublicButton" Access="Public" />
11+
<PanelContainer VerticalExpand="True"
12+
HorizontalExpand="True"
13+
SizeFlagsStretchRatio="1"
14+
Name="PublicBoardEntriesPC">
15+
<PanelContainer.PanelOverride>
16+
<gfx:StyleBoxFlat BackgroundColor="#000000" />
17+
</PanelContainer.PanelOverride>
18+
<ScrollContainer VerticalExpand="True">
19+
<BoxContainer Orientation="Vertical" Margin="5" MinHeight ="10">
20+
<BoxContainer Name="PublicBoardEntriesBC"
21+
Orientation="Vertical"
22+
VerticalExpand="True"
23+
Access="Public">
24+
</BoxContainer>
25+
</BoxContainer>
26+
</ScrollContainer>
27+
</PanelContainer>
28+
</BoxContainer>
29+
<BoxContainer Orientation="Vertical" Name="DirectMessages">
30+
<Label Text="Send Message: " StyleClasses="LabelKeyText"/>
31+
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
32+
<LineEdit Name="SendMessageLE" PlaceHolder="Recipient Name" HorizontalExpand="True"/>
33+
<Button Text="Compose Message" Name="SendMessageButton" Access="Public" />
34+
</BoxContainer>
35+
</BoxContainer>
36+
</TabContainer>
37+
</ScrollContainer>
38+
</BoxContainer>
39+
</controls:FancyWindow>

0 commit comments

Comments
 (0)