Skip to content

Commit cd309dc

Browse files
committed
Improves text wrapping and reactivity.
Refactors several components to improve text wrapping and whitespace handling for better readability, especially in code and stack trace displays. Additionally, updates multiple components to use `$derived` for reactive property updates, ensuring UI elements are updated efficiently in response to data changes. This change enhances the user experience by ensuring text is displayed correctly and UI elements react appropriately to changes in data.
1 parent 1fd176b commit cd309dc

File tree

11 files changed

+30
-25
lines changed

11 files changed

+30
-25
lines changed

src/Exceptionless.Web/ClientApp/src/lib/features/events/components/extended-data-item.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
{:else if showXmlCodeEditor}
162162
<CodeBlock {code} language="xml" />
163163
{:else}
164-
<pre class="bg-muted rounded p-2 break-words whitespace-pre-wrap"><Code class="px-0"><div class="bg-inherit">{clipboardData}</div></Code
164+
<pre class="bg-muted rounded p-2 wrap-break-word whitespace-pre-wrap"><Code class="px-0"><div class="bg-inherit">{clipboardData}</div></Code
165165
></pre>
166166
{/if}
167167
{:else}

src/Exceptionless.Web/ClientApp/src/lib/features/events/components/simple-stack-trace/simple-stack-trace.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
1414
let { error }: Props = $props();
1515
16-
const errors = getErrors(error);
16+
const errors = $derived(getErrors(error));
1717
</script>
1818

19-
<pre class="bg-muted rounded p-2 break-words whitespace-pre-wrap"><Code class="px-0"
19+
<pre class="bg-muted rounded p-2 wrap-break-word whitespace-pre-wrap"><Code class="px-0"
2020
>{#each errors.reverse() as error, index (index)}<SimpleStackTraceHeader {error} /><SimpleStackTraceFrames {error} />{#if index < errors.length - 1}<br
2121
/>{/if}{/each}</Code
2222
></pre>

src/Exceptionless.Web/ClientApp/src/lib/features/events/components/stack-trace/stack-trace.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
1414
let { error }: Props = $props();
1515
16-
const errors = getErrors(error);
16+
const errors = $derived(getErrors(error));
1717
</script>
1818

19-
<pre class="bg-muted rounded p-2 break-words whitespace-pre-wrap"><Code class="px-0"
19+
<pre class="bg-muted rounded p-2 wrap-break-word whitespace-pre-wrap"><Code class="px-0"
2020
>{#each errors.reverse() as error, index (index)}<StackTraceHeader {error} /><StackTraceFrames {error} />{#if index < errors.length - 1}<br
2121
/>{/if}{/each}</Code
2222
></pre>

src/Exceptionless.Web/ClientApp/src/lib/features/shared/components/formatters/bytes.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
let { value }: Props = $props();
77
8-
const parsedValue = typeof value === 'number' ? value : parseFloat(value ?? '');
8+
const parsedValue = $derived(typeof value === 'number' ? value : parseFloat(value ?? ''));
99
const byteValueNumberFormatter = new Intl.NumberFormat(navigator.language, {
1010
notation: 'compact',
1111
style: 'unit',

src/Exceptionless.Web/ClientApp/src/lib/features/shared/components/object-dump.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
1414
let { value }: Props = $props();
1515
16-
let type = typeof value;
17-
let isBoolean = type === 'boolean' || value instanceof Boolean;
18-
let isObject = (type === 'object' || value instanceof Object) && value !== null;
19-
let isNull = value === null;
20-
let isEmptyValue = isEmpty(value);
16+
const type = $derived(typeof value);
17+
const isBoolean = $derived(type === 'boolean' || value instanceof Boolean);
18+
const isObject = $derived((type === 'object' || value instanceof Object) && value !== null);
19+
const isNull = $derived(value === null);
20+
const isEmptyValue = $derived(isEmpty(value));
2121
2222
function isEmpty(value: unknown) {
2323
if (value === undefined) {

src/Exceptionless.Web/ClientApp/src/lib/features/shared/components/ui/breadcrumb/breadcrumb-list.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
bind:this={ref}
1515
data-slot="breadcrumb-list"
1616
class={cn(
17-
"text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5",
17+
"text-muted-foreground flex flex-wrap items-center gap-1.5 wrap-break-word text-sm sm:gap-2.5",
1818
className
1919
)}
2020
{...restProps}

src/Exceptionless.Web/ClientApp/src/routes/(app)/(components)/navigation-command.svelte

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
77
let { open = $bindable(), routes }: { open: boolean; routes: NavigationItem[] } = $props();
88
9-
const groupedRoutes: Record<string, NavigationItem[]> = Object.entries(Object.groupBy(routes, (item: NavigationItem) => item.group)).reduce(
10-
(acc, [key, value]) => {
11-
if (value) acc[key] = value;
12-
return acc;
13-
},
14-
{} as Record<string, NavigationItem[]>
9+
const groupedRoutes = $derived(
10+
Object.entries(Object.groupBy(routes, (item: NavigationItem) => item.group)).reduce(
11+
(acc, [key, value]) => {
12+
if (value) acc[key] = value;
13+
return acc;
14+
},
15+
{} as Record<string, NavigationItem[]>
16+
)
1517
);
1618
1719
function closeCommandWindow() {

src/Exceptionless.Web/ClientApp/src/routes/(app)/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@
304304
<Sheet.Header>
305305
<Sheet.Title
306306
>Event Details <Button
307-
href={resolve('/(app)/event/[eventId]', { eventId: selectedEventId })}
307+
href={selectedEventId ? resolve('/(app)/event/[eventId]', { eventId: selectedEventId }) : '#'}
308308
size="sm"
309309
title="Open in new window"
310310
variant="ghost"><ExternalLink /></Button

src/Exceptionless.Web/ClientApp/src/routes/(app)/account/appearance/(components)/theme-preview.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
let { mode }: Props = $props();
99
10-
let resolvedMode = $state(mode !== 'system' ? mode : (systemPrefersMode.current ?? 'dark'));
10+
const resolvedMode = $derived(mode !== 'system' ? mode : (systemPrefersMode.current ?? 'dark'));
1111
</script>
1212

1313
{#if resolvedMode === 'light'}
@@ -16,7 +16,7 @@
1616
<!-- secondary-->
1717
<div class="space-y-2 rounded-md bg-[hsl(0,0%,100%)] p-2 shadow-xs">
1818
<!--card -->
19-
<div class="h-2 w-[80px] rounded-lg bg-[hsl(240,3.8%,46.1%)]"></div>
19+
<div class="h-2 w-20 rounded-lg bg-[hsl(240,3.8%,46.1%)]"></div>
2020
<!--muted-foreground -->
2121
<div class="h-2 w-[100px] rounded-lg bg-[hsl(240,3.8%,46.1%)]"></div>
2222
</div>
@@ -36,7 +36,7 @@
3636
<!-- secondary-->
3737
<div class="space-y-2 rounded-md bg-[hsl(222,17%,11%)] p-2 shadow-xs">
3838
<!--card -->
39-
<div class="h-2 w-[80px] rounded-lg bg-[hsl(240,5%,64.9%)]"></div>
39+
<div class="h-2 w-20 rounded-lg bg-[hsl(240,5%,64.9%)]"></div>
4040
<!--muted-foreground -->
4141
<div class="h-2 w-[100px] rounded-lg bg-[hsl(240,5%,64.9%)]"></div>
4242
</div>

src/Exceptionless.Web/ClientApp/src/routes/(app)/issues/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,11 @@
330330
<Sheet.Content class="w-full overflow-y-auto sm:max-w-full md:w-5/6">
331331
<Sheet.Header>
332332
<Sheet.Title
333-
>Event Details <Button href={resolve('/(app)/event/[eventId]', { eventId })} size="sm" title="Open in new window" variant="ghost"
334-
><ExternalLink /></Button
333+
>Event Details <Button
334+
href={eventId ? resolve('/(app)/event/[eventId]', { eventId }) : '#'}
335+
size="sm"
336+
title="Open in new window"
337+
variant="ghost"><ExternalLink /></Button
335338
></Sheet.Title
336339
>
337340
</Sheet.Header>

0 commit comments

Comments
 (0)