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

re-merge ENV based backend URL #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions .gitignore
@@ -1,5 +1,5 @@
*.env
*.log

node_modules
/.idea
node_modules/
.idea/
build/
*.log
1 change: 1 addition & 0 deletions sample.env
@@ -0,0 +1 @@
REACT_APP_BACKEND_URL=
65 changes: 26 additions & 39 deletions src/Pages/AdminArticlePage/AdminArticlePage.jsx
Expand Up @@ -8,7 +8,7 @@ import { useGlobalContext } from "../../Context/StateContext";

const AcceptModal = ({ setShowAccept, article, community, handleModified }) => {
const [loading, setLoading] = useState(false);
const { token, user } = useGlobalContext();
const {token, user} = useGlobalContext();

const handleAccept = async () => {
setLoading(true);
Expand All @@ -20,9 +20,9 @@ const AcceptModal = ({ setShowAccept, article, community, handleModified }) => {
},
};
const res = await axios.post(
`/api/article/${article}/approve_for_review/`,
{ community: community },
config
`/api/article/${article}/approve_for_review/`,
{community: community},
config
);
await handleModified(article);
if (res.status === 200) {
Expand All @@ -37,46 +37,33 @@ const AcceptModal = ({ setShowAccept, article, community, handleModified }) => {
} catch (error) {
console.log(error);
}
setLoading(false);
setShowAccept(false);
};
}

return (
<>
<div className="w-full h-full fixed block top-0 left-0 bg-gray-900 bg-opacity-50 z-50">
<div className="w-full h-full flex flex-col items-center justify-center">
<div className="w-5/6 md:w-1/2 bg-white p-5 rounded-lg flex flex-col items-center justify-center">
<h1 className="text-md md:text-xl font-bold text-gray-600 mb-4">
Are you sure you want to accept this paper for reviewal process?
</h1>
<div className="w-full flex flex-row items-center justify-center">
<button
className="text-sm font-semibold text-white p-2 px-5 mr-5 rounded-lg bg-green-600 flex"
style={{ cursor: "pointer" }}
onClick={handleAccept}
>
{loading ? "loading..." : "Yes"}
</button>
<button
className="text-sm font-semibold text-white p-2 px-5 rounded-lg bg-red-600 flex ml-2"
style={{ cursor: "pointer" }}
onClick={() => {
setShowAccept(false);
}}
>
No
</button>
<>
<div className="w-full h-full fixed block top-0 left-0 bg-gray-900 bg-opacity-50 z-50">
<div className="w-full h-full flex flex-col items-center justify-center">
<div className="w-5/6 md:w-1/2 bg-white p-5 rounded-lg flex flex-col items-center justify-center">
<h1 className="text-md md:text-xl font-bold text-gray-600 mb-4">Are you sure you want to accept this
paper for reviewal process?</h1>
<div className="w-full flex flex-row items-center justify-center">
<button className="text-sm font-semibold text-white p-2 px-5 mr-5 rounded-lg bg-green-600 flex"
style={{cursor: "pointer"}} onClick={handleAccept}>{loading ? "loading..." : "Yes"}</button>
<button className="text-sm font-semibold text-white p-2 px-5 rounded-lg bg-red-600 flex ml-2"
style={{cursor: "pointer"}} onClick={() => {setShowAccept(false)}}>No
</button>
</div>
</div>
</div>
</div>
</div>
</>
);
};
</>
)
}

const RejectModal = ({ setShowReject, article, community, handleReject }) => {
const [loading, setLoading] = useState(false);
const { token } = useGlobalContext();
const RejectModal = ({setShowReject,article,community, handleReject}) => {

const [loading, setLoading] = useState(false);
const {token} = useGlobalContext();

const handleDelete = async () => {
setLoading(true);
Expand Down Expand Up @@ -282,6 +269,7 @@ const PublishModal = ({ setShowPublish, article, community }) => {
};

const AdminArticlePage = ({ community }) => {

const [searchTerm, setSearchTerm] = useState("");
const [articles, setArticles] = useState([]);
const [loading, setLoading] = useState(false);
Expand Down Expand Up @@ -554,5 +542,4 @@ const AdminArticlePage = ({ community }) => {
</>
);
};

export default AdminArticlePage;