@rainlanguage/ui-components 0.0.1-alpha.190 → 0.0.1-alpha.191
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
TableHead,
|
|
14
14
|
TableHeadCell
|
|
15
15
|
} from "flowbite-svelte";
|
|
16
|
-
import { BugOutline, PauseSolid, PlaySolid } from "flowbite-svelte-icons";
|
|
16
|
+
import { BugOutline, ClipboardOutline, PauseSolid, PlaySolid } from "flowbite-svelte-icons";
|
|
17
17
|
import Tooltip from "../Tooltip.svelte";
|
|
18
18
|
export let order;
|
|
19
19
|
export let handleQuoteDebugModal = void 0;
|
|
20
20
|
let enabled = true;
|
|
21
21
|
const queryClient = useQueryClient();
|
|
22
|
-
const { errToast } = useToasts();
|
|
22
|
+
const { errToast, addToast } = useToasts();
|
|
23
23
|
const refreshQuotes = async () => {
|
|
24
24
|
try {
|
|
25
25
|
await invalidateTanstackQueries(queryClient, [order.id, QKEY_ORDER_QUOTE + order.id]);
|
|
@@ -27,6 +27,28 @@ const refreshQuotes = async () => {
|
|
|
27
27
|
errToast("Failed to refresh");
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
+
const copyQuoteError = async (error) => {
|
|
31
|
+
if (!error) {
|
|
32
|
+
errToast("No quote error to copy");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
if (typeof navigator === "undefined" || !navigator.clipboard?.writeText) {
|
|
37
|
+
throw new Error("Clipboard API unavailable");
|
|
38
|
+
}
|
|
39
|
+
await navigator.clipboard.writeText(error);
|
|
40
|
+
addToast({
|
|
41
|
+
message: "Copied quote error",
|
|
42
|
+
type: "success",
|
|
43
|
+
color: "green"
|
|
44
|
+
});
|
|
45
|
+
} catch (copyError) {
|
|
46
|
+
errToast(
|
|
47
|
+
"Failed to copy quote error",
|
|
48
|
+
copyError instanceof Error ? copyError.message : void 0
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
30
52
|
$: orderQuoteQuery = createQuery({
|
|
31
53
|
queryKey: [order.id, QKEY_ORDER_QUOTE + order.id],
|
|
32
54
|
queryFn: async () => {
|
|
@@ -59,6 +81,7 @@ $: orderModalArg = order;
|
|
|
59
81
|
{/if}
|
|
60
82
|
<span></span>
|
|
61
83
|
<Refresh
|
|
84
|
+
data-testid="refresh-button"
|
|
62
85
|
class="h-8 w-5 cursor-pointer text-gray-400 dark:text-gray-400"
|
|
63
86
|
on:click={refreshQuotes}
|
|
64
87
|
spin={$orderQuoteQuery.isLoading || $orderQuoteQuery.isFetching}
|
|
@@ -91,7 +114,7 @@ $: orderModalArg = order;
|
|
|
91
114
|
|
|
92
115
|
<TableBody>
|
|
93
116
|
{#if $orderQuoteQuery.data && $orderQuoteQuery.data.length > 0}
|
|
94
|
-
{#each $orderQuoteQuery.data as item}
|
|
117
|
+
{#each $orderQuoteQuery.data as item, index}
|
|
95
118
|
{#if item.success && item.data}
|
|
96
119
|
<TableBodyRow data-testid="bodyRow">
|
|
97
120
|
<TableBodyCell>{item.pair.pairName}</TableBodyCell>
|
|
@@ -122,19 +145,30 @@ $: orderModalArg = order;
|
|
|
122
145
|
{:else if !item.success && item.error}
|
|
123
146
|
<TableBodyRow>
|
|
124
147
|
<TableBodyCell>{item.pair.pairName}</TableBodyCell>
|
|
125
|
-
<TableBodyCell colspan="
|
|
126
|
-
<Tooltip
|
|
148
|
+
<TableBodyCell colspan="3" class="text-sm text-red-500 dark:text-red-400">
|
|
149
|
+
<Tooltip
|
|
150
|
+
triggeredBy={`#quote-error-${index}`}
|
|
151
|
+
customClass="max-w-sm whitespace-pre-wrap break-words"
|
|
152
|
+
>
|
|
127
153
|
{item.error}
|
|
128
154
|
</Tooltip>
|
|
129
|
-
<div
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
155
|
+
<div class="flex items-start gap-2">
|
|
156
|
+
<button
|
|
157
|
+
type="button"
|
|
158
|
+
class="mt-0.5 rounded border border-transparent p-1 text-gray-400 transition hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-gray-100"
|
|
159
|
+
aria-label="Copy quote error"
|
|
160
|
+
on:click={() => copyQuoteError(item.error)}
|
|
161
|
+
>
|
|
162
|
+
<ClipboardOutline size="sm" />
|
|
163
|
+
</button>
|
|
164
|
+
<div
|
|
165
|
+
id={`quote-error-${index}`}
|
|
166
|
+
class="max-w-xl cursor-pointer self-start truncate border-dotted border-red-500 pr-2"
|
|
167
|
+
>
|
|
168
|
+
{item.error}
|
|
169
|
+
</div>
|
|
134
170
|
</div>
|
|
135
171
|
</TableBodyCell>
|
|
136
|
-
<TableBodyCell />
|
|
137
|
-
<TableBodyCell />
|
|
138
172
|
<TableBodyCell>
|
|
139
173
|
{#if handleQuoteDebugModal}
|
|
140
174
|
<button
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rainlanguage/ui-components",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.191",
|
|
4
4
|
"description": "A component library for building Svelte applications to be used with Raindex.",
|
|
5
5
|
"license": "LicenseRef-DCL-1.0",
|
|
6
6
|
"author": "Rain Open Source Software Ltd",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@fontsource/dm-sans": "5.1.0",
|
|
54
54
|
"@imask/svelte": "7.6.1",
|
|
55
55
|
"@observablehq/plot": "0.6.16",
|
|
56
|
-
"@rainlanguage/orderbook": "0.0.1-alpha.
|
|
56
|
+
"@rainlanguage/orderbook": "0.0.1-alpha.191",
|
|
57
57
|
"@reown/appkit": "1.6.4",
|
|
58
58
|
"@reown/appkit-adapter-wagmi": "1.6.4",
|
|
59
59
|
"@sentry/sveltekit": "7.120.0",
|