Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Content.Client/Content.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<WarningsAsErrors>RA0032;nullable</WarningsAsErrors>
</PropertyGroup>
<Import Project="../MSBuild/Content.props" />
<ItemGroup>
<None Remove="MessageBoard\UI\MessageBoard.xaml~RF197aa77f.TMP" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Nett" />
<PackageReference Include="JetBrains.Annotations" PrivateAssets="All" />
Expand All @@ -30,6 +33,18 @@
<AdditionalFiles Update="GridControl\UI\StationTaggerWindow.xaml">
<Generator>MSBuild:Compile</Generator>
</AdditionalFiles>
<AdditionalFiles Update="MessageBoard\UI\CommentHeader.xaml">
<Generator>MSBuild:Compile</Generator>
</AdditionalFiles>
<AdditionalFiles Update="MessageBoard\UI\CreateEntry.xaml">
<Generator>MSBuild:Compile</Generator>
</AdditionalFiles>
<AdditionalFiles Update="MessageBoard\UI\EntryHeader.xaml">
<Generator>MSBuild:Compile</Generator>
</AdditionalFiles>
<AdditionalFiles Update="MessageBoard\UI\EntryWindow.xaml">
<Generator>MSBuild:Compile</Generator>
</AdditionalFiles>
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -82,6 +97,9 @@
<ItemGroup>
<EmbeddedResource Update="CrewAssignments\UI\StationModificationMenu.xaml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="MessageBoard\UI\MessageBoard.xaml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="_NF\Bank\UI\BankATMMenu.xaml">
<Generator>MSBuild:Compile</Generator>
Expand All @@ -93,4 +111,7 @@
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="MessageBoard\Systems\" />
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions Content.Client/MessageBoard/UI/CommentHeader.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<PanelContainer xmlns="https://spacestation14.io" StyleClasses="BackgroundPanel" HorizontalExpand="True" MinHeight="30" Margin="10 10 10 0">
<BoxContainer HorizontalExpand="True" Orientation="Vertical">
<BoxContainer Orientation="Horizontal">
<Label Name="CommentLabel" Text="Looks Very Cool!" />
</BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Access="Public" Name="AuthorLabel" Text="Posted by Chester Cheetah on 2248-05-01 14:17" />
<Control HorizontalExpand="True" />
<Button Text="Delete" Name="DeleteButton" Access="Public" />
</BoxContainer>
</BoxContainer>
</PanelContainer>
20 changes: 20 additions & 0 deletions Content.Client/MessageBoard/UI/CommentHeader.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.MessageBoard.UI;

[GenerateTypedNameReferences]
public sealed partial class CommentHeader : PanelContainer
{
public CommentHeader(string content, string author, string date, bool deleteEnabled)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

CommentLabel.Text = content;
AuthorLabel.Text = $"Posted by {author} on {date}";
DeleteButton.Visible = deleteEnabled;
}
}
16 changes: 16 additions & 0 deletions Content.Client/MessageBoard/UI/CreateEntry.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="Create Entry">
<BoxContainer Orientation="Vertical" MinSize="550 350">
<BoxContainer Orientation="Horizontal">
<Label Text ="Title:"></Label>
<LineEdit Name="MainTitleLabel" PlaceHolder="Title Label" Access="Public" HorizontalExpand="True"/>
</BoxContainer>
<customControls:HSeparator Margin="5 10 5 10"/>
<Label Text ="Content:"></Label>
<PanelContainer StyleIdentifier="PaperEditBackground" VerticalExpand="True" HorizontalExpand="True">
<TextEdit Name="DescriptionLabel" Access="Public" HorizontalExpand="True" VerticalExpand="True"/>
</PanelContainer>
<Button Name="PostButton" Text="Post Entry" Access="Public" />
</BoxContainer>
</DefaultWindow>
17 changes: 17 additions & 0 deletions Content.Client/MessageBoard/UI/CreateEntry.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;

namespace Content.Client.MessageBoard.UI;
[GenerateTypedNameReferences]
public sealed partial class CreateEntry : DefaultWindow
{
public enum EntryType : byte
{
Public,
Direct
}

public EntryType CurrentEntryType = EntryType.Public;

}

19 changes: 19 additions & 0 deletions Content.Client/MessageBoard/UI/EntryHeader.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<PanelContainer xmlns="https://spacestation14.io" StyleClasses="BackgroundPanel" HorizontalExpand="True" MinHeight="30" Margin="10 10 10 0">
<BoxContainer HorizontalExpand="True" Orientation="Vertical">
<BoxContainer Orientation="Horizontal">
<Label Name="TitleLabel" Text="(JOB) Looking for engineers to help with a shuttle." StyleClasses="LabelKeyText" />
<Control HorizontalExpand="True" />
<Button Text="View" Name="ViewButton" Access="Public" />
</BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Access="Public" Name="AuthorLabel" Text="Posted by Chester Cheetah" />
<Control HorizontalExpand="True" />
<Button Text="Delete" Name="DeleteButton" Access="Public" />
</BoxContainer>
<BoxContainer Orientation="Horizontal">
<Label Access="Public" Name="DateLabel" Text="14:17 2246-05-01" />
<Control HorizontalExpand="True" />
<Label Access="Public" Name="CommentsLabel" Text="0 Comments" />
</BoxContainer>
</BoxContainer>
</PanelContainer>
22 changes: 22 additions & 0 deletions Content.Client/MessageBoard/UI/EntryHeader.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.MessageBoard.UI;

[GenerateTypedNameReferences]
public sealed partial class EntryHeader : PanelContainer
{
public EntryHeader(string title, string author, string date, int commentCount, bool deleteEnabled)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

TitleLabel.Text = title;
AuthorLabel.Text = $"Posted by {author}";
DateLabel.Text = date;
CommentsLabel.Text = $"{commentCount} Comments";
DeleteButton.Visible = deleteEnabled;
}
}
36 changes: 36 additions & 0 deletions Content.Client/MessageBoard/UI/EntryWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="Entry Title">
<BoxContainer Orientation="Vertical" MinSize="550 550">
<BoxContainer Orientation="Vertical">
<Label Text ="Title:" Name="MainTitleLabel"></Label>
<Label Name="AuthorLabel"></Label>
</BoxContainer>
<customControls:HSeparator Margin="5 10 5 10"/>
<PanelContainer StyleIdentifier="PaperEditBackground" MinHeight="300" HorizontalExpand="True">
<ScrollContainer HorizontalExpand="True" VerticalExpand="True">
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical" Margin="5 10 5 10">
<RichTextLabel Name="MainContentLabel" Access="Public" HorizontalExpand="True" VerticalExpand="True" VerticalAlignment="Top"/>
</BoxContainer>
</ScrollContainer>
</PanelContainer>
<PanelContainer VerticalExpand="True" HorizontalExpand="True" Name="PublicBoardEntriesPC">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#000000" />
</PanelContainer.PanelOverride>
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" HScrollEnabled="False">
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical" Margin="5 10 5 10">
<PanelContainer StyleClasses="BackgroundPanel" HorizontalExpand="True" MinHeight="30" Margin="10 10 10 0">
<BoxContainer HorizontalExpand="True" VerticalExpand="True" Orientation="Vertical">
<LineEdit Name="AddCommentLE" HorizontalExpand="True" PlaceHolder="Add a comment" Access="Public"/>
<Button Name="AddCommentBtn" Text="Add Comment" Access="Public"/>
</BoxContainer>
</PanelContainer>
<BoxContainer Orientation="Vertical" Name="CommentBC"></BoxContainer>
</BoxContainer>
</ScrollContainer>
</PanelContainer>

</BoxContainer>
</DefaultWindow>
71 changes: 71 additions & 0 deletions Content.Client/MessageBoard/UI/EntryWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using Content.Client.Message;
using Content.Shared.CCVar;
using Content.Shared.MessageBoard.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;


namespace Content.Client.MessageBoard.UI;

[GenerateTypedNameReferences]
public sealed partial class EntryWindow : DefaultWindow
{
[Dependency] private readonly IConfigurationManager _cfg = default!;

public MessageBoardEntry Entry;
private bool _isAdmin;
private string _playerName;
private MessageBoardBoundUserInterface _owner;

public EntryWindow(MessageBoardEntry entry, bool isAdmin, string playerName, MessageBoardBoundUserInterface owner)
{
_owner = owner;
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
Entry = entry;
this.Title = entry.Title;
_isAdmin = isAdmin;
_playerName = playerName;
MainTitleLabel.Text = entry.Title;
var adjustedMainTime = entry.CreationTime.AddYears(_cfg.GetCVar(CCVars.YearOffset));
AuthorLabel.Text = $"Posted by {entry.Author} on {adjustedMainTime.ToString()}";
MainContentLabel.SetMarkup(entry.Body);
entry.Comments.Reverse();
foreach (var comment in entry.Comments)
{
var adjustedTime = comment.CreationTime.AddYears(_cfg.GetCVar(CCVars.YearOffset));
bool delete = false;
if (_isAdmin || _playerName == comment.Author) delete = true;
var item = new CommentHeader(comment.Body, comment.Author, $"{adjustedTime.ToString()}", delete);
CommentBC.AddChild(item);
item.DeleteButton.OnPressed += (args) =>
{
var ID = comment.UID;
_owner.SendMessage(new MessageBoardDeleteCommentPublicMessage(ID, Entry.UID));
};
}

}

public void UpdateEntry(MessageBoardEntry entry)
{
Entry = entry;
this.Title = entry.Title;
MainTitleLabel.Text = entry.Title;
var adjustedMainTime = entry.CreationTime.AddYears(_cfg.GetCVar(CCVars.YearOffset));
AuthorLabel.Text = $"Posted by {entry.Author} on {adjustedMainTime.ToString()}";
MainContentLabel.SetMarkup(entry.Body);
CommentBC.RemoveAllChildren();
entry.Comments.Reverse();
foreach (var comment in entry.Comments)
{
var adjustedTime = comment.CreationTime.AddYears(_cfg.GetCVar(CCVars.YearOffset));
bool delete = false;
if (_isAdmin || _playerName == comment.Author) delete = true;
CommentBC.AddChild(new CommentHeader(comment.Body, comment.Author, $"{adjustedTime.ToString()}", delete));
}
}
}
39 changes: 39 additions & 0 deletions Content.Client/MessageBoard/UI/MessageBoard.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
SetSize="600 690"
MinSize="600 690">
<BoxContainer Orientation="Vertical">
<ScrollContainer VerticalExpand="True">
<TabContainer>
<BoxContainer Orientation="Vertical" Name="PublicBoard">
<Button Text="Create A New Entry" Name="CreateEntryPublicButton" Access="Public" />
<PanelContainer VerticalExpand="True"
HorizontalExpand="True"
SizeFlagsStretchRatio="1"
Name="PublicBoardEntriesPC">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#000000" />
</PanelContainer.PanelOverride>
<ScrollContainer VerticalExpand="True">
<BoxContainer Orientation="Vertical" Margin="5" MinHeight ="10">
<BoxContainer Name="PublicBoardEntriesBC"
Orientation="Vertical"
VerticalExpand="True"
Access="Public">
</BoxContainer>
</BoxContainer>
</ScrollContainer>
</PanelContainer>
</BoxContainer>
<BoxContainer Orientation="Vertical" Name="DirectMessages">
<Label Text="Send Message: " StyleClasses="LabelKeyText"/>
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<LineEdit Name="SendMessageLE" PlaceHolder="Recipient Name" HorizontalExpand="True"/>
<Button Text="Compose Message" Name="SendMessageButton" Access="Public" />
</BoxContainer>
</BoxContainer>
</TabContainer>
</ScrollContainer>
</BoxContainer>
</controls:FancyWindow>
29 changes: 29 additions & 0 deletions Content.Client/MessageBoard/UI/MessageBoard.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Content.Client.Cargo.Systems;
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;

namespace Content.Client.MessageBoard.UI;

[GenerateTypedNameReferences]
public sealed partial class MessageBoard : FancyWindow
{
private readonly IPrototypeManager _protoManager;
private readonly CargoSystem _cargoSystem;
private readonly SpriteSystem _spriteSystem;
private EntityUid _owner;
public MessageBoard(EntityUid owner, IEntityManager entMan, IPrototypeManager protoManager, SpriteSystem spriteSystem)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_protoManager = protoManager;
_cargoSystem = entMan.System<CargoSystem>();
_spriteSystem = spriteSystem;
_owner = owner;
Title = entMan.GetComponent<MetaDataComponent>(owner).EntityName;
}

}
Loading
Loading