Skip to content

Commit 604ad29

Browse files
authored
Fix fallback text wrapping (#806)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description <!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. --> Fixes #766, updates the wrapping behavior to wrap the message type and body together rather than separately, as shown in the images in the issue. #### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. -->
2 parents 7d50322 + 1b003df commit 604ad29

2 files changed

Lines changed: 35 additions & 8 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: patch
3+
---
4+
5+
Fixed the text wrapping behavior of fallback messages.

src/app/components/message/content/FallbackContent.tsx

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Box, Icon, Icons, Text, as, color, config } from 'folds';
22

3+
import { BreakWord } from '$styles/Text.css';
4+
35
const warningStyle = { color: color.Warning.Main, opacity: config.opacity.P300 };
46
const criticalStyle = { color: color.Critical.Main, opacity: config.opacity.P300 };
57

@@ -18,11 +20,21 @@ export const MessageDeletedContent = as<'div', { children?: never; reason?: stri
1820

1921
export const MessageUnsupportedContent = as<'div', { children?: never; body?: string }>(
2022
({ body, ...props }, ref) => (
21-
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
23+
<Box
24+
as="span"
25+
alignItems="Center"
26+
direction="Row"
27+
gap="100"
28+
style={criticalStyle}
29+
{...props}
30+
ref={ref}
31+
>
2232
<Icon size="50" src={Icons.Warning} />
23-
<i>Unsupported message</i>
24-
{body && `: ${body}`}
25-
{!body && ' (no body)'}
33+
<span className={BreakWord} style={{ flex: '1 1 auto', minWidth: 0 }}>
34+
<i>Unsupported message</i>
35+
{body && `: ${body}`}
36+
{!body && ' (no body)'}
37+
</span>
2638
</Box>
2739
)
2840
);
@@ -51,11 +63,21 @@ export const MessageNotDecryptedContent = as<'div', { children?: never }>(({ ...
5163
// display body of the message if it is available, as it may give some clue about why the message is broken
5264
export const MessageBrokenContent = as<'div', { children?: never; body?: string }>(
5365
({ body, ...props }, ref) => (
54-
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
66+
<Box
67+
as="span"
68+
alignItems="Center"
69+
direction="Row"
70+
gap="100"
71+
style={criticalStyle}
72+
{...props}
73+
ref={ref}
74+
>
5575
<Icon size="50" src={Icons.Warning} />
56-
<i>Broken message</i>
57-
{body && `: ${body}`}
58-
{!body && ' (no body)'}
76+
<span className={BreakWord} style={{ flex: '1 1 auto', minWidth: 0 }}>
77+
<i>Broken message</i>
78+
{body && `: ${body}`}
79+
{!body && ' (no body)'}
80+
</span>
5981
</Box>
6082
)
6183
);

0 commit comments

Comments
 (0)