Skip to content

Commit b9101da

Browse files
Fixed: Optimized the codes
1 parent b8576a4 commit b9101da

File tree

31 files changed

+4551
-1589
lines changed

31 files changed

+4551
-1589
lines changed

frontend/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@
1616
content="https://ucarecdn.com/f2d6b4b8-83f0-4c3c-abc3-39d15fe894cd/-/preview/700x700/-/quality/smart/-/format/auto/img1.png">
1717
<meta property="og:url" content="https://bloogo.vercel.app">
1818
<meta property="og:type" content="website">
19+
<meta property=”og:site_name” content="Bloogo">
1920

2021
<!-- Canonical URL -->
2122
<link rel="canonical" href="https://bloogo.vercel.app">
2223

2324
<!-- Robots Meta Tag -->
2425
<meta name="robots" content="index, follow">
26+
<meta name=“robots” content=noindex, nofollow”>
27+
<meta name=“robots” content=noindex, follow”>
28+
<meta name=“robots” content=index, nofollow”>
2529

2630
<title>Bloogo</title>
2731
</head>

frontend/package-lock.json

Lines changed: 4071 additions & 1055 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,19 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"@cloudinary/react": "^1.11.2",
1413
"@cloudinary/url-gen": "^1.11.1",
1514
"@emotion/react": "^11.11.1",
1615
"@emotion/styled": "^11.11.0",
1716
"@mui/icons-material": "^5.14.1",
1817
"@mui/material": "^5.14.4",
1918
"@mui/x-date-pickers": "^6.11.0",
2019
"@reduxjs/toolkit": "^1.9.5",
20+
"@uiw/react-markdown-editor": "^6.0.0",
21+
"@uiw/react-markdown-preview": "^5.0.7",
2122
"animate.css": "^4.1.1",
2223
"axios": "^1.4.0",
2324
"dayjs": "^1.11.9",
2425
"formik": "^2.4.3",
25-
"html-react-parser": "^4.2.0",
26-
"jodit": "^4.0.0-beta.61",
27-
"jodit-react": "^1.3.39",
2826
"moment": "^2.29.4",
2927
"prop-types": "^15.8.1",
3028
"react": "^18.2.0",
@@ -37,16 +35,19 @@
3735
"react-select": "^5.7.4",
3836
"react-share": "^4.4.1",
3937
"react-toastify": "^9.1.3",
40-
"react-tooltip": "^5.20.0",
4138
"reading-time-estimator": "^1.9.0",
4239
"redux": "^4.2.1",
40+
"rehype-autolink-headings": "^7.1.0",
41+
"rehype-raw": "^7.0.0",
42+
"remark-gfm": "^4.0.0",
43+
"remark-images": "^4.0.0",
4344
"yup": "^1.2.0"
4445
},
4546
"devDependencies": {
4647
"@types/react": "^18.2.19",
4748
"@types/react-dom": "^18.2.7",
4849
"@vitejs/plugin-react-swc": "^3.3.2",
49-
"autoprefixer": "^10.4.14",
50+
"autoprefixer": "^10.4.17",
5051
"eslint": "^8.46.0",
5152
"eslint-plugin-react": "^7.33.1",
5253
"eslint-plugin-react-hooks": "^4.6.0",
@@ -55,4 +56,4 @@
5556
"tailwindcss": "^3.3.3",
5657
"vite": "^4.4.5"
5758
}
58-
}
59+
}

frontend/src/App.jsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import Header from "./components/Header";
44
import Footer from "./components/Footer";
55
import { BrowserRouter } from "react-router-dom";
66
import { DetectSignLogin } from "./components/DetectSignLogin";
7+
import { ToastContainer} from "react-toastify";
8+
import "react-toastify/dist/ReactToastify.css";
79

810
const theme = createTheme({
911
palette: {
@@ -25,8 +27,20 @@ const theme = createTheme({
2527

2628
function App() {
2729
return (
28-
<>
30+
<main>
2931
<BrowserRouter basename="/">
32+
<ToastContainer
33+
position="top-center"
34+
autoClose={2000}
35+
hideProgressBar={false}
36+
newestOnTop={false}
37+
closeOnClick
38+
rtl={false}
39+
pauseOnFocusLoss
40+
draggable
41+
pauseOnHover={false}
42+
theme="colored"
43+
/>
3044
<ThemeProvider theme={theme}>
3145
<DetectSignLogin>
3246
<Header />
@@ -37,7 +51,7 @@ function App() {
3751
</DetectSignLogin>
3852
</ThemeProvider>
3953
</BrowserRouter>
40-
</>
54+
</main>
4155
);
4256
}
4357

frontend/src/Hooks/useProfile.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { useContext } from "react";
2+
import { ProfileData } from "../components/ProfileContext";
3+
4+
const useProfile = () => {
5+
const profiledata = useContext(ProfileData);
6+
return profiledata;
7+
};
8+
export default useProfile;

frontend/src/Pages/About/index.jsx

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,43 @@ import { AboutData } from "../../data";
44
const About = () => {
55
useTitle("About");
66
return (
7-
<main>
8-
<div className="my-10 space-y-14">
9-
<div className="mx-10 lg:mx-72 flex flex-col gap-5 justify-center text-justify items-center">
10-
<span className="text-2xl md:text-4xl font-gara font-bold self-start">
11-
About
12-
</span>
13-
<div className="space-y-5 self-start">
14-
<p className="text-xl md:text-2xl">
15-
Bloogo is the easiest way to share your writing on the web.
16-
</p>
17-
<p className="text-base md:text-lg leading-relaxed">
18-
Create a space for your thoughts. Reach people with your ideas,
19-
and form new connections. Keep loved ones in the loop, free from
20-
social media. Bloogo is a simple, modern, and ad-free web
21-
pub­lish­ing platform.
22-
</p>
23-
</div>
24-
<img
25-
src={
26-
"https://ucarecdn.com/f2d6b4b8-83f0-4c3c-abc3-39d15fe894cd/-/preview/700x700/-/quality/smart/-/format/auto/img1.png"
27-
}
28-
className="w-[600px] border-2 border-gray-400 rounded-lg shadow-2xl shadow-gray-500"
29-
/>
30-
</div>
31-
<div className="flex flex-row flex-wrap justify-evenly items-center font-raj gap-9">
32-
{AboutData.map((value, index) => {
33-
return (
34-
<div
35-
key={index}
36-
className="flex flex-col justify-between gap-7 content-center h-36"
37-
>
38-
<span className="text-xl font-extrabold">{value.title}</span>
39-
<span className="text-lg w-64 text-justify">
40-
{value.content}
41-
</span>
42-
</div>
43-
);
44-
})}
7+
<div className="my-10 space-y-14">
8+
<div className="mx-10 lg:mx-72 flex flex-col gap-5 justify-center text-justify items-center">
9+
<span className="text-2xl md:text-4xl font-gara font-bold self-start">
10+
About
11+
</span>
12+
<div className="space-y-5 self-start">
13+
<p className="text-xl md:text-2xl">
14+
Bloogo is the easiest way to share your writing on the web.
15+
</p>
16+
<p className="text-base md:text-lg leading-relaxed">
17+
Create a space for your thoughts. Reach people with your ideas, and
18+
form new connections. Keep loved ones in the loop, free from social
19+
media. Bloogo is a simple, modern, and ad-free web pub­lish­ing
20+
platform.
21+
</p>
4522
</div>
23+
<img
24+
src={
25+
"https://ucarecdn.com/f2d6b4b8-83f0-4c3c-abc3-39d15fe894cd/-/preview/700x700/-/quality/smart/-/format/auto/img1.png"
26+
}
27+
className="w-[600px] border-2 border-gray-400 rounded-lg shadow-2xl shadow-gray-500"
28+
/>
29+
</div>
30+
<div className="flex flex-row flex-wrap justify-evenly items-center font-raj gap-9">
31+
{AboutData.map((value, index) => {
32+
return (
33+
<div
34+
key={index}
35+
className="flex flex-col justify-between gap-7 content-center h-36"
36+
>
37+
<span className="text-xl font-extrabold">{value.title}</span>
38+
<span className="text-lg w-64 text-justify">{value.content}</span>
39+
</div>
40+
);
41+
})}
4642
</div>
47-
</main>
43+
</div>
4844
);
4945
};
5046
export default About;

frontend/src/Pages/ChangePassword/index.jsx

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import { useToken } from "../../Hooks/useToken";
77
import { useFormik } from "formik";
88
import { change_Schema } from "../../Schemas/scheme";
99
import { changePassword } from "../../api/api";
10-
import { ToastContainer, toast } from "react-toastify";
10+
import { toast } from "react-toastify";
11+
import { PleaseWait } from "../../components/PleaseWait";
1112

1213
export const ChangePassword = () => {
1314
useTitle("Change Password");
1415
const [showCurrent, setCurrent] = useState(false);
1516
const [showNew, setNew] = useState(false);
1617
const [showRe, setRe] = useState(false);
18+
const [isChanging, setChanging] = useState(false);
1719

1820
const handlestate = (fun, state) => {
1921
fun(!state);
@@ -34,19 +36,19 @@ export const ChangePassword = () => {
3436
validationSchema: change_Schema,
3537
onSubmit: (value) => {
3638
const formdata = new FormData();
39+
setChanging(true);
3740
formdata.append("password", value.newpassword);
3841
formdata.append("current", value.oldpassword);
3942
changePassword(formdata, token)
4043
.then((res) => {
44+
setChanging(false);
4145
if (res.status === 200) {
4246
toast.success("Password Changed Successfully.");
43-
setTimeout(() => {
44-
navi(-1);
45-
}, 2500);
47+
navi(-1);
4648
}
4749
})
4850
.catch((res) => {
49-
console.log(res);
51+
setChanging(false);
5052
if (res?.response?.status === 406) {
5153
toast.error("Old Password and New Password are Same");
5254
} else if (res?.response?.status === 401) {
@@ -64,18 +66,6 @@ export const ChangePassword = () => {
6466
});
6567
return (
6668
<>
67-
<ToastContainer
68-
position="top-center"
69-
autoClose={2000}
70-
hideProgressBar={false}
71-
newestOnTop={false}
72-
closeOnClick
73-
rtl={false}
74-
pauseOnFocusLoss
75-
draggable
76-
pauseOnHover={false}
77-
theme="colored"
78-
/>
7969
<div className="my-4 w-full flex flex-col justify-center items-center">
8070
<div className="w-[95%] sm:w-96 mx-2 rounded-xl px-2 py-10 border-2 border-indigo-500">
8171
<form
@@ -192,13 +182,17 @@ export const ChangePassword = () => {
192182
/>
193183
</div>
194184
<div className="flex flex-row justify-center items-center gap-2 flex-wrap">
195-
<button
196-
type="submit"
197-
name="submit"
198-
className="border-2 border-indigo-500 px-11 mt-2 rounded-lg py-2 font-meri text-sm hover:bg-indigo-500 hover:text-white transition-{bg} ease-in duration-150"
199-
>
200-
Change
201-
</button>
185+
{isChanging ? (
186+
<PleaseWait />
187+
) : (
188+
<button
189+
type="submit"
190+
name="submit"
191+
className="border-2 border-indigo-500 px-11 mt-2 rounded-lg py-2 font-meri text-sm hover:bg-indigo-500 hover:text-white transition-{bg} ease-in duration-150"
192+
>
193+
Change
194+
</button>
195+
)}
202196
<button
203197
type="button"
204198
onClick={() => {

frontend/src/Pages/Dashboard/index.jsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useState } from "react";
1+
import { useCallback, useEffect, useState } from "react";
22
import { useTitle } from "../../Hooks/useTitle";
33
import { useNavigate } from "react-router-dom";
44
import { useToken } from "../../Hooks/useToken";
@@ -20,9 +20,9 @@ export const Dashboard = () => {
2020
const token = useToken();
2121
const navi = useNavigate();
2222

23-
useEffect(() => {
24-
setLoading(true);
25-
const Per_Page = 6;
23+
const Per_Page = 6;
24+
25+
const getBlogs = useCallback(() => {
2626
getUserBlogs(token)
2727
.then((res) => {
2828
if (res.status === 200) {
@@ -38,7 +38,11 @@ export const Dashboard = () => {
3838
.catch(() => {
3939
setLoading(false);
4040
});
41-
}, [token, page]);
41+
}, [page, token]);
42+
43+
useEffect(() => {
44+
getBlogs();
45+
}, [getBlogs]);
4246

4347
const handleChange = (e, val) => {
4448
setPage(val);
@@ -77,7 +81,7 @@ export const Dashboard = () => {
7781
Your Blogs :{" "}
7882
</span>
7983
<div className="flex flex-col w-full gap-3 flex-wrap">
80-
<BlogCards blogs={blogs} showbuttons />
84+
<BlogCards blogs={blogs} showbuttons getBlogs={getBlogs} />
8185
</div>
8286
<Pagination
8387
page={page}

0 commit comments

Comments
 (0)