Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 7dcc2a8

Browse files
Merge branch 'master' into dark-mode-toggle
2 parents 119f84d + f809cda commit 7dcc2a8

File tree

22 files changed

+28498
-3
lines changed

22 files changed

+28498
-3
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,28 @@ on <a href="https://codepen.io">CodePen</a>.</span>
1010

1111

1212
## It's Live 🎉 Visit here ==> https://mini-code-editor.netlify.app/
13-
## pull req ==>http://bit.ly/mini-code-editor-app
13+
## PR ==>http://bit.ly/mini-code-editor-app
1414
---
1515

1616
## 2) Community Chat App with react and firebase
1717
![community_chat](https://user-images.githubusercontent.com/37651620/94143516-a7f74500-fe8f-11ea-9105-188e31f1d62a.png)
1818

1919
## It's Live 🎉 Visit here ==> https://community-chat-app.netlify.app/
20-
## pull req ==> http://bit.ly/community-chat-app
20+
## PR ==> http://bit.ly/community-chat-app
21+
---
22+
23+
## 3) Dark Mode Toggle
24+
## Switch and button to toggle between dark and light mode
25+
![light_mode](https://user-images.githubusercontent.com/37651620/94393048-c43dff00-0179-11eb-9181-31e24e54ab8b.png)
26+
![dark_mode](https://user-images.githubusercontent.com/37651620/94393067-cef89400-0179-11eb-8488-fe54d93901b9.png)
27+
28+
## It's Live 🎉 Visit here ==> https://dark-mode-switcher.netlify.app/
29+
## PR ==> http://bit.ly/dark-mode-toggle
30+
---
31+
## 4) Notetaking notebook app
32+
![notebook](https://user-images.githubusercontent.com/37651620/94556131-54fd0380-027c-11eb-9926-c55a3130bb36.png)
33+
34+
## It's Live 🎉 Visit here ==> https://notebook-app.netlify.app/
35+
36+
## PR => http://bit.ly/notebook-app
2137
---

notebook-react-web-app-project/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
![under_construction](https://user-images.githubusercontent.com/37651620/93677983-a7942e00-facc-11ea-8b6d-b57e73dc73bf.png)
1+
![notebook](https://user-images.githubusercontent.com/37651620/94556131-54fd0380-027c-11eb-9926-c55a3130bb36.png)
2+
3+
## It's Live 🎉 Visit here ==> https://notebook-app.netlify.app/
24

35
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
46

notebook-react-web-app-project/package-lock.json

Lines changed: 16896 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "notebook-react-web-app-project",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@material-ui/core": "^4.11.0",
7+
"@material-ui/icons": "^4.9.1",
8+
"@testing-library/jest-dom": "^4.2.4",
9+
"@testing-library/react": "^9.3.2",
10+
"@testing-library/user-event": "^7.1.2",
11+
"firebase": "^7.21.1",
12+
"react": "^16.13.1",
13+
"react-dom": "^16.13.1",
14+
"react-quill": "^1.3.5",
15+
"react-scripts": "3.4.3"
16+
},
17+
"scripts": {
18+
"start": "react-scripts start",
19+
"build": "react-scripts build",
20+
"test": "react-scripts test",
21+
"eject": "react-scripts eject"
22+
},
23+
"eslintConfig": {
24+
"extends": "react-app"
25+
},
26+
"browserslist": {
27+
"production": [
28+
">0.2%",
29+
"not dead",
30+
"not op_mini all"
31+
],
32+
"development": [
33+
"last 1 chrome version",
34+
"last 1 firefox version",
35+
"last 1 safari version"
36+
]
37+
}
38+
}
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<link rel="stylesheet" href="//cdn.quilljs.com/1.2.6/quill.snow.css" />
5+
<meta charset="utf-8" />
6+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<meta name="theme-color" content="#000000" />
9+
<meta
10+
name="description"
11+
content="Web site created using create-react-app"
12+
/>
13+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
14+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
15+
16+
<title>नोटबुक Notebook</title>
17+
</head>
18+
<body>
19+
<noscript>You need to enable JavaScript to run this app.</noscript>
20+
21+
<div id="root"></div>
22+
</body>
23+
</html>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
},
10+
{
11+
"src": "logo192.png",
12+
"type": "image/png",
13+
"sizes": "192x192"
14+
},
15+
{
16+
"src": "logo512.png",
17+
"type": "image/png",
18+
"sizes": "512x512"
19+
}
20+
],
21+
"start_url": ".",
22+
"display": "standalone",
23+
"theme_color": "#000000",
24+
"background_color": "#ffffff"
25+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
import React from "react";
2+
import SidebarComponent from "./noteSidebar/noteSidebar";
3+
import EditorComponent from "./noteEditor/noteEditor";
4+
import "./styles/App.css";
5+
6+
const firebase = require("firebase");
7+
8+
class App extends React.Component {
9+
constructor() {
10+
super();
11+
this.state = {
12+
selectedNoteIndex: null,
13+
selectedNote: null,
14+
notes: null,
15+
};
16+
}
17+
18+
render() {
19+
return (
20+
<div className="app-container">
21+
<SidebarComponent
22+
selectedNoteIndex={this.state.selectedNoteIndex}
23+
notes={this.state.notes}
24+
deleteNote={this.deleteNote}
25+
selectNote={this.selectNote}
26+
newNote={this.newNote}
27+
></SidebarComponent>
28+
{this.state.selectedNote ? (
29+
<EditorComponent
30+
selectedNote={this.state.selectedNote}
31+
selectedNoteIndex={this.state.selectedNoteIndex}
32+
notes={this.state.notes}
33+
noteUpdate={this.noteUpdate}
34+
></EditorComponent>
35+
) : null}
36+
</div>
37+
);
38+
}
39+
40+
componentDidMount = () => {
41+
firebase
42+
.firestore()
43+
.collection("notebook")
44+
.onSnapshot((serverUpdate) => {
45+
const notes = serverUpdate.docs.map((_doc) => {
46+
const data = _doc.data();
47+
data["id"] = _doc.id;
48+
return data;
49+
});
50+
console.log(notes);
51+
this.setState({ notes: notes });
52+
});
53+
};
54+
55+
selectNote = (note, index) =>
56+
this.setState({ selectedNoteIndex: index, selectedNote: note });
57+
noteUpdate = (id, noteObj) => {
58+
firebase.firestore().collection("notebook").doc(id).update({
59+
title: noteObj.title,
60+
body: noteObj.body,
61+
timestamp: firebase.firestore.FieldValue.serverTimestamp(),
62+
});
63+
};
64+
newNote = async (title) => {
65+
const note = {
66+
title: title,
67+
body: "",
68+
};
69+
const newFromDB = await firebase.firestore().collection("notebook").add({
70+
title: note.title,
71+
body: note.body,
72+
timestamp: firebase.firestore.FieldValue.serverTimestamp(),
73+
});
74+
const newID = newFromDB.id;
75+
await this.setState({ notes: [...this.state.notes, note] });
76+
const newNoteIndex = this.state.notes.indexOf(
77+
this.state.notes.filter((_note) => _note.id === newID)[0]
78+
);
79+
this.setState({
80+
selectedNote: this.state.notes[newNoteIndex],
81+
selectedNoteIndex: newNoteIndex,
82+
});
83+
};
84+
deleteNote = async (note) => {
85+
const noteIndex = this.state.notes.indexOf(note);
86+
await this.setState({
87+
notes: this.state.notes.filter((_note) => _note !== note),
88+
});
89+
if (this.state.selectedNoteIndex === noteIndex) {
90+
this.setState({ selectedNoteIndex: null, selectedNote: null });
91+
} else {
92+
this.state.notes.length > 1
93+
? this.selectNote(
94+
this.state.notes[this.state.selectedNoteIndex - 1],
95+
this.state.selectedNoteIndex - 1
96+
)
97+
: this.setState({ selectedNoteIndex: null, selectedNote: null });
98+
}
99+
100+
firebase.firestore().collection("notebook").doc(note.id).delete();
101+
};
102+
}
103+
104+
export default App;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export default function debounce(a,b,c){
2+
var d,e;
3+
return function(){
4+
function h(){
5+
d=null;
6+
c||(e=a.apply(f,g));
7+
}
8+
var f=this,g=arguments;
9+
return (clearTimeout(d),d=setTimeout(h,b),c&&!d&&(e=a.apply(f,g)),e)
10+
}
11+
}
12+
13+
export function removeHTMLTags (str) {
14+
return str.replace(/<[^>]*>?/gm, '');
15+
};

0 commit comments

Comments
 (0)