-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PORT] Nanochat #1009
[PORT] Nanochat #1009
Changes from 2 commits
af70665
9e8ddc7
736a59d
66eb865
99c5754
f6afff8
d0f6efb
16d3f4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,10 +9,28 @@ | |||||||||||||
BorderColor="#5a5a5a" | ||||||||||||||
BorderThickness="0 0 0 1"/> | ||||||||||||||
</PanelContainer.PanelOverride> | ||||||||||||||
<BoxContainer Orientation="Horizontal" Margin="4 8"> | ||||||||||||||
<Label Align="Right" SetWidth="26" ClipText="True" Text="{Loc 'log-probe-label-number'}"/> | ||||||||||||||
<Label Align="Center" SetWidth="100" ClipText="True" Text="{Loc 'log-probe-label-time'}"/> | ||||||||||||||
<Label Align="Left" SetWidth="390" ClipText="True" Text="{Loc 'log-probe-label-accessor'}"/> | ||||||||||||||
<BoxContainer Orientation="Vertical" Margin="4 8"> | ||||||||||||||
<!-- Corvax-Next-PDAChat-Start - Add title label --> | ||||||||||||||
<Label Name="TitleLabel" | ||||||||||||||
Text="{Loc 'log-probe-header-access'}" | ||||||||||||||
StyleClasses="LabelHeading" | ||||||||||||||
HorizontalAlignment="Center" | ||||||||||||||
Margin="0 0 0 8"/> | ||||||||||||||
|
||||||||||||||
<!-- Add card number display --> | ||||||||||||||
<Label Name="CardNumberLabel" | ||||||||||||||
StyleClasses="LabelSubText" | ||||||||||||||
HorizontalAlignment="Center" | ||||||||||||||
Margin="0 0 0 8" | ||||||||||||||
Visible="False"/> | ||||||||||||||
|
||||||||||||||
<!-- Adjust column headers --> | ||||||||||||||
<BoxContainer Orientation="Horizontal"> | ||||||||||||||
<Label Align="Right" SetWidth="26" ClipText="True" Text="{Loc 'log-probe-label-number'}"/> | ||||||||||||||
<Label Align="Center" SetWidth="100" ClipText="True" Text="{Loc 'log-probe-label-time'}"/> | ||||||||||||||
<Label Name="ContentLabel" Align="Left" SetWidth="390" ClipText="True" Text="{Loc 'log-probe-label-accessor'}"/> | ||||||||||||||
Comment on lines
+29
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Пересмотреть фиксированные значения ширины Фиксированные значения ширины могут вызвать проблемы при локализации на другие языки. Рекомендуется использовать относительные значения или Auto: -<Label Align="Right" SetWidth="26" ClipText="True" Text="{Loc 'log-probe-label-number'}"/>
-<Label Align="Center" SetWidth="100" ClipText="True" Text="{Loc 'log-probe-label-time'}"/>
+<Label Align="Right" MinWidth="26" HorizontalExpand="True" ClipText="True" Text="{Loc 'log-probe-label-number'}"/>
+<Label Align="Center" MinWidth="100" HorizontalExpand="True" ClipText="True" Text="{Loc 'log-probe-label-time'}"/> 📝 Committable suggestion
Suggested change
|
||||||||||||||
</BoxContainer> | ||||||||||||||
<!-- Corvax-Next-PDAChat-End --> | ||||||||||||||
</BoxContainer> | ||||||||||||||
</PanelContainer> | ||||||||||||||
<ScrollContainer VerticalExpand="True" HScrollEnabled="True"> | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<BoxContainer | ||
xmlns="https://spacestation14.io" | ||
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
HorizontalExpand="True"> | ||
<Button Name="ChatButton" | ||
StyleClasses="ButtonSquare" | ||
HorizontalExpand="True" | ||
MaxSize="137 64" | ||
Margin="0 1"> | ||
<BoxContainer Orientation="Horizontal" | ||
HorizontalExpand="True" | ||
VerticalExpand="True" | ||
MinWidth="132" | ||
Margin="6 4" | ||
VerticalAlignment="Center"> | ||
<!-- Unread indicator dot --> | ||
<PanelContainer Name="UnreadIndicator" | ||
MinSize="8 8" | ||
MaxSize="8 8" | ||
VerticalAlignment="Center" | ||
Margin="0 0 6 0"> | ||
<PanelContainer.PanelOverride> | ||
<graphics:StyleBoxFlat | ||
BackgroundColor="#17c622" | ||
BorderColor="#0f7a15" /> | ||
</PanelContainer.PanelOverride> | ||
</PanelContainer> | ||
|
||
<!-- Text container --> | ||
<BoxContainer Orientation="Vertical" | ||
HorizontalExpand="True" | ||
VerticalExpand="True" | ||
VerticalAlignment="Center"> | ||
<RichTextLabel Name="NameLabel" | ||
StyleClasses="LabelHeading" | ||
HorizontalExpand="True" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Margin="0 -2 0 0" /> | ||
<Label Name="JobLabel" | ||
StyleClasses="LabelSubText" | ||
HorizontalExpand="True" | ||
ClipText="False" | ||
HorizontalAlignment="Center" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</Button> | ||
</BoxContainer> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Content.Shared._CorvaxNext.CartridgeLoader.Cartridges; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client._CorvaxNext.CartridgeLoader.Cartridges; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class NanoChatEntry : BoxContainer | ||
{ | ||
public event Action<uint>? OnPressed; | ||
private uint _number; | ||
private Action<EventArgs>? _pressHandler; | ||
|
||
public NanoChatEntry() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
} | ||
|
||
public void SetRecipient(NanoChatRecipient recipient, uint number, bool isSelected) | ||
{ | ||
// Remove old handler if it exists | ||
if (_pressHandler != null) | ||
ChatButton.OnPressed -= _pressHandler; | ||
|
||
_number = number; | ||
|
||
// Create and store new handler | ||
_pressHandler = _ => OnPressed?.Invoke(_number); | ||
ChatButton.OnPressed += _pressHandler; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Улучшите управление обработчиками событий Текущий подход к управлению обработчиками событий может быть улучшен. Рекомендуется:
+ private bool _disposed;
+
+ public void Dispose()
+ {
+ if (_disposed) return;
+ if (_pressHandler != null)
+ ChatButton.OnPressed -= _pressHandler;
+ _disposed = true;
+ }
|
||
|
||
NameLabel.Text = recipient.Name; | ||
JobLabel.Text = recipient.JobTitle ?? ""; | ||
JobLabel.Visible = !string.IsNullOrEmpty(recipient.JobTitle); | ||
UnreadIndicator.Visible = recipient.HasUnread; | ||
|
||
ChatButton.ModulateSelfOverride = isSelected ? NanoChatMessageBubble.OwnMessageColor : null; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<BoxContainer xmlns="https://spacestation14.io" | ||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
Margin="4" | ||
Orientation="Vertical"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<Label Name="NumberLabel" | ||
Align="Right" | ||
SetWidth="26" | ||
ClipText="True" /> | ||
<Label Name="TimeLabel" | ||
Align="Center" | ||
SetWidth="100" | ||
ClipText="True" /> | ||
<Label Name="MessageLabel" | ||
Align="Left" | ||
MinWidth="390" | ||
HorizontalExpand="True" | ||
ClipText="False" /> | ||
</BoxContainer> | ||
<customControls:HSeparator Margin="0 5 0 5" /> | ||
</BoxContainer> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client._CorvaxNext.CartridgeLoader.Cartridges; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class NanoChatLogEntry : BoxContainer | ||
{ | ||
public NanoChatLogEntry(int number, string time, string message) | ||
{ | ||
RobustXamlLoader.Load(this); | ||
NumberLabel.Text = number.ToString(); | ||
TimeLabel.Text = time; | ||
MessageLabel.Text = message; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Вынести дублирующуюся константу!
Константа
MaxNumberLength
дублируется сNewChatPopup
. Рекомендуется вынести её в общий файл констант.