Skip to content

Commit 20e5d27

Browse files
authored
Merge pull request #8209 from sagemathinc/flyout-homepage
frontend/flyout: reinstate homepage
2 parents e8fac9e + 686d089 commit 20e5d27

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed

src/packages/frontend/project/new/new-file-page.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { defineMessage, FormattedMessage, useIntl } from "react-intl";
99

1010
import { default_filename } from "@cocalc/frontend/account";
1111
import { Alert, Col, Row } from "@cocalc/frontend/antd-bootstrap";
12-
import { filenameIcon } from "@cocalc/frontend/file-associations";
1312
import {
1413
ProjectActions,
14+
redux,
1515
useActions,
1616
useRedux,
1717
useTypedRedux,
@@ -27,9 +27,14 @@ import {
2727
} from "@cocalc/frontend/components";
2828
import FakeProgress from "@cocalc/frontend/components/fake-progress";
2929
import ComputeServer from "@cocalc/frontend/compute/inline";
30+
import { filenameIcon } from "@cocalc/frontend/file-associations";
3031
import { FileUpload, UploadLink } from "@cocalc/frontend/file-upload";
3132
import { labels } from "@cocalc/frontend/i18n";
3233
import { special_filenames_with_no_extension } from "@cocalc/frontend/project-file";
34+
import {
35+
getValidVBAROption,
36+
VBAR_KEY,
37+
} from "@cocalc/frontend/project/page/vbar";
3338
import { ProjectMap } from "@cocalc/frontend/todo-types";
3439
import { filename_extension, is_only_downloadable } from "@cocalc/util/misc";
3540
import { COLORS } from "@cocalc/util/theme";
@@ -330,9 +335,13 @@ export default function NewFilePage(props: Props) {
330335
);
331336
};
332337

333-
const showFiles = () => {
334-
actions.set_active_tab("files");
335-
};
338+
function closeNewPage() {
339+
// Showing homepage in flyout only mode, otherwise the files as usual
340+
const account_store = redux.getStore("account") as any;
341+
const vbar = account_store?.getIn(["other_settings", VBAR_KEY]);
342+
const pureFlyoutMode = getValidVBAROption(vbar) === "flyout";
343+
actions?.set_active_tab(pureFlyoutMode ? "home" : "files");
344+
}
336345

337346
//key is so autofocus works below
338347
return (
@@ -412,7 +421,7 @@ export default function NewFilePage(props: Props) {
412421
)}
413422
</div>
414423
}
415-
close={showFiles}
424+
close={closeNewPage}
416425
>
417426
<Modal
418427
onCancel={() => setCreatingFile("")}

src/packages/frontend/project/page/home-page/button.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@
55

66
import { Button } from "antd";
77

8-
import { useActions, useTypedRedux } from "@cocalc/frontend/app-framework";
8+
import {
9+
redux,
10+
useActions,
11+
useTypedRedux,
12+
} from "@cocalc/frontend/app-framework";
913
import { Icon } from "@cocalc/frontend/components";
14+
import {
15+
VBAR_KEY,
16+
getValidVBAROption,
17+
} from "@cocalc/frontend/project/page/vbar";
1018
import track from "@cocalc/frontend/user-tracking";
1119
import { COLORS } from "@cocalc/util/theme";
1220

@@ -28,18 +36,12 @@ export default function HomePageButton({ project_id, active, width }) {
2836
transitionDuration: "0s",
2937
}}
3038
onClick={() => {
31-
// People find the entire home page idea very confusing.
32-
// Thus I've commented this out:
39+
// Showing homepage in flyout only mode, otherwise the files as usual
40+
const account_store = redux.getStore("account") as any;
41+
const vbar = account_store?.getIn(["other_settings", VBAR_KEY]);
42+
const pureFlyoutMode = getValidVBAROption(vbar) === "flyout";
43+
actions?.set_active_tab(pureFlyoutMode ? "home" : "files");
3344

34-
// actions?.set_active_tab("home");
35-
36-
// And replaced it by just showing the file explorer in the
37-
// home directory, with no flyout panels open, which is a reasonable
38-
// expectation for a "Home" button, since that's what the project shows
39-
// by default on open. This is just a very quick bandaide to reduce
40-
// confusion until we come up with something better (e.g., a dropdown
41-
// menu and shortcut toolbar).
42-
actions?.set_active_tab("files");
4345
actions?.set_current_path("");
4446
actions?.setFlyoutExpanded("files", false, false);
4547
actions?.set_file_search("");

0 commit comments

Comments
 (0)