Skip to content

Commit fb4d369

Browse files
committed
Fix linter & type errors
1 parent c81109a commit fb4d369

File tree

20 files changed

+329
-406
lines changed

20 files changed

+329
-406
lines changed

browser/.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ data-browser/coverage
2929
.DS_Store
3030
**/.trunk/*
3131

32-
**/tomic-lib-**.tgz
33-
**/tomic-react-**.tgz
34-
**/tomic-svelte-**.tgz
35-
**/tomic-cli-**.tgz
36-
**/tomic-create-template-**.tgz
32+
**/tomic-lib**.tgz
33+
**/tomic-react**.tgz
34+
**/tomic-svelte**.tgz
35+
**/tomic-cli**.tgz
36+
**/tomic-create-template**.tgz
3737

3838
data-browser/src/locales/.wuchale
3939
data-browser/src/locales/data.js

browser/data-browser/src/components/Toaster.tsx

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ import toast, {
22
type Toast,
33
ToastBar,
44
Toaster as ReactHotToast,
5+
resolveValue,
56
type Renderable,
67
} from 'react-hot-toast';
78
import { FaCopy, FaTimes } from 'react-icons/fa';
8-
import { useTheme } from 'styled-components';
9+
import styled, { useTheme } from 'styled-components';
910
import { zIndex } from '../styling';
1011
import { Row } from './Row';
1112
import { IconButton } from './IconButton/IconButton';
1213

13-
import type { JSX } from 'react';
14+
import { useRef, type JSX } from 'react';
1415

1516
/**
1617
* Makes themed toast notifications available in the Context. Render this
@@ -59,31 +60,28 @@ interface ToastMessageProps {
5960
}
6061

6162
function ToastMessage({ icon, message, t }: ToastMessageProps) {
62-
let text: string;
63-
64-
if (typeof message === 'string') {
65-
text = message;
66-
} else if (message && 'props' in message) {
67-
// children can technically still be a react node but we never do that in our code so we'll just assume it to be a string.
68-
text = message.props.children;
69-
} else {
70-
text = '';
71-
}
63+
const textRef = useRef<HTMLDivElement>(null);
7264

7365
function handleCopy() {
66+
const text = textRef.current?.textContent;
67+
68+
if (text === undefined) {
69+
toast.error('Nothing to copy.');
70+
71+
return;
72+
}
73+
7474
toast.success('Copied error to clipboard');
7575
navigator.clipboard.writeText(text);
7676
toast.dismiss(t.id);
7777
}
7878

79-
if (text.length > 100) {
80-
text = text.substring(0, 100) + '...';
81-
}
82-
8379
return (
84-
<Row gap='1ch' center>
80+
<StyledRow gap='1ch' center>
8581
{icon}
86-
{text}
82+
<div ref={textRef} style={{ display: 'contents' }}>
83+
{resolveValue(message, t)}
84+
</div>
8785
{t.type !== 'loading' && (
8886
<div
8987
style={{
@@ -101,6 +99,11 @@ function ToastMessage({ icon, message, t }: ToastMessageProps) {
10199
)}
102100
</div>
103101
)}
104-
</Row>
102+
</StyledRow>
105103
);
106104
}
105+
106+
const StyledRow = styled(Row)`
107+
max-height: 10rem;
108+
overflow-y: auto;
109+
`;

browser/data-browser/src/helpers/loggingHandlers.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ export function initBugsnag(apiKey: string): BugsnagErrorBoundary {
2121
autoDetectErrors: !isDev(),
2222
});
2323

24+
// @ts-expect-error - BugsnagPluginReact types do not match React 19.2 types.
2425
return Bugsnag.getPlugin('react')!.createErrorBoundary(React);
2526
}

browser/data-browser/src/locales/de.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3151,3 +3151,7 @@ msgstr "Wähle ein Bild <0/>"
31513151
#: src/chunks/RTE/ImagePicker.tsx
31523152
msgid "Inline"
31533153
msgstr "Fließtext"
3154+
3155+
#: src/components/Toaster.tsx
3156+
msgid "Nothing to copy."
3157+
msgstr "Nichts zum Kopieren."

browser/data-browser/src/locales/en.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3159,3 +3159,7 @@ msgstr "Choose an image <0/>"
31593159
#: src/chunks/RTE/ImagePicker.tsx
31603160
msgid "Inline"
31613161
msgstr "Inline"
3162+
3163+
#: src/components/Toaster.tsx
3164+
msgid "Nothing to copy."
3165+
msgstr "Nothing to copy."

browser/data-browser/src/locales/es.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,3 +3129,7 @@ msgstr "Elegir una imagen <0/>"
31293129
#: src/chunks/RTE/ImagePicker.tsx
31303130
msgid "Inline"
31313131
msgstr "En línea"
3132+
3133+
#: src/components/Toaster.tsx
3134+
msgid "Nothing to copy."
3135+
msgstr "Nada para copiar."

browser/data-browser/src/locales/fr.po

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3148,3 +3148,7 @@ msgstr "Choisir une image <0/>"
31483148
#: src/chunks/RTE/ImagePicker.tsx
31493149
msgid "Inline"
31503150
msgstr "En ligne"
3151+
3152+
#: src/components/Toaster.tsx
3153+
msgid "Nothing to copy."
3154+
msgstr "Rien à copier."

browser/data-browser/src/routes/PruneTestsRoute.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ const PruneTestsRoute: React.FC = () => {
4040
);
4141
};
4242

43-
export const pruneTestRouteLazy = createLazyRoute('/$')({
43+
export const pruneTestRouteLazy = createLazyRoute('/app/prunetests')({
4444
component: PruneTestsRoute,
4545
});

browser/data-browser/src/routes/Router.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { LinkOpenRouter } from './LinkOpenRouter';
2222
const PruneTestsRoute = createRoute({
2323
getParentRoute: () => appRoute,
2424
path: pathNames.pruneTests,
25+
// @ts-expect-error - Mismatch between unavailable route name and prune route name, not sure how to fix this.
2526
}).lazy(() => {
2627
if (isDev()) {
2728
return import('./PruneTestsRoute').then(mod => mod.pruneTestRouteLazy);
@@ -33,6 +34,7 @@ const PruneTestsRoute = createRoute({
3334
const SandboxRoute = createRoute({
3435
getParentRoute: () => appRoute,
3536
path: pathNames.sandbox,
37+
// @ts-expect-error - Mismatch between unavailable route name and sandbox route name, not sure how to fix this.
3638
}).lazy(() => {
3739
if (isDev()) {
3840
return import('./Sandbox').then(mod => mod.sandboxRouteLazy);

browser/data-browser/src/routes/Sandbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ function Sandbox(): JSX.Element {
1515
);
1616
}
1717

18-
export const sandboxRouteLazy = createLazyRoute('/$')({
18+
export const sandboxRouteLazy = createLazyRoute('/app/sandbox')({
1919
component: Sandbox,
2020
});

0 commit comments

Comments
 (0)