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

fix(docker-compose): fix nginx confige #147

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ FROM nginx:1.24.0
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=builder /app/dist .
COPY nginx.conf /etc/nginx/nginx.conf
ENTRYPOINT ["nginx", "-g", "daemon off;"]
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ services:
build:
context: .
ports:
- 8081:80
- 8081:80
# volumes:
# - ./nginx.conf:/etc/nginx/conf.d/default.conf

39 changes: 39 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

# include /etc/nginx/conf.d/*.conf;
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}
}
5 changes: 0 additions & 5 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import "./assets/demo/demo.css";
import "./assets/css/nucleo-icons.css";
import "@fortawesome/fontawesome-free/css/all.min.css";
import ContextInfo from "./contexts/InfoContext.jsx";
// import LandingPage from "./views/LandingPage.jsx";
import CoursesPanel from "./views/CoursesPanel/CoursesPanel.jsx";
import Shopping from "./views/Shopping/Shopping.jsx";
import Verification from "./views/Verification/Verification.jsx";
Expand Down Expand Up @@ -100,10 +99,6 @@ function App() {
path="/aboutUs"
element={<AboutUs />}
></Router.Route>
{/* <Router.Route
path="/landingPage"
element={<LandingPage />}
></Router.Route> */}
<Router.Route
path="/replies/:id"
element={<Replies></Replies>}
Expand Down
17 changes: 10 additions & 7 deletions src/assets/css/Profile.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
display: flex;
flex-direction: row;
/* align-items: center; */
justify-content: space-between;
justify-content: center;
width: 100%;
/* background-color: #1e1e1e; */
/* background-color: var(--dark); */
Expand All @@ -22,9 +22,8 @@
justify-content: space-between;
gap: 30px;
border-radius: 10px;

height: 93vh;
margin-top: 20px;
height: 90vh;
margin-top: 5vh;
margin-left: 30px;
margin-right: 30px;
}
Expand Down Expand Up @@ -60,8 +59,8 @@

.rightpart {
width: 900px;
height: 100%;
margin-top: 20px;
height: 90vh;
margin-top: 5vh;
margin-bottom: 10px;
padding: 10px;
border-radius: 15px;
Expand Down Expand Up @@ -224,15 +223,19 @@
.leftpart {
display: none;
}
.rightpart {
margin-left: 5vh;
}
}

@media only screen and (max-width: 541px) {
@media only screen and (max-width: 620px) {
.main {
flex-direction: column-reverse;
}

.rightpart {
max-width: 90vw;
max-height: 80vh;
/* margin: 2.5vw; */
}
}
2 changes: 1 addition & 1 deletion src/assets/css/Timeline/Timeline_Profile.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* justify-content: space-between; */
width: 100%;
/* margin-right: 4vw; */
height: 90vh;
height: 100%;
border-radius: 15px;
position: sticky;
}
Expand Down
74 changes: 61 additions & 13 deletions src/components/Navbars/AdminNavbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from "react";
import routes from "../../route.jsx";
import * as style from "../Navbars/AdminNavbar.module.css";
import { useNavigate, useLocation } from "react-router-dom";

import { userUserName } from "../../hooks/useUserName.jsx";
// reactstrap components
import {
Collapse,
Expand All @@ -16,6 +16,11 @@ import {
function AdminNavbar() {
const [isOpen, setIsOpen] = useState(false);
const toggle = () => setIsOpen(!isOpen);
const routes_FirstPart = routes.slice(0, 5);
const routes_SecondPart = routes.slice(6);
// console.log("First Part: ", routes_FirstPart);
// console.log("Second Part: ", routes_SecondPart);
const {profile, setProfile, loading} = userUserName();
return (
<div>
<Navbar
Expand All @@ -29,20 +34,42 @@ function AdminNavbar() {
<span className="navbar-toggler-bar bar3" />
</NavbarToggler>
<Nav className={`${style.AdminNavbar_WithoutCollapse} ml-auto`} navbar>
{
routes.map((route) =>
(
<NavItem key={route.rtlName}>
<NavLink href={route.layout + route.path}>
<i className={"tim-icons " + route.icon} />
{" "}
{route.rtlName}
</NavLink>
</NavItem>
))}
{
routes_FirstPart.map((route) =>
(
<NavItem key={route.rtlName}>
<NavLink href={route.layout + route.path}>
<i className={"tim-icons " + route.icon} />
{" "}
{route.rtlName}
</NavLink>
</NavItem>
))}
<NavItem className={style.logoutLink}>
<NavLink href={`/profile/${profile}`}
onClick={() => {
}}
>
<i className={"tim-icons icon-single-02"} />
{" "}
{"پروفایل"}
</NavLink>
</NavItem>
{
routes_SecondPart.map((route) =>
(
<NavItem key={route.rtlName}>
<NavLink href={route.layout + route.path}>
<i className={"tim-icons " + route.icon} />
{" "}
{route.rtlName}
</NavLink>
</NavItem>
))}
<NavItem className={style.logoutLink}>
<NavLink href="/"
onClick={() => {
localStorage.removeItem("authTokens");
}}
>
<i className={"tim-icons icon-button-power"} />
Expand All @@ -54,7 +81,28 @@ function AdminNavbar() {
<Collapse isOpen={isOpen} navbar>
<Nav className="ml-auto" navbar>
{
routes.map((route) =>
routes_FirstPart.map((route) =>
(
<NavItem key={route.rtlName}>
<NavLink href={route.layout + route.path}>
<i className={"tim-icons " + route.icon} />
{" "}
{route.rtlName}
</NavLink>
</NavItem>
))}
<NavItem className={style.logoutLink}>
<NavLink href={`/profile/${profile}`}
onClick={() => {
}}
>
<i className={"tim-icons icon-single-02"} />
{" "}
{"پروفایل"}
</NavLink>
</NavItem>
{
routes_SecondPart.map((route) =>
(
<NavItem key={route.rtlName}>
<NavLink href={route.layout + route.path}>
Expand Down
18 changes: 0 additions & 18 deletions src/components/ui/PopUp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,6 @@ export default function PopUp({ children, className, style, ...props }) {
سفارش ها
</li>
</a>
<a href={`http://${hostname}/search`}>
<li className={styles.popUpItem}>
<span
className="tim-icons icon-zoom-split

"
/>
{" "}
جست جو{" "}
</li>
</a>
<a href={`http://${hostname}/profile/${props.profile.username}`}>
<li className={styles.popUpItem}>
<span className="tim-icons icon-badge" />
{" "}
پروفایل
</li>
</a>
<a href={`http://${hostname}/aboutUs`}>
<li className={styles.popUpItem}>
<span className="tim-icons icon-send" />
Expand Down
8 changes: 7 additions & 1 deletion src/hooks/useUserName.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ export const userUserName = () => {
);
const data = await profileResponse.json();
changeInfo("userName", data.username);
setProfile(data.username)
setLoading(false)
} catch (error) {
console.error(error);
}
};
if(info.userName !== ""){
if(info.userName === ""){
fetchData();
}
else{
setProfile(info.userName)
setLoading(false)
}
}, []);
return { profile, setProfile, loading };

Expand Down
2 changes: 1 addition & 1 deletion src/views/Landing/mainpart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useNavigate } from "react-router-dom";

const Mainpart = () => {
const navigate =useNavigate()

return (
<div className={styles.bg}>
<div className={styles.main}>
Expand All @@ -28,6 +27,7 @@ const Mainpart = () => {
<div className={styles.callUs}>
<p>پیشنهادات و انتقادات : </p>
<p className={styles.email}> [email protected]</p>
<p className={styles.email}> v0.0</p>
</div>
</div>
</div>
Expand Down
7 changes: 4 additions & 3 deletions src/views/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,13 @@ ${styles.icon}`}
<div
className={`${styles.sidebarmenuItems} ${styles.sidebarmenuItemsMobileBlock}`}
onClick={(e) => {
localStorage.removeItem("authTokens");
e.preventDefault();
Navigate("/order");
Navigate("/");
}}
>
<i className={`tim-icons icon-single-copy-04 ${styles.icon}`}></i>
<p className={styles.itemtext}> سفارش ها</p>
<i className={`tim-icons icon-button-power ${styles.icon}`}></i>
<p className={styles.itemtext}> خروج</p>
</div>
{loading ? (
<Spinner animation="border" variant="primary" className={`backCol ${styles.moreInfo}`} style={{margin:"13px 10px"}}/>
Expand Down
4 changes: 1 addition & 3 deletions src/views/UserPorfile/IsThisMe_Function.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from "react";
import { usesProfileMe } from "../../hooks/useProfileMe";
import { GETProfileData } from "../../hooks/GETProfileData.jsx";
import { userUserName } from "../../hooks/useUserName.jsx";

export default function IsThisMe_Function (id)
{
const {profile, setProfile, loading} = userUserName();
let IsThisMe = false;
if (profile != null) {
IsThisMe = (profile.username == id);
IsThisMe = (profile == id);
}
return IsThisMe;
}
Loading