Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New feature request added #21

Open
wants to merge 31 commits into
base: ref/typescript
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8f4c39e
Merge with latest refactor ref/typescript
risenW Feb 11, 2022
62ac62d
Update README.md
risenW Feb 11, 2022
20b1924
Add file open and display in tab feature
risenW Feb 12, 2022
2ca59d0
Merge branch 'dev' of https://github.com/javascriptdata/dnotebook int…
risenW Feb 12, 2022
bdd6b06
Clean up files and folders
risenW Feb 12, 2022
ee24e1f
Add new notebook creation feature
risenW Feb 12, 2022
3dbc9f3
Complete new file creation for .dnb
risenW Feb 12, 2022
22455aa
Add support for notebook saving
risenW Feb 12, 2022
e922409
Add save and saving indicator
risenW Feb 12, 2022
59510b9
Started base status bar
risenW Feb 12, 2022
636cb86
Add download notebook feature
risenW Feb 12, 2022
7a0727f
Add changes tracker to update saving status
risenW Feb 12, 2022
741d17c
Add download status option
risenW Feb 12, 2022
f672773
Add Tab context menu with close option
risenW Feb 12, 2022
71f985f
Clean up and test prod build
risenW Feb 12, 2022
24a1e93
Add parallel script startup for servers
risenW Feb 12, 2022
7113d11
Fix tab context menu
risenW Feb 13, 2022
e5d0a04
Add refresh button for workspace
risenW Feb 13, 2022
e572024
Add file selection to display support
risenW Feb 13, 2022
f3f8642
optimize open of existing and new files
risenW Feb 13, 2022
831e752
clean up
risenW Feb 13, 2022
29dacdc
adding menu hover pop option
AceTheCreator Feb 17, 2022
bccf16a
completed hover menu feature
AceTheCreator Feb 21, 2022
033609d
exporting notebook to pdf
AceTheCreator Feb 21, 2022
d28b547
added export to pdf support
AceTheCreator Feb 22, 2022
4763a76
adding export to markdown feature
AceTheCreator Feb 22, 2022
cd2bd60
added markdown export
AceTheCreator Mar 4, 2022
c75f6ec
exoprting notebook to HTML
AceTheCreator Mar 4, 2022
c5dbbaf
added export to html feat
AceTheCreator Mar 4, 2022
efa15d6
fixed export to html feat
AceTheCreator Mar 5, 2022
2e5e1bc
.
AceTheCreator Mar 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**Dnotebook** allows you to create and share pages that contain live code, text and visualizations in a textbook-like manner.


> We are redesigning Dnotebook to feel more native. Track progress in this epic [issue](https://github.com/javascriptdata/dnotebook/issues/10), [project board](https://github.com/javascriptdata/dnotebook/projects/1), or [ref/typescript](https://github.com/javascriptdata/dnotebook/tree/ref/typescript) branch.
> We are redesigning Dnotebook to feel more native. Track progress in this epic [issue](https://github.com/javascriptdata/dnotebook/issues/10), [project board](https://github.com/javascriptdata/dnotebook/projects/1).

### Features:
- Easily perform interactive data exploration and analysis using efficient JavaScript packages like Danfo.js.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"install": "cd src/frontend && yarn && cd ../server && yarn",
"build": "cd src/frontend && yarn build && cd ../server && yarn build",
"dev": "cd src/frontend && yarn dev && cd ../server && yarn dev",
"start": "cd src/frontend && yarn start && cd ../server && yarn start"
"start": "cd src/server && yarn && yarn start & cd src/frontend && yarn && yarn build && yarn start"
},
"repository": {
"type": "git",
Expand All @@ -34,4 +34,4 @@
"url": "https://github.com/opensource9ja/dnotebook/issues"
},
"homepage": "https://github.com/opensource9ja/dnotebook#readme"
}
}
3 changes: 2 additions & 1 deletion src/frontend/components/CellEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dynamic from "next/dynamic";
import { useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { updateCells } from "../../lib/state/reducer"
import { updateCells, setNotebookSavingStatus } from "../../lib/state/reducer"
import { AppState, NbCell } from "../../lib/typings/types";

const AceEditor = dynamic(
Expand Down Expand Up @@ -32,6 +32,7 @@ const Editor = ({ cell }: { cell: NbCell }) => {
const [code, updateCode] = useState(cell?.content);

const handleCodeChange = (newCode: any) => {
dispatch(setNotebookSavingStatus("unsaved"))
updateCode(newCode);
const newCurrCell = { ...cell, content: newCode }

Expand Down
78 changes: 62 additions & 16 deletions src/frontend/components/IconMenu/file.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,80 @@
import { useState } from "react";
import FileNew from '@mui/icons-material/AddBox';
import FileOpen from '@mui/icons-material/OpenInNew';
import DriveFileRenameOutlineIcon from '@mui/icons-material/DriveFileRenameOutline';
import SaveIcon from '@mui/icons-material/Save';
import SaveAltIcon from '@mui/icons-material/SaveAlt';
import ImportExportIcon from '@mui/icons-material/ImportExport';
import React, { useState } from "react";
import MenuList from "@mui/material/MenuList";
import MenuItem from "@mui/material/MenuItem";
import ListItemText from "@mui/material/ListItemText";
import ListItemIcon from "@mui/material/ListItemIcon";
import Typography from "@mui/material/Typography";
import Paper from '@mui/material/Paper';
import { openFile, openFolder } from "../../lib/utils/fileSystem";
import { addNewBlankNotebook } from "../../lib/state/reducer"
import { useDispatch } from 'react-redux';
import {
openFile,
openNewFile,
saveNotebookToFileSystem,
downloadAsNewNotebook,
} from "../../lib/FileSystem/fileSystem";
import {
addNotebook,
setActiveNotebookTabNumber,
updateActiveNotebookName,
setNotebookSavingStatus,
} from "../../lib/state/reducer"
import { useDispatch, useSelector } from 'react-redux';
import { AppState } from '../../lib/typings/types';
import Export from "../Modals/Export";

export default function FileMenu() {
const [showExport, setShowExport] = useState<boolean>(false);
const dispatch = useDispatch()
const { activeNotebookTabNumber, notebooks, activeNotebookName } = useSelector((state: { app: AppState }) => state.app)

const handleNewBlankFileOpen = () => {
console.log("New Blank File");
dispatch(addNewBlankNotebook({
name: `Untitled_${Math.floor(Math.random() * 100)}`,
}))
const handleOpenNewFile = async () => {
const newNotebook = await openNewFile()
dispatch(addNotebook(newNotebook))
dispatch(setActiveNotebookTabNumber(Object.keys(notebooks).length))
dispatch(updateActiveNotebookName(newNotebook?.name));

}

const handleOpenExistingFile = async () => {
const notebook = await openFile();
const tabNames = Object.keys(notebooks);

if (tabNames.includes(notebook.name)){
dispatch(setActiveNotebookTabNumber(tabNames.indexOf(notebook.name)))
dispatch(updateActiveNotebookName(notebook.name))
return;
}

dispatch(addNotebook(notebook))
dispatch(setActiveNotebookTabNumber(activeNotebookTabNumber + 1))
dispatch(updateActiveNotebookName(notebook.name))

}

const handleSaveFile = async () => {
dispatch(setNotebookSavingStatus("saving"))
const currentNotebook = notebooks[activeNotebookName]
const fileHandle = currentNotebook.metadata?.fileHandle
const contents = JSON.stringify(currentNotebook)
await saveNotebookToFileSystem(fileHandle, contents)
dispatch(setNotebookSavingStatus("saved"))
}

const downloadActiveNotebook = async () => {
dispatch(setNotebookSavingStatus("downloading"))
const currentNotebook = {...notebooks[activeNotebookName]}
await downloadAsNewNotebook(currentNotebook)
dispatch(setNotebookSavingStatus("downloaded"))
}
return (
<Paper sx={{ width: 320, maxWidth: '100%' }}>
<MenuList>
<MenuItem onClick={() => handleNewBlankFileOpen()}>
<MenuItem onClick={() => handleOpenNewFile()}>
<ListItemIcon>
<FileNew fontSize="small" />
</ListItemIcon>
Expand All @@ -38,7 +83,7 @@ export default function FileMenu() {
⌘N
</Typography>
</MenuItem>
<MenuItem onClick={() => openFile()}>
<MenuItem onClick={() => handleOpenExistingFile()}>
<ListItemIcon>
<FileOpen fontSize="small" />
</ListItemIcon>
Expand All @@ -47,16 +92,16 @@ export default function FileMenu() {
⌘O
</Typography>
</MenuItem>
<MenuItem>
{/* <MenuItem disabled={activeNotebookName === "Dashboard"}>
<ListItemIcon>
<DriveFileRenameOutlineIcon fontSize="small" />
</ListItemIcon>
<ListItemText>Rename Notebook</ListItemText>
<Typography variant="body2" color="text.secondary">
⌘R
</Typography>
</MenuItem>
<MenuItem>
</MenuItem> */}
<MenuItem onClick={() => handleSaveFile()} disabled={activeNotebookName === "Dashboard"}>
<ListItemIcon>
<SaveIcon fontSize="small" />
</ListItemIcon>
Expand All @@ -65,7 +110,7 @@ export default function FileMenu() {
⌘S
</Typography>
</MenuItem>
<MenuItem>
<MenuItem onClick={() => downloadActiveNotebook()} disabled={activeNotebookName === "Dashboard"}>
<ListItemIcon>
<SaveAltIcon fontSize="small" />
</ListItemIcon>
Expand All @@ -74,7 +119,7 @@ export default function FileMenu() {
⌘D
</Typography>
</MenuItem>
<MenuItem>
<MenuItem disabled={activeNotebookName === "Dashboard"} onClick={() => setShowExport(true)}>
<ListItemIcon>
<ImportExportIcon fontSize="small" />
</ListItemIcon>
Expand All @@ -84,6 +129,7 @@ export default function FileMenu() {
</Typography>
</MenuItem>
</MenuList>
<Export open={showExport} handleClose={setShowExport} currentNote={""} />
</Paper>
);
};
56 changes: 0 additions & 56 deletions src/frontend/components/IconMenu/fileList.tsx

This file was deleted.

Empty file.
Loading