Files
OwnCord/Client/OwnCord.Client/Controls/CodeBlockControl.xaml.cs
T
jevb c1c25ed26c feat: implement full client UI from mockup — 10 phases, 331 tests
Client UI:
- Design system: Colors, Typography, Controls resource dictionaries
- Message actions: reply compose bar, hover edit/delete/reply buttons
- Rich content: code blocks, attachments, system messages, content parser
- Server strip: 72px sidebar with server icons, home button, add server
- Status picker: popup for changing online/idle/dnd/invisible status
- ConnectPage: server health check dots with auto-refresh
- User popup: profile card with banner, avatar, roles, member since
- Emoji picker: 6 categories, search, grid of Unicode emojis
- Settings overlay: full-screen with sidebar navigation
- Friends/DM view: sidebar + friends list with tabs (online/all/pending)
- Toast notifications: auto-dismiss after 3s with fade animation

Models & services:
- Attachment model added to Message, ApiMessage, ChatMessagePayload
- EditMessageAsync, DeleteMessageAsync, SendStatusChangeAsync APIs
- MessageContentParser (code blocks, inline code, bold, italic)
- EmojiData, ToastService, HealthStatusToBrushConverter

Server (from prior session):
- Voice room management, SFU, speaker detection
- ACME/TLS support, config improvements
- Protocol and schema updates

Tests: 331 passing (61 converter + 24 voice service + 34 voice VM +
41 parser + 9 edit/delete + existing)
2026-03-15 11:42:25 +01:00

56 lines
1.5 KiB
C#

using System.Windows;
using System.Windows.Controls;
namespace OwnCord.Client.Controls;
public partial class CodeBlockControl : UserControl
{
public static readonly DependencyProperty CodeProperty =
DependencyProperty.Register(
nameof(Code),
typeof(string),
typeof(CodeBlockControl),
new PropertyMetadata(string.Empty, OnPropertyChanged));
public static readonly DependencyProperty CodeLanguageProperty =
DependencyProperty.Register(
nameof(CodeLanguage),
typeof(string),
typeof(CodeBlockControl),
new PropertyMetadata(string.Empty, OnPropertyChanged));
public string Code
{
get => (string)GetValue(CodeProperty);
set => SetValue(CodeProperty, value);
}
public string CodeLanguage
{
get => (string)GetValue(CodeLanguageProperty);
set => SetValue(CodeLanguageProperty, value);
}
public CodeBlockControl()
{
InitializeComponent();
}
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is CodeBlockControl control)
{
control.UpdateDisplay();
}
}
private void UpdateDisplay()
{
CodeText.Text = Code;
var hasLanguage = !string.IsNullOrWhiteSpace(CodeLanguage);
LanguageLabel.Text = hasLanguage ? CodeLanguage : string.Empty;
LanguageLabel.Visibility = hasLanguage ? Visibility.Visible : Visibility.Collapsed;
}
}