Skip to content

Commit

Permalink
Merge pull request #146 from Katyusha-Group/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
er-ebrahimi authored Jan 28, 2024
2 parents e1d733d + 7f06cf8 commit 3fd128c
Show file tree
Hide file tree
Showing 73 changed files with 628 additions and 753 deletions.
11 changes: 7 additions & 4 deletions src/Functions/Chat/getChat.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import axios from "axios";
import { apis } from "../../assets/apis";
export function getChat(setValue, username, setLoading) {
export async function getChat(setValue, username, setLoading, setInfo) {
console.log("🚀 ~ getChat ~ username:", username)
const token = JSON.parse(localStorage.getItem("authTokens")).token.access;
axios(apis["chat"]["chatWith"]+username+"/", {
await axios(apis["chat"]["chatWith"]+username+"/", {
headers: { Authorization: `Bearer ${token}` },
})
.then((data) => {
console.log("🚀 ~ file: getChat.jsx:9 ~ .then ~ data:", data.data.messages)
setValue((x) => {
let val = data.data.messages.map((item,index) => {
return { id: item.author, messageId: index, text: item.content };
});
return [...x, ...val];
return [...val.reverse()];
});
setLoading(false)
setInfo({id:data.data.id, participants:data.data.participants})
return data.data
})
.catch((error) => console.error(error));
}
8 changes: 1 addition & 7 deletions src/Functions/Shopping/getCartInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { apis } from "../../assets/apis";
import {
showLoading,
closeLoading,
} from "../../components/LoadingAlert/LoadingAlert";


export function getCartInfo(setState, setTotalPrice, setAmount,setLoading) {
const token = JSON.parse(localStorage.getItem("authTokens")).token.access;
showLoading();
const shopId = JSON.parse(localStorage.getItem("shopId"));
fetch(apis["carts"], {
headers: { Authorization: `Bearer ${token}` },
Expand All @@ -16,9 +12,7 @@ export function getCartInfo(setState, setTotalPrice, setAmount,setLoading) {
setState(data.items);
setTotalPrice(data.total_price);
setAmount(data.total_number);
closeLoading();
setLoading(false);
})
.catch((error) => console.error(error));
closeLoading();
}
2 changes: 0 additions & 2 deletions src/Functions/Shopping/saveWallet.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@

import axios from "axios";
import { apis } from "../../assets/apis";
import { closeLoading } from "../../components/LoadingAlert/LoadingAlert";
export function saveWallet(setWallet) {
const token = JSON.parse(localStorage.getItem("authTokens")).token.access;
axios(apis["accounts"]["wallet"]["seeWallet"], {
headers: { Authorization: `Bearer ${token}` },
})
.then((data) => {
setWallet(data.balance);
closeLoading();
})
.catch((error) => console.error(error));
}
4 changes: 0 additions & 4 deletions src/Functions/Timeline/getReplies.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { apis } from "../../assets/apis";
import axios from "axios"
import { showLoading, closeLoading } from "../../components/LoadingAlert/LoadingAlert";
export const getReplies = (setData, setLoading, link) => {
const token = JSON.parse(localStorage.getItem("authTokens")).token.access;
showLoading();
let config = {
method: "get",
maxBodyLength: Infinity,
Expand All @@ -18,8 +16,6 @@ export const getReplies = (setData, setLoading, link) => {
.then((response) => {
setLoading(false);
setData(response.data);
console.log("🚀 ~ file: getReplies.jsx:21 ~ .then ~ response.data:", response.data)
closeLoading();
})
.catch();
};
2 changes: 0 additions & 2 deletions src/Functions/Userpage/apiForModalData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { apis } from "../../assets/apis";
export function apiForModalData(
x,
showOrNot,
showLoading,
setModalData,
setShowLesson
) {
const tokenJson = localStorage.getItem("authTokens");
const tokenClass = JSON.parse(tokenJson);
const token = tokenClass.token.access;
showLoading();
fetch(apis["courses"]["id"] + x, {
method: "GET",
headers: {
Expand Down
13 changes: 7 additions & 6 deletions src/assets/css/Search/Searchmain.module.css
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
.bg{
background-color: #27293d;
width: 70vw;
height: 90vh;
margin-top: 5vh;
margin-right: 20px;
border-radius: 15px;
height: 90vh;
margin-bottom: 20px;
/* overflow-y: auto; */
/* overflow-x: hidden; */
padding-top: 15px;
overflow-y: auto;
overflow-x: hidden;

}
.Responce{
width: 65vw;
display: flex;
flex-direction: column;
margin-right: 5vw;
margin-bottom: 1vw;
height: 80vh;
margin-top: 3vw;
height: 74vh;
overflow-y: auto;

}
Expand Down
6 changes: 3 additions & 3 deletions src/assets/css/SearchResponce.module.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@import "./black-dashboard-react.css";

.main{
width: 50vw;
width: 60vw;
height: auto;
margin-right: 1.5vw;
margin-right: 0vw;
margin-left: 1.5vw;
border-radius: 5px;
border-radius: 15px;
display: flex;
flex-direction: row;
align-items: center;
Expand Down
5 changes: 5 additions & 0 deletions src/assets/css/Searchbar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
.searchBox{
height: inherit;
overflow: auto;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
}

@media only screen and (max-width: 1100px) {
Expand Down
9 changes: 5 additions & 4 deletions src/assets/css/Timeline/Timeline.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
.tweetsContainer{
display: flex;
flex-direction: column;
max-height: 74vh;
/* max-height: 74vh; */
overflow-y: hidden;
overflow: auto;
overflow-x: hidden;
max-height: 66vh;
/* max-height: 66vh; */
}
.activeTab {
width: 300px;
height: 40px;
border: none;
margin: 30px 20px;
margin: 30px 20px 0 20px;
border-bottom: 3px solid var(--purple) ;
background-color: initial;
color: white;
Expand All @@ -39,7 +39,7 @@
border: none;
background-color: initial;
color: white;
margin: 30px 20px;
margin: 30px 20px 0 20px;
}

.content{
Expand Down Expand Up @@ -70,6 +70,7 @@
.tab{
width: 30vw;
margin: 3vh 5vw;
margin-bottom: 0;

}
}
Expand Down
5 changes: 4 additions & 1 deletion src/assets/css/Timeline/Tweet.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
margin-right: 10px;
margin-left: 10px;
border: 2px solid #32325d;
display: flex;
justify-content: center;
align-items: center;
}
.avatarimg{
width: 50px;
padding: 2px;
height: 50px;
border-radius: 50%;
object-fit: cover;
}
Expand Down
3 changes: 0 additions & 3 deletions src/assets/css/UserPage.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ div {
border-width: 0.1875rem;
border-color: "red";
}
/* TODO */
.color {
width: 23%;
height: 5rem;
Expand Down Expand Up @@ -210,8 +209,6 @@ p {
justify-content: right;
padding-right: 5px;
}

/* TODO fix chart */
.cart {
width: 25px;
height: 25px;
Expand Down
31 changes: 26 additions & 5 deletions src/assets/css/UserSearchResponce.module.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
@import "./black-dashboard-react.css";

.container{
height: auto;
margin-right: 0;
margin-left: 0;
border-radius: 5px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
flex-grow: 1;
padding: 0;
}

.container:hover{
background-color: var(--box);
}
.main{
width: 85%;
height: auto;
margin-right: 1.5vw;
margin-left: 1.5vw;
border-radius: 5px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;

flex-grow: 1;
}
.main2{
display: flex;
Expand All @@ -36,10 +50,17 @@
margin-right: 0.3vw;
margin-top: 8px;
font-size: 0.7vw;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1; /* This will display the ellipsis after two lines */
-webkit-box-orient: vertical;
}
.chat{
padding: 0.5rem;
border-radius: 5rem;
}
.chat:hover{
/* background:"red"; */
}
background-color: var(--purple);
}

27 changes: 14 additions & 13 deletions src/assets/css/admin/Admin.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
flex-direction: row;
justify-content: start;
margin: 0;
/* overflow-y: scroll; */
width: 100vw;
}

Expand All @@ -16,11 +15,7 @@
margin: 5vh;
display: flex;
flex-direction: column;
/* justify-content: space-between; */
max-width: 90%;
/* margin-left: auto;
margin-right: auto; */
/* margin-left: 10px; */
}

.adminRow {
Expand All @@ -31,21 +26,22 @@
.adminBox{
height: 43vh;
display: flex;
/* justify-content: space-evenly; */
flex-grow: 1;
border-radius: 15px;
margin: 10px;
/* width: 90%; */
}

.adminChart{
height: 43vh;
display: flex;
justify-content: center;
flex-grow: 1;
margin: 10px;
margin: 0 10px 20px 10px;
padding: 10px;
border-radius: 15px;
}

@media only screen and (max-width: 541px) {
@media only screen and (max-width: 620px) {
.ParentContain {
display: flex;
max-height: 100vh;
Expand All @@ -64,13 +60,18 @@
}
.adminRow {
flex-direction: column;
width: 90%;
width: 100%;
}
.admin {
margin-top: 0;
margin-left: 0;
margin: 10px auto;
width: 80vw;
}
.adminChart{
margin: 0 0 20px 0;
}
.adminBox{
margin: 0 0 20px 0;
}
/* .admin {
overflow: scroll;
} */
}
2 changes: 1 addition & 1 deletion src/assets/css/chat/Chat.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
.chatBox {
background-color: var(--purple);
max-width: 100px;
width: min-content;
width: fit-content;
padding: 10px;
text-align: right;
}
Expand Down
13 changes: 7 additions & 6 deletions src/assets/css/sidebar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,15 @@
height: inherit;
justify-content: space-between;
z-index: 1;
padding: 0 20px;
}

.sidebarmenuItems {
display: flex;
align-items: center;
/* padding: 0 10px; */
min-height: 40px;
text-align: center;
}

.sidebarmenuItems {
Expand All @@ -164,9 +169,6 @@
display: none;
}

.moreInfo {
display: block;
}
.items{
flex-direction: row;
width: 75%;
Expand All @@ -182,6 +184,5 @@
@media only screen and (min-width: 620px) {
.moreInfo {
display: none;
}

}
}
}
Loading

0 comments on commit 3fd128c

Please sign in to comment.