Skip to content

Commit

Permalink
Merge pull request Finalgoal231#2 from shinevue/avatar
Browse files Browse the repository at this point in the history
PR: sync dev with avatar
  • Loading branch information
shinevue authored Jul 7, 2024
2 parents e34691a + a5c712e commit 5a99dbc
Show file tree
Hide file tree
Showing 23 changed files with 1,069 additions and 89 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@

## Contributor

#### [Truestar](http://192.168.6.2:3000/truestar)
#### [Shine](http://192.168.6.2:3000/shine)
#### [Yonex](http://192.168.6.2:3000/Yonex)
#### [Luckystar](http://192.168.6.2:3000/luckystar)
#### [Shine](https://github.com/shine)
#### [Truestar]
#### [Yonex]
#### [Luckystar]
#### [Achilles](https://github.com/oleh1010)
15 changes: 15 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"react": "^18.2.0",
"react-chartjs-2": "^5.0.1",
"react-dom": "^18.2.0",
"react-icons": "^5.2.1",
"react-notifications": "^1.7.4",
"react-redux": "^8.0.5",
"react-router-dom": "^6.4.3",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion client/src/components/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const Button = (prop) => {
return (
<button
type="button"
className={`px-3 py-1.5 bg-lime-600 dark:bg-slate-600 hover:bg-gray-700 dark:hover:bg-slate-400 ${prop.class} text-white rounded-[10px] cursor-pointer transition duration-300 ease-out ml-2`}
className={`px-2 py-1 bg-lime-600 dark:bg-slate-600 hover:bg-gray-700 dark:hover:bg-slate-400 ${prop.class} text-white rounded-[10px] cursor-pointer transition duration-300 ease-out ml-2`}
onClick={prop.onClick}
>
{prop.subject}
Expand Down
5 changes: 3 additions & 2 deletions client/src/features/dashboard/components/ArticleCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import XMarkIcon from "@heroicons/react/24/solid/XMarkIcon";
import { BiSolidEditAlt } from "react-icons/bi";
import { Link } from "react-router-dom";
const ArticleCard = (prop) => {
const user = JSON.parse(localStorage.getItem("user"));
return (
<>
<div>
<div
className={
"card flex flex-col items-center w-full px-3 bg-base-100 shadow-xl mt-4"
Expand Down Expand Up @@ -82,7 +83,7 @@ const ArticleCard = (prop) => {
)}
</div>
</div>
</>
</div>
);
};

Expand Down
2 changes: 1 addition & 1 deletion client/src/features/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function Dashboard() {

return (
<>
<Toolbar onAddClick={setHandleAddArticle} />
{/* <Toolbar onAddClick={setHandleAddArticle} /> */}
{value.articles.map((v, i) => {
return (
<div key={i}>
Expand Down
90 changes: 47 additions & 43 deletions client/src/features/settings/profilesettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,55 +80,59 @@ function ProfileSettings() {
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 mt-5"></div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 mt-5">
<SelectBoxBig
label={"Bio"}
name={"bio"}
class="w-full"
value={profile.bio}
options={[
"FullStack",
"Blockchain",
"Frontend",
"Backend",
"Designer",
]}
onChange={setHandleProfile}
/>
<SelectBoxBig
label={"Category"}
class="w-full "
options={["", ...cates]}
onChange={(e) => setHandleTag(e)}
/>
</div>
<div className="flex items-center">
<div
className={`form-control w-11/12 m-2 flex sm:flex-row flex-col input border-2`}
>
{tag.map((value, index) => (
<div>
<SelectBoxBig
label={"Bio"}
name={"bio"}
class="w-full"
value={profile.bio}
options={[
"FullStack",
"Blockchain",
"Frontend",
"Backend",
"Designer",
]}
onChange={setHandleProfile}
/>
</div>
<div>
<SelectBoxBig
label={"Category"}
class="w-full "
options={["", ...cates]}
onChange={(e) => setHandleTag(e)}
/>
<div className="flex">
<div
key={index}
className="flex sm:flex-row flex-col items-center m-1 w-max border-2 mr-2"
className={`form-control w-11/12 m-2 flex sm:flex-row flex-col input border-2`}
>
<div className=" text-[15px] mr-1">{value}</div>
{tag.map((value, index) => (
<div
key={index}
className="flex sm:flex-row flex-col items-center m-1 w-max border-2 mr-2"
>
<div className=" text-[15px] mr-1">{value}</div>
<button
className="border-1 text-[15px]"
onClick={() => deleteTags(index)}
>
&times;
</button>
</div>
))}
</div>
<div className="flex items-center">
<button
className="border-1 text-[15px]"
onClick={() => deleteTags(index)}
type="button"
onClick={addTags}
className="flex px-4 py-2 bg-green-600 hover:bg-green-700 dark:hover:bg-green-500 text-[15px] text-white rounded-[6px] cursor-pointer transition duration-300 ease-out"
>
&times;
<BsPlusLg className="text-[21px] mt-[2px] mr-[3px]" />
<div className="mt-[1px]">Category</div>
</button>
</div>
))}
</div>
<div className="flex items-center">
<button
type="button"
onClick={addTags}
className="flex px-4 py-2 mt-5 bg-green-600 hover:bg-green-700 dark:hover:bg-green-500 text-[15px] text-white rounded-[6px] cursor-pointer transition duration-300 ease-out"
>
<BsPlusLg className="text-[21px] mt-[2px] mr-[3px]" />
<div className="mt-[1px]">Category</div>
</button>
</div>
</div>
</div>
<div className="divider"></div>
Expand Down
4 changes: 3 additions & 1 deletion client/src/pages/Article/AllArticle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ function AllArticle() {
dispatch(setCategoryIndex(e.target.value));
};
useEffect(() => {
dispatch(getAllArticles());
dispatch(
getAllArticles({ sortIndex: value.sortIndex, searchVal: value.searchVal, categoryIndex: value.categoryIndex }),
);
}, [dispatch, value.isLoading, value.message]);

return (
Expand Down
1 change: 1 addition & 0 deletions client/src/pages/Article/MyArticle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function MyArticle(props) {
return (
<div key={i}>
<ArticleCard
type={"myarticle"}
title={v.title}
avatar={v.from.avatar}
favouriteNum={v.favorite.length}
Expand Down
17 changes: 7 additions & 10 deletions client/src/redux/articleSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ import axios from "axios";
import { requestServer } from "../utils/requestServer";

export const getHomeArticles = createAsyncThunk("getHomeArticle", async (data) => {
const res = await axios.get(
process.env.REACT_APP_BASE_URL + "/api/article/home", {params: data.followers}
);
const res = await axios.get(process.env.REACT_APP_BASE_URL + "/api/article/home", { params: data.followers });
return res.data;
});

export const getAllArticles = createAsyncThunk("getAllArticle", async () => {
const res = await axios.get(process.env.REACT_APP_BASE_URL + "/api/article/all");
export const getAllArticles = createAsyncThunk("getAllArticle", async (data) => {
const res = await axios.get(process.env.REACT_APP_BASE_URL + "/api/article/all", { params: data });
return res.data;
});
export const getDraftArticles = createAsyncThunk("getDraftArticles", async (payload) => {
console.log(payload);
const res = await axios.get(process.env.REACT_APP_BASE_URL + "/api/article/draft", { params: payload });
return res.data;
});
Expand All @@ -24,7 +21,6 @@ export const getMyArticles = createAsyncThunk("getMyArticles", async (payload) =
return res.data;
});
export const getFavoriteArticles = createAsyncThunk("getFavoriteArticles", async (payload) => {
console.log(payload);
const res = await axios.get(process.env.REACT_APP_BASE_URL + "/api/article/favorite", { params: payload });
return res.data;
});
Expand All @@ -38,7 +34,8 @@ export const createArticle = createAsyncThunk("createArticle", async (data) => {
else return { msg: "Save to Draft!!!" };
});
export const updateArticle = createAsyncThunk("updateArticle", async (payload) => {
const res = await requestServer("put", `/api/article/${payload._id}`, payload);
console.log(payload);
const res = await requestServer("put", `/api/article/${payload.id}`, payload.data);
return res.data;
});
export const deleteArticle = createAsyncThunk("deleteArticle", async (data) => {
Expand All @@ -50,8 +47,8 @@ export const addComment = createAsyncThunk("addComment", async (payload) => {
return res.data;
});
export const addFavourite = createAsyncThunk("addFavourite", async (payload) => {
const { index, from } = payload;
const res = await requestServer("put", `/api/article/favorite/${index}`, {
const { id, from } = payload;
const res = await requestServer("put", `/api/article/favorite/${id}`, {
from,
});
return res.data;
Expand Down
6 changes: 3 additions & 3 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env.config();

// initializes express app
const app = express();
const server = require('http').createServer(app)
const server = require("http").createServer(app);

// application database connection establishment
const connectDatabase = require("./src/db/connect");
Expand Down Expand Up @@ -74,5 +74,5 @@ server.listen(process.env.APP_PORT, () => {
);
});

const socketApp = require('./socketApp');
socketApp.socketServer(server)
// const socketApp = require('./socketApp');
// socketApp.socketServer(server)
Loading

0 comments on commit 5a99dbc

Please sign in to comment.