Skip to content

Commit b5353e6

Browse files
authored
Merge pull request #1135 from rust-lang/maint
Maintenance
2 parents 80807ea + 796fe02 commit b5353e6

File tree

14 files changed

+1996
-1969
lines changed

14 files changed

+1996
-1969
lines changed

tests/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
screenshots/
2+
test-failures/

ui/frontend/ButtonMenuItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { type JSX } from 'react';
22

33
import MenuItem from './MenuItem';
44

ui/frontend/ButtonSet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { type JSX } from 'react';
22

33
import Link, { LinkProps } from './uss-router/Link';
44

ui/frontend/ConfigElement.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { type JSX } from 'react';
22

33
import MenuItem from './MenuItem';
44

ui/frontend/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const Header: React.FC = () => {
7070
};
7171

7272
interface PortalProps {
73-
menuContainer: RefObject<HTMLDivElement>;
73+
menuContainer: RefObject<HTMLDivElement | null>;
7474
}
7575

7676
const ExecuteButton: React.FC = () => {

ui/frontend/Output/Gist.module.css

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
$copied-duration: 1s ease-in-out;
2-
31
.container {
42
display: flex;
3+
4+
--copied-duration: 1s ease-in-out;
55
}
66

77
.button {
88
composes: -buttonReset from '../shared.module.css';
9-
transition: color $copied-duration;
9+
transition: color var(--copied-duration);
1010
cursor: pointer;
1111
margin: 0 0.25em 0 0.5em;
1212
}
@@ -15,9 +15,9 @@ $copied-duration: 1s ease-in-out;
1515
visibility: hidden;
1616
opacity: 0;
1717
transition:
18-
visibility $copied-duration,
19-
opacity $copied-duration,
20-
color $copied-duration;
18+
visibility var(--copied-duration),
19+
opacity var(--copied-duration),
20+
color var(--copied-duration);
2121
}
2222

2323
.active {

ui/frontend/Output/Gist.tsx

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import React, { Fragment } from 'react';
2-
import { CopyToClipboard } from 'react-copy-to-clipboard';
1+
import React, { Fragment, useCallback, useState } from 'react';
32

43
import { ClipboardIcon } from '../Icon';
54
import * as selectors from '../selectors';
@@ -34,33 +33,27 @@ interface CopiedProps {
3433
href: string;
3534
}
3635

37-
interface CopiedState {
38-
copied: boolean;
39-
}
36+
const Copied: React.FC<CopiedProps> = ({ children, href }) => {
37+
const [copied, setCopied] = useState(false);
4038

41-
class Copied extends React.PureComponent<CopiedProps, CopiedState> {
42-
public constructor(props: CopiedProps) {
43-
super(props);
44-
this.state = { copied: false };
45-
}
39+
const startCopy = useCallback(() => {
40+
setCopied(true);
4641

47-
public render() {
48-
return (
49-
<p className={this.state.copied ? styles.active : styles.container}>
50-
<a href={this.props.href}>{this.props.children}</a>
51-
<CopyToClipboard text={this.props.href} onCopy={this.copied}>
52-
<button className={styles.button}><ClipboardIcon /></button>
53-
</CopyToClipboard>
54-
<span className={styles.text}>Copied!</span>
55-
</p>
56-
);
57-
}
42+
setTimeout(() => {
43+
setCopied(false);
44+
}, 1000);
45+
}, []);
5846

59-
private copied = () => {
60-
this.setState({ copied: true });
61-
setTimeout(() => { this.setState({ copied: false }); }, 1000);
62-
}
63-
}
47+
return (
48+
<p className={copied ? styles.active : styles.container}>
49+
<a href={href}>{children}</a>
50+
<button className={styles.button} onClick={startCopy}>
51+
<ClipboardIcon />
52+
</button>
53+
<span className={styles.text}>Copied!</span>
54+
</p>
55+
);
56+
};
6457

6558
const Links: React.FC = () => {
6659
const codeUrl = useAppSelector(selectors.codeUrlSelector);

ui/frontend/PopButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface MenuProps {
2929
interface NewPopProps {
3030
Button: React.ComponentType<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
3131
Menu: React.ComponentType<MenuProps>;
32-
menuContainer?: React.RefObject<HTMLDivElement>;
32+
menuContainer?: React.RefObject<HTMLDivElement | null>;
3333
}
3434

3535
const CONTAINER_STYLE: { [key in Placement]?: string } = {

ui/frontend/SelectableMenuItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { type JSX } from 'react';
22

33
import { CheckmarkIcon } from './Icon';
44
import MenuItem from './MenuItem';

ui/frontend/editor/AceEditorCore.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const buildCrateAutocompleter = (autocompleteOnUse: boolean, crates: Crate[]): A
6565
});
6666

6767
function useRafDebouncedFunction<A extends unknown[]>(fn: (...args: A) => void, onCall?: (...args: A) => void) {
68-
const timeout = useRef<number>();
68+
const timeout = useRef<number>(undefined);
6969

7070
return useCallback((...args: A): void => {
7171
if (timeout.current) {
@@ -159,6 +159,7 @@ const AceEditor: React.FC<AceEditorProps> = props => {
159159
// open the autocomplete. This should help people understand that
160160
// there are crates available.
161161
useEditorProp(editor, autocompleteProps, useCallback((editor, { autocompleteOnUse, crates }) => {
162+
// @ts-expect-error https://github.com/ajaxorg/ace/issues/5742
162163
editor.commands.on('afterExec', ({ editor, command }) => {
163164
if (!(command.name === 'backspace' || command.name === 'insertstring')) {
164165
return;
@@ -257,6 +258,7 @@ const AceEditor: React.FC<AceEditorProps> = props => {
257258
editor.setOption('keyboardHandler', handler);
258259

259260
if (keybinding === 'vim') {
261+
// @ts-expect-error https://github.com/ajaxorg/ace/issues/5743
260262
const { CodeMirror: { Vim } }: VimKeybindings = ace.require('ace/keyboard/vim');
261263
Vim.defineEx('write', 'w', (cm) => {
262264
cm.ace.execCommand('executeCode');

0 commit comments

Comments
 (0)