Skip to content

Commit fcfd5e7

Browse files
committed
explorer search box shouldn't move stuff
1 parent d98f66d commit fcfd5e7

File tree

4 files changed

+25
-31
lines changed

4 files changed

+25
-31
lines changed

src/packages/frontend/project/call-to-support.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { Alert, Typography } from "antd";
22
import { join } from "path";
3-
43
import { A } from "@cocalc/frontend/components/A";
54
import { appBasePath } from "@cocalc/frontend/customize/app-base-path";
6-
7-
const { Paragraph, Text } = Typography;
5+
const { Paragraph } = Typography;
86
export const BUY_A_LICENSE_URL = join(appBasePath, "/store/site-license");
97

108
export function CallToSupport({ onClose }: { onClose? }) {

src/packages/frontend/project/explorer/explorer.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import * as immutable from "immutable";
88
import * as _ from "lodash";
99
import React from "react";
1010
import { FormattedMessage } from "react-intl";
11-
1211
import { UsersViewing } from "@cocalc/frontend/account/avatar/users-viewing";
1312
import { Button, ButtonGroup, Col, Row } from "@cocalc/frontend/antd-bootstrap";
1413
import {
@@ -48,8 +47,7 @@ import { ActionBar } from "./action-bar";
4847
import { ActionBox } from "./action-box";
4948
import { FetchDirectoryErrors } from "./fetch-directory-errors";
5049
import { FileListing } from "./file-listing";
51-
import { TerminalModeDisplay } from "./file-listing/terminal-mode-display";
52-
import { default_ext, TERM_MODE_CHAR } from "./file-listing/utils";
50+
import { default_ext } from "./file-listing/utils";
5351
import { MiscSideButtons } from "./misc-side-buttons";
5452
import { NewButton } from "./new-button";
5553
import { PathNavigator } from "./path-navigator";
@@ -685,11 +683,6 @@ const Explorer0 = rclass(
685683
/>
686684
);
687685
}
688-
render_terminal_mode() {
689-
if (this.props.file_search[0] === TERM_MODE_CHAR) {
690-
return <TerminalModeDisplay />;
691-
}
692-
}
693686

694687
render() {
695688
let project_is_running: boolean,
@@ -753,7 +746,6 @@ const Explorer0 = rclass(
753746
{this.render_error()}
754747
{this.render_activity()}
755748
{this.render_control_row(visible_listing)}
756-
{this.render_terminal_mode()}
757749
{this.props.ext_selection != null && (
758750
<AskNewFilename project_id={this.props.project_id} />
759751
)}

src/packages/frontend/project/explorer/file-listing/terminal-mode-display.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import { useState } from "react";
88

99
import { A } from "@cocalc/frontend/components/A";
1010

11-
export function TerminalModeDisplay() {
11+
export function TerminalModeDisplay({ style }) {
1212
const [extra, setExtra] = useState<boolean>(false);
1313
return (
1414
<Alert
1515
banner
1616
type="info"
17-
style={{ margin: "5px 0 15px 0" }}
17+
style={style}
1818
message={
1919
<>
2020
You are in <a onClick={() => setExtra(!extra)}>terminal mode</a>.
@@ -26,9 +26,9 @@ export function TerminalModeDisplay() {
2626
Terminal mode is triggered by a leading <code>/</code> in the file
2727
filter box. If you would like to display all folders instead, enter
2828
a space in front of the <code>/</code>. Terminal mode allows you to
29-
quickly use common commands like <code>mv</code> or <code>cp</code>{" "}
30-
in the displayed directory without having to click on the file
31-
listing UI. Start{" "}
29+
quickly use common Linux commands like <code>mv</code> or{" "}
30+
<code>cp</code> in the displayed directory without having to click
31+
on the file listing UI. Start{" "}
3232
<A href="https://www.google.com/search?q=introduction+to+command+line">
3333
here
3434
</A>{" "}

src/packages/frontend/project/explorer/search-bar.tsx

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { Alert, Flex } from "antd";
77
import React from "react";
88
import { useIntl } from "react-intl";
9-
109
import { CSS, redux } from "@cocalc/frontend/app-framework";
1110
import { Icon, SearchInput } from "@cocalc/frontend/components";
1211
import { ProjectActions } from "@cocalc/frontend/project_store";
@@ -15,6 +14,18 @@ import { path_to_file } from "@cocalc/util/misc";
1514
import { useProjectContext } from "../context";
1615
import { TERM_MODE_CHAR } from "./file-listing";
1716
import { ListingItem } from "./types";
17+
import { TerminalModeDisplay } from "@cocalc/frontend/project/explorer/file-listing/terminal-mode-display";
18+
19+
const HelpStyle = {
20+
wordWrap: "break-word",
21+
top: "40px",
22+
position: "absolute",
23+
width: "100%",
24+
height: "38",
25+
boxShadow: "#999 6px 6px 6px",
26+
zIndex: 100,
27+
borderRadius: "15px",
28+
} as const;
1829

1930
export const outputMinitermStyle: React.CSSProperties = {
2031
background: "white",
@@ -154,11 +165,10 @@ export const SearchBar = React.memo((props: Props) => {
154165
}
155166

156167
function render_help_info(): React.JSX.Element | undefined {
157-
if (
158-
file_search.length > 0 &&
159-
num_files_displayed > 0 &&
160-
file_search[0] !== TERM_MODE_CHAR
161-
) {
168+
if (file_search[0] == TERM_MODE_CHAR) {
169+
return <TerminalModeDisplay style={HelpStyle} />;
170+
}
171+
if (file_search.length > 0 && num_files_displayed > 0) {
162172
let text;
163173
const firstFolderPosition = file_search.indexOf("/");
164174
if (file_search === " /") {
@@ -171,13 +181,7 @@ export const SearchBar = React.memo((props: Props) => {
171181
} else {
172182
text = `Showing files matching "${file_search}"`;
173183
}
174-
return (
175-
<Alert
176-
style={{ wordWrap: "break-word", marginBottom: "10px" }}
177-
type="info"
178-
message={text}
179-
/>
180-
);
184+
return <Alert style={HelpStyle} type="info" message={text} />;
181185
}
182186
}
183187

@@ -294,7 +298,7 @@ export const SearchBar = React.memo((props: Props) => {
294298
}
295299

296300
return (
297-
<Flex style={{ flex: "1 0 auto" }} vertical={true}>
301+
<Flex style={{ flex: "1 0 auto", position: "relative" }} vertical={true}>
298302
<SearchInput
299303
autoFocus
300304
autoSelect

0 commit comments

Comments
 (0)