|
| 1 | +import { PlusIcon, XMarkIcon } from "@heroicons/react/24/outline"; |
| 2 | +import type { CodeToEdit } from "core"; |
1 | 3 | import { useContext, useState } from "react";
|
2 | 4 | import { useDispatch } from "react-redux";
|
3 | 5 | import { IdeMessengerContext } from "../../context/IdeMessenger";
|
4 |
| -import CodeToEditListItem from "./CodeToEditListItem"; |
5 |
| -import type { CodeToEdit } from "core"; |
6 |
| -import AddFileButton from "./AddFileButton"; |
7 |
| -import AddFileCombobox from "./AddFileCombobox"; |
8 |
| -import { PlusIcon, XMarkIcon } from "@heroicons/react/24/outline"; |
9 | 6 | import { useAppSelector } from "../../redux/hooks";
|
10 | 7 | import {
|
11 | 8 | addCodeToEdit,
|
12 | 9 | removeCodeToEdit,
|
13 | 10 | } from "../../redux/slices/sessionSlice";
|
| 11 | +import AddFileButton from "./AddFileButton"; |
| 12 | +import AddFileCombobox from "./AddFileCombobox"; |
| 13 | +import CodeToEditListItem from "./CodeToEditListItem"; |
14 | 14 |
|
15 | 15 | export default function CodeToEditCard() {
|
16 | 16 | const dispatch = useDispatch();
|
17 | 17 | const ideMessenger = useContext(IdeMessengerContext);
|
18 | 18 | const [showAddFileCombobox, setShowAddFileCombobox] = useState(false);
|
19 | 19 | const codeToEdit = useAppSelector((state) => state.session.codeToEdit);
|
20 | 20 |
|
21 |
| - const title = |
| 21 | + const itemCount = |
22 | 22 | codeToEdit.length === 0
|
23 |
| - ? "Code to edit" |
| 23 | + ? "" |
24 | 24 | : codeToEdit.length === 1
|
25 |
| - ? "Code to edit (1 item)" |
26 |
| - : `Code to edit (${codeToEdit.length} items)`; |
| 25 | + ? "(1 item)" |
| 26 | + : `(${codeToEdit.length} items)`; |
27 | 27 |
|
28 | 28 | function onDelete(rif: CodeToEdit) {
|
29 | 29 | dispatch(removeCodeToEdit(rif));
|
@@ -57,7 +57,11 @@ export default function CodeToEditCard() {
|
57 | 57 | return (
|
58 | 58 | <div className="bg-vsc-editor-background mx-3 flex flex-col rounded-t-lg p-1">
|
59 | 59 | <div className="text-lightgray flex items-center justify-between gap-1.5 py-1.5 pl-3 pr-2 text-xs">
|
60 |
| - <span>{title}</span> |
| 60 | + <div className="flex items-center gap-1"> |
| 61 | + <span>Code to edit</span> |
| 62 | + <span className="hidden sm:inline">{itemCount}</span> |
| 63 | + </div> |
| 64 | + |
61 | 65 | <AddFileButton onClick={() => setShowAddFileCombobox(true)} />
|
62 | 66 | </div>
|
63 | 67 |
|
|
0 commit comments