vzcode 0.31.0 → 0.33.0
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.
package/dist/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
href="https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css"
|
|
25
25
|
rel="stylesheet"
|
|
26
26
|
/>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-4jXg5R0X.js"></script>
|
|
28
28
|
<link rel="stylesheet" crossorigin href="/assets/index-esdlTXtH.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button, Modal } from '../bootstrap';
|
|
2
|
-
import { useCallback } from 'react';
|
|
2
|
+
import { useCallback, useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
// Confirmation modal for deleting a file or directory.
|
|
5
5
|
// Inspired by https://react-bootstrap.netlify.app/docs/components/modal/#live-demo
|
|
@@ -11,44 +11,55 @@ export const DeleteConfirmationModal = ({
|
|
|
11
11
|
isDirectory,
|
|
12
12
|
name,
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
15
|
-
(event) => {
|
|
16
|
-
event.
|
|
17
|
-
|
|
14
|
+
const handleEnterKey = useCallback(
|
|
15
|
+
(event: KeyboardEvent) => {
|
|
16
|
+
if (event.key === 'Enter') {
|
|
17
|
+
onConfirm();
|
|
18
|
+
}
|
|
18
19
|
},
|
|
19
20
|
[onConfirm],
|
|
20
21
|
);
|
|
21
22
|
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (show) {
|
|
25
|
+
window.addEventListener('keydown', handleEnterKey);
|
|
26
|
+
} else {
|
|
27
|
+
window.removeEventListener('keydown', handleEnterKey);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
window.removeEventListener('keydown', handleEnterKey);
|
|
32
|
+
};
|
|
33
|
+
}, [show, handleEnterKey]);
|
|
34
|
+
|
|
22
35
|
return (
|
|
23
36
|
<Modal show={show} onHide={onClose} centered>
|
|
24
|
-
<
|
|
25
|
-
<Modal.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
</Modal.Header>
|
|
37
|
+
<Modal.Header closeButton onClick={onClose}>
|
|
38
|
+
<Modal.Title>
|
|
39
|
+
Delete {isDirectory ? 'Directory' : 'File'}
|
|
40
|
+
</Modal.Title>
|
|
41
|
+
</Modal.Header>
|
|
30
42
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
<Modal.Body>
|
|
44
|
+
<p>
|
|
45
|
+
This will delete the{' '}
|
|
46
|
+
{isDirectory ? 'directory' : 'file'}{' '}
|
|
47
|
+
<strong>{name}</strong>.
|
|
48
|
+
</p>
|
|
49
|
+
</Modal.Body>
|
|
38
50
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</form>
|
|
51
|
+
<Modal.Footer>
|
|
52
|
+
<Button
|
|
53
|
+
variant="secondary"
|
|
54
|
+
type="button"
|
|
55
|
+
onClick={onClose}
|
|
56
|
+
>
|
|
57
|
+
Cancel
|
|
58
|
+
</Button>
|
|
59
|
+
<Button variant="primary" onClick={onConfirm}>
|
|
60
|
+
Delete
|
|
61
|
+
</Button>
|
|
62
|
+
</Modal.Footer>
|
|
52
63
|
</Modal>
|
|
53
64
|
);
|
|
54
65
|
};
|
|
@@ -100,8 +100,11 @@ export const Item = ({
|
|
|
100
100
|
|
|
101
101
|
// Function to handle confirmation on modal
|
|
102
102
|
const handleConfirmModal = useCallback(
|
|
103
|
-
(event: React.MouseEvent) => {
|
|
104
|
-
|
|
103
|
+
(event: React.MouseEvent | undefined) => {
|
|
104
|
+
// TODO clean this up.
|
|
105
|
+
// This was added to prevent parent listeners from firing
|
|
106
|
+
// when the modal is confirmed.
|
|
107
|
+
event?.stopPropagation();
|
|
105
108
|
setShowModal(false);
|
|
106
109
|
handleDeleteClick();
|
|
107
110
|
},
|
package/src/types.ts
CHANGED
|
@@ -161,7 +161,7 @@ export type VZCodeContent = {
|
|
|
161
161
|
// client and server.
|
|
162
162
|
// * This can power the transition of the icon from
|
|
163
163
|
// lightning bolt to stop sign and back (when stream finishes)
|
|
164
|
-
aiStreams
|
|
164
|
+
aiStreams?: {
|
|
165
165
|
// These need to be removed at some point?
|
|
166
166
|
[aiStreamId: AIStreamId]: {
|
|
167
167
|
AIStreamStatus: AIStreamStatus;
|