Skip to content

Commit 1290caa

Browse files
committed
update package and refactoring react quill
1 parent e1826b5 commit 1290caa

14 files changed

Lines changed: 79 additions & 171 deletions

File tree

src/App.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import Routers from "./layouts/map/Routers.jsx";
1717
import { LanguageProvider } from "./services/reducers/LanguageContext.jsx";
1818
import { LoaderProvider } from "./services/reducers/LoaderProvider.jsx";
1919
import RotateDevice from "./components/RotateDevice";
20-
import Error410Modal from "./components/Error410Modal";
2120
import { useAppHeight } from "./hooks/useAppHeight.js";
2221
import { ScrollDirectionProvider } from "./services/reducers/ScrollDirectionContext.jsx";
2322
function App() {
@@ -54,7 +53,6 @@ function App() {
5453
<RotateDevice />
5554
<Routers />
5655

57-
<Error410Modal />
5856
<Toaster
5957
containerStyle={{
6058
zIndex: 100000,

src/components/Error410Modal/index.jsx

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/layouts/map/3dModelMap/SatisfactionLunch.jsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
WalletContextTypes,
1212
} from "../../../services/reducers/WalletContext";
1313
import useRequest from "../../../services/Hooks/useRequest";
14-
import { getItem } from "../../../services/Utility/LocalStorage";
1514

1615
import {
1716
getFieldTranslationByNames,
@@ -34,10 +33,8 @@ const SatisfactionLunch = ({
3433
handleExitClick,
3534
handelSubmitEnvironment,
3635
}) => {
37-
const accountSecurity = getItem("account_security")?.account_security;
38-
3936
const { selectedEnvironment, formState } = useSelectedEnvironment();
40-
const { Request, HTTP_METHOD } = useRequest();
37+
const { Request, HTTP_METHOD, checkSecurity } = useRequest();
4138
const [Wallet, dispatch] = useContext(WalletContext);
4239
const initialSatisfaction =
4340
Wallet && Wallet.satisfaction ? parseFloat(Wallet.satisfaction) : 0;
@@ -100,18 +97,15 @@ const SatisfactionLunch = ({
10097
};
10198

10299
const handleSubmit = () => {
103-
if (!accountSecurity) {
104-
ToastError(getFieldTranslationByNames("1603"));
105-
return;
106-
}
100+
if (!checkSecurity()) return;
107101

108102
Request(
109103
`features/${formState.featureId}/build/${selectedEnvironment.id}`,
110104
HTTP_METHOD.POST,
111-
formData
105+
formData,
112106
)
113107
.then((res) => {
114-
addBuilding(res.data.data.building_models[0])
108+
addBuilding(res.data.data.building_models[0]);
115109
handelSubmitEnvironment();
116110
ToastSuccess(getFieldTranslationByNames("1606"));
117111
dispatch({

src/layouts/menu/BtnAction/BtnLogin.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const BtnLogin = () => {
3939
HTTP_METHOD.GET,
4040
{},
4141
{},
42-
"development"
42+
"development",
4343
)
4444
.then((response) => {
4545
if (response && response.data.url) {

src/layouts/statusBar/ListPositions.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const ListPositions = () => {
192192
imgSrc={mataphoto}
193193
name={getFieldTranslationByNames("1591")}
194194
lang={i18n.language}
195-
href="https://3ddevelop.irpsc.com/linked-world"
195+
href="https://3ddevelop.irpsc.com"
196196
onlineUser={"20"}
197197
/>
198198
</React.Fragment>

src/pages/Feature/Tabs/BuyFromSystem/SellerPriceInfo.jsx

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import styled from "styled-components";
22
import { useContext, useState } from "react";
33
import { useNavigate } from "react-router-dom";
4-
import { getItem } from "../../../../services/Utility/LocalStorage/index";
54
import {
65
WalletContext,
76
WalletContextTypes,
@@ -30,21 +29,20 @@ const InputsWrapper = styled.div`
3029
`;
3130

3231
const SellerPriceInfo = () => {
33-
const accountSecurity = getItem("account_security")?.account_security;
3432
const [wallet, dispatch] = useContext(WalletContext);
3533
const [feature] = useContext(FeatureContext);
3634
const Navigate = useNavigate();
37-
const { Request, HTTP_METHOD } = useRequest();
35+
const { Request, HTTP_METHOD, checkSecurity } = useRequest();
3836

3937
const onSubmit = () => {
4038
const colorKey =
4139
feature.properties.karbari === "m"
4240
? "yellow"
4341
: feature.properties.karbari === "t"
44-
? "red"
45-
: feature.properties.karbari === "a"
46-
? "blue"
47-
: null;
42+
? "red"
43+
: feature.properties.karbari === "a"
44+
? "blue"
45+
: null;
4846

4947
const walletRaw = wallet[colorKey] || "0";
5048
const featurePrice = feature.properties.stability || "0";
@@ -53,18 +51,15 @@ const SellerPriceInfo = () => {
5351
colorKey === "yellow"
5452
? getFieldTranslationByNames("1599")
5553
: colorKey === "red"
56-
? getFieldTranslationByNames("1600")
57-
: colorKey === "blue"
58-
? getFieldTranslationByNames("1601")
59-
: "نامشخص";
54+
? getFieldTranslationByNames("1600")
55+
: colorKey === "blue"
56+
? getFieldTranslationByNames("1601")
57+
: "نامشخص";
6058

6159
ToastError(colorName);
6260
return;
6361
}
64-
if (!accountSecurity) {
65-
ToastError(getFieldTranslationByNames("1603"));
66-
return;
67-
}
62+
if (!checkSecurity()) return;
6863
Request(`features/buy/${feature.id}`, HTTP_METHOD.POST)
6964
.then((response) => {
7065
const newAmount = walletRaw - featurePrice;

src/pages/Feature/Tabs/price-tab/buyer-tab/SellerPriceInfo.jsx

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Rial from "../../../../../components/Rial";
22
import Psc from "../../../../../components/Psc";
33
import Input from "../../../../../components/Input";
4-
import { getItem } from "../../../../../services/Utility/LocalStorage";
54

65
import styled from "styled-components";
76
import { useContext, useState } from "react";
@@ -18,7 +17,6 @@ import {
1817
import {
1918
calculateFee,
2019
getFieldTranslationByNames,
21-
persianNumbers,
2220
ToastError,
2321
formatNumber,
2422
} from "../../../../../services/Utility";
@@ -48,15 +46,13 @@ const ResultWrapper = styled.div`
4846
`;
4947

5048
const SellerPriceInfo = () => {
51-
const accountSecurity = getItem("account_security")?.account_security;
52-
5349
const [feature] = useContext(FeatureContext);
5450
const [wallet, dispatch] = useContext(WalletContext);
5551
const [rial, setRial] = useState(feature.properties.price_irr);
5652
const [psc, setPsc] = useState(feature.properties.price_psc);
5753
const Navigate = useNavigate();
58-
const { Request, HTTP_METHOD } = useRequest();
59-
54+
const { Request, HTTP_METHOD, checkSecurity } = useRequest();
55+
6056
const onSubmit = () => {
6157
try {
6258
const walletPscRaw = wallet?.psc || 0;
@@ -73,10 +69,8 @@ const SellerPriceInfo = () => {
7369
ToastError(getFieldTranslationByNames("1604"));
7470
return;
7571
}
76-
if (!accountSecurity) {
77-
ToastError(getFieldTranslationByNames("1603"));
78-
return;
79-
}
72+
if (!checkSecurity()) return;
73+
8074
Request(`features/buy/${feature?.id}`, HTTP_METHOD.POST)
8175
.then((response) => {
8276
dispatch({
@@ -107,7 +101,7 @@ const SellerPriceInfo = () => {
107101
onchange={(e) => setRial(e.target.value)}
108102
type="number"
109103
placeholder={`${getFieldTranslationByNames(
110-
"521"
104+
"521",
111105
)} (${getFieldTranslationByNames("48")})`}
112106
insideText={<Rial />}
113107
disabled
@@ -117,7 +111,7 @@ const SellerPriceInfo = () => {
117111
onchange={(e) => setPsc(e.target.value)}
118112
type="number"
119113
placeholder={`${getFieldTranslationByNames(
120-
"521"
114+
"521",
121115
)} (${getFieldTranslationByNames("47")})`}
122116
insideText={<Psc />}
123117
disabled
@@ -127,7 +121,7 @@ const SellerPriceInfo = () => {
127121
<TitleValue
128122
title={getFieldTranslationByNames("522")}
129123
value={`${calculateFee(rial, 5)} ${getFieldTranslationByNames(
130-
"48"
124+
"48",
131125
)} / ${calculateFee(psc, 5)} ${getFieldTranslationByNames("47")}`}
132126
/>
133127
<TitleValue title={getFieldTranslationByNames("523")} value="5%" />

src/pages/Feature/Tabs/price-tab/buyer-tab/SuggestPrice.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ const SuggestPrice = () => {
3737
const [feature] = useContext(FeatureContext);
3838
const { Request, HTTP_METHOD, checkSecurity } = useRequest();
3939

40-
4140
const totalIrr = useMemo(() => {
4241
if (!feature?.properties) return 0;
4342

src/pages/Feature/Tabs/price-tab/seller-tab/FillInputs.jsx

Lines changed: 11 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -93,72 +93,19 @@ const FillInputs = ({
9393
rial,
9494
setRial,
9595
psc,
96-
setPsc,rialToPsc
96+
setPsc,
9797
}) => {
98-
const [user] = useContext(UserContext);
9998
const [feature] = useContext(FeatureContext);
10099
const [errors, setErrors] = useState({ rial: "", psc: "" });
101100
const cancel =
102101
+feature?.properties?.price_irr !== 0 ||
103102
+feature?.properties?.price_psc !== 0;
104-
const priceHandler = () => {
105-
let isValid = true;
106-
107-
const hasBirthdate = !!user?.birthdate;
108-
// ⛔ اگر احراز هویت نشده، ریال ممنوع
109-
if (!hasBirthdate && rial > 0) {
110-
ToastError("برای افراد احراز هویت نشده فقط تعریف قیمت با ارز PSC ممکن است.");
111-
return;
112-
}
113-
114-
const userAge = hasBirthdate ? TimeAgo(user.birthdate) : null;
115103

116-
// محاسبه حداقل‌ها
117-
const minPriceIRR = hasBirthdate
118-
? userAge >= 18
119-
? calculateFee(feature.properties.price_irr, 80)
120-
: calculateFee(feature.properties.price_irr, 110)
121-
: 0; // چون ریال مجاز نیست
122-
123-
// جمع psc با rialToPsc فقط وقتی birthdate نال است
124-
const effectivePsc = !hasBirthdate ? +psc + +rialToPsc : +psc;
125-
126-
const minPricePSC = hasBirthdate
127-
? userAge >= 18
128-
? calculateFee(feature.properties.price_psc, 80)
129-
: calculateFee(feature.properties.price_psc, 100)
130-
: calculateFee(feature.properties.price_psc, 100); // حالت بدون احراز
131-
132-
// چک ریال فقط اگر تاریخ تولد موجود باشد
133-
if (hasBirthdate && rial < minPriceIRR) {
134-
setErrors((prev) => ({
135-
...prev,
136-
rial: `حداقل ارزش معامله ${minPriceIRR} ریال می‌باشد`,
137-
}));
138-
isValid = false;
139-
}
140-
141-
if (effectivePsc < minPricePSC) {
142-
setErrors((prev) => ({
143-
...prev,
144-
psc: `حداقل ارزش معامله ${minPricePSC} PSC می‌باشد`,
145-
}));
146-
isValid = false;
147-
}
148-
149-
if (isValid) {
150-
validateAndSubmit(true);
151-
} else {
152-
ToastError("لطفاً خطاها را اصلاح کنید");
153-
}
154-
};
155-
156-
157104
return (
158105
<Div>
159106
<InputsWrapper>
160107
<Input
161-
value={rial||0}
108+
value={rial || 0}
162109
maxLength={14}
163110
onChange={(e) => setRial(e.target.value)}
164111
type="number"
@@ -193,15 +140,16 @@ const FillInputs = ({
193140
{" "}
194141
<Button
195142
label={getFieldTranslationByNames("519")}
196-
onclick={priceHandler}
143+
onclick={validateAndSubmit}
197144
/>
198-
{cancel && <Button
199-
color="red"
200-
edit
201-
label={getFieldTranslationByNames("833")}
202-
onclick={() => setAssign(true)}
203-
/>}
204-
145+
{cancel && (
146+
<Button
147+
color="red"
148+
edit
149+
label={getFieldTranslationByNames("833")}
150+
onclick={() => setAssign(true)}
151+
/>
152+
)}
205153
</ButtonBox>
206154
</Div>
207155
);

src/pages/Feature/Tabs/price-tab/seller-tab/Lowest.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const Lowest = () => {
7272
const [user] = useContext(UserContext);
7373
const [feature, setFeature] = useContext(FeatureContext);
7474
const { Request, HTTP_METHOD, checkSecurity } = useRequest();
75+
7576
const [assign, setAssign] = useState(
7677
+feature?.properties?.price_irr !== 0 ||
7778
+feature?.properties?.price_psc !== 0,
@@ -84,9 +85,7 @@ const Lowest = () => {
8485
const onSubmit = () => {
8586
if (user.birthdate == null) {
8687
if (percentage < 110) {
87-
return ToastError(
88-
getFieldTranslationByNames(1647),
89-
);
88+
return ToastError(getFieldTranslationByNames(1647));
9089
}
9190
}
9291

@@ -107,6 +106,7 @@ const Lowest = () => {
107106
{ minimum_price_percentage: percentage },
108107
)
109108
.then((res) => {
109+
//console.log(res);
110110
setFeature((feature) => ({
111111
...feature,
112112
properties: {

0 commit comments

Comments
 (0)