Skip to content

Commit 16c42ee

Browse files
authored
Merge pull request #90 from iranpsc/fix/uiBugs
2 parents 673e772 + a6cc280 commit 16c42ee

68 files changed

Lines changed: 2678 additions & 2682 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
node_modules
2+
npm-debug.log*
3+
dist
4+
build
5+
.next
6+
out
7+
*.tsbuildinfo
8+
9+
.git
10+
.vscode
11+
.vs
12+
13+
.env*
14+
15+
logs
16+
*.log
17+
tmp
18+
temp
19+
.cache

dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:20 AS builder
2+
3+
WORKDIR /app
4+
5+
COPY package*.json ./
6+
7+
RUN npm install
8+
9+
COPY . .
10+
11+
RUN npm run build
12+
13+
14+
FROM nginx:alpine
15+
16+
COPY --from=builder /app/dist /usr/share/nginx/html
17+
18+
EXPOSE 3000
19+
20+
CMD ["nginx", "-g", "daemon off;"]

package-lock.json

Lines changed: 1979 additions & 1928 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"react-leaflet": "^4.2.0",
7070
"react-map-gl": "^7.1.6",
7171
"react-multi-date-picker": "^3.3.4",
72-
"react-quill": "^2.0.0",
72+
"react-quill-new": "^3.8.3",
7373
"react-rnd": "^10.4.12",
7474
"react-router-dom": "^6.6.1",
7575
"react-share-kit": "^1.1.0",

src/App.css

Lines changed: 66 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,86 @@
11
@font-face {
2-
font-family: 'AzarMehr';
3-
src: url('/fonts/AzarMehr-DS2-Thin.woff2') format('woff2');
2+
font-family: "AzarMehr";
3+
src: url("/fonts/AzarMehr-DS2-Thin.woff2") format("woff2");
44
font-weight: 100;
55
font-style: normal;
66
}
77

88
@font-face {
9-
font-family: 'AzarMehr';
10-
src: url('/fonts/AzarMehr-DS2-Light.woff2') format('woff2');
9+
font-family: "AzarMehr";
10+
src: url("/fonts/AzarMehr-DS2-Light.woff2") format("woff2");
1111
font-weight: 300;
1212
font-style: normal;
1313
}
1414

1515
@font-face {
16-
font-family: 'AzarMehr';
17-
src: url('/fonts/AzarMehr-DS2-Medium.woff2') format('woff2');
18-
font-weight: 400;
19-
font-style: normal;
20-
}
21-
22-
@font-face {
23-
font-family: 'AzarMehr';
24-
src: url('/fonts/AzarMehr-DS2-Medium.woff2') format('woff2');
16+
font-family: "AzarMehr";
17+
src: url("/fonts/AzarMehr-DS2-Medium.woff2") format("woff2");
2518
font-weight: 500;
2619
font-style: normal;
2720
}
2821

2922
@font-face {
30-
font-family: 'AzarMehr';
31-
src: url('/fonts/AzarMehr-DS2-Bold.woff2') format('woff2');
23+
font-family: "AzarMehr";
24+
src: url("/fonts/AzarMehr-DS2-Bold.woff2") format("woff2");
3225
font-weight: 700;
3326
font-style: normal;
3427
}
3528

3629
@font-face {
37-
font-family: 'AzarMehr';
38-
src: url('/fonts/AzarMehr-ExtraBold.woff2') format('woff2');
30+
font-family: "AzarMehr";
31+
src: url("/fonts/AzarMehr-ExtraBold.woff2") format("woff2");
3932
font-weight: 800;
4033
font-style: normal;
4134
}
4235

4336
@font-face {
44-
font-family: 'AzarMehr';
45-
src: url('/fonts/AzarMehr-DS2-Black.woff2') format('woff2');
37+
font-family: "AzarMehr";
38+
src: url("/fonts/AzarMehr-DS2-Black.woff2") format("woff2");
4639
font-weight: 900;
4740
font-style: normal;
4841
}
4942

5043
@font-face {
51-
font-family: 'AzarMehr';
52-
src: url('/fonts/AzarMehr-ExtraBlack.woff2') format('woff2');
53-
font-weight: 950;
54-
font-style: normal;
44+
font-family: "DigitalNumber";
45+
src: url("/fonts/Digital.woff") format("woff");
5546
}
5647

57-
@font-face {
58-
font-family: "DigitalNumber";
59-
src: url('/fonts/Digital.woff') format('woff');
48+
* {
49+
margin: 0;
50+
padding: 0;
51+
box-sizing: border-box;
52+
}
53+
54+
html,
55+
body,
56+
#root {
57+
height: 100%;
58+
margin: 0;
59+
padding: 0;
60+
}
61+
62+
@supports (-webkit-touch-callout: none) {
63+
html,
64+
body,
65+
#root {
66+
height: -webkit-fill-available;
67+
}
6068
}
6169

6270
body {
6371
font-family: "AzarMehr" !important;
6472
overflow: hidden;
65-
transition: all 0.3s ease 0s;
66-
orientation: landscape;
73+
-webkit-font-smoothing: antialiased;
74+
-moz-osx-font-smoothing: grayscale;
75+
text-rendering: optimizeLegibility;
76+
-webkit-text-size-adjust: 100%;
77+
text-size-adjust: 100%;
6778
}
6879

69-
input {
80+
input,
81+
button,
82+
textarea,
83+
select {
7084
font-family: "AzarMehr" !important;
7185
}
7286

@@ -76,20 +90,8 @@ input[type="number"]::-webkit-outer-spin-button {
7690
margin: 0;
7791
}
7892

79-
/* Hide the spinner controls in Firefox */
8093
input[type="number"] {
81-
-moz-appearance: textfield;
82-
}
83-
84-
button {
85-
font-family: "AzarMehr" !important;
86-
}
87-
88-
* {
89-
margin: 0;
90-
padding: 0;
91-
box-sizing: border-box;
92-
font-family: "AzarMehr" !important;
94+
appearance: textfield;
9395
}
9496

9597
p {
@@ -100,12 +102,33 @@ a {
100102
text-decoration: none;
101103
}
102104

105+
/* light mode */
106+
::-webkit-scrollbar {
107+
width: 5px;
108+
}
109+
110+
::-webkit-scrollbar-thumb {
111+
background: #0066ff;
112+
}
113+
114+
/* dark mode */
115+
html.dark ::-webkit-scrollbar-thumb {
116+
background: #ffc700;
117+
}
118+
119+
button {
120+
cursor: pointer;
121+
}
122+
123+
/* مدیا کوئری‌های باقی‌مانده */
103124
.map {
104125
width: 100%;
105126
height: 100%;
106127
border-radius: 10px;
128+
}
107129

108-
@media (min-width: 1024px) {
130+
@media (min-width: 1024px) {
131+
.map {
109132
border-radius: 20px;
110133
}
111134
}
@@ -133,58 +156,9 @@ a {
133156
@keyframes tooltip-horizontal-move {
134157
0% {
135158
opacity: 0;
136-
transition: all 0.3s;
137159
transform: translateX(-50px);
138160
}
139-
140161
100% {
141162
opacity: 1;
142-
transition: all 0.3s;
143163
}
144164
}
145-
146-
147-
/* light mode */
148-
::-webkit-scrollbar {
149-
width: 5px;
150-
}
151-
/*
152-
::-webkit-scrollbar-track {
153-
background: #85858590;
154-
}*/
155-
156-
::-webkit-scrollbar-thumb {
157-
background: #0066FF;
158-
}
159-
160-
161-
/* dark mode */
162-
/*
163-
html.dark ::-webkit-scrollbar-track {
164-
background: #44444490;
165-
}*/
166-
167-
html.dark ::-webkit-scrollbar-thumb {
168-
background: #FFC700;
169-
}
170-
171-
172-
button {
173-
cursor: pointer;
174-
}
175-
176-
html,
177-
body {
178-
-webkit-text-size-adjust: 100%;
179-
}
180-
181-
input,
182-
textarea,
183-
button,
184-
select,
185-
label,
186-
p,
187-
span {
188-
-webkit-text-size-adjust: 100%;
189-
text-size-adjust: 100%;
190-
}

src/App.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ import { useAppHeight } from "./hooks/useAppHeight.js";
2121
import { ScrollDirectionProvider } from "./services/reducers/ScrollDirectionContext.jsx";
2222
function App() {
2323
useAppHeight();
24-
24+
/** */
2525
useLayoutEffect(() => {
2626
window.Echo = new Echo({
2727
broadcaster: "pusher",
2828
key: "local",
2929
cluster: "",
3030
wsHost: "api.metarang.com",
31-
wsPort: 6001,
32-
wssPort: 6001,
3331
encrypted: true,
3432
forceTLS: true,
3533
disableStats: true,

src/components/Common/Container.jsx

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,79 @@
11
import styled from "styled-components";
2-
import { useRef, useEffect, forwardRef } from "react";
3-
import { useScrollDirection } from "../../hooks/useScrollDirection";
2+
import { useRef, useEffect, forwardRef, useCallback } from "react";
43
import { useScrollDirectionContext } from "../../services/reducers/ScrollDirectionContext";
54

5+
const throttle = (func, limit) => {
6+
let inThrottle;
7+
return function (...args) {
8+
if (!inThrottle) {
9+
func.apply(this, args);
10+
inThrottle = true;
11+
setTimeout(() => (inThrottle = false), limit);
12+
}
13+
};
14+
};
15+
616
const StyledContainer = styled.div`
717
padding: 15px;
818
width: 100%;
19+
height: 100%;
920
overflow-y: auto;
10-
scroll-behavior: smooth;
21+
-webkit-overflow-scrolling: touch;
22+
overscroll-behavior: contain;
23+
1124
@media (max-height: 500px) and (max-width: 1000px) {
12-
padding-bottom: 150px;
25+
padding-bottom: 60px;
1326
}
1427
`;
1528

1629
function BaseContainer({ children, className }, forwardedRef) {
1730
const internalRef = useRef(null);
1831
const ref = forwardedRef || internalRef;
19-
20-
const isScrollingDown = useScrollDirection(ref);
32+
const lastScrollY = useRef(0);
2133
const { updateScrollDirection } = useScrollDirectionContext();
2234

35+
const handleScroll = useCallback(() => {
36+
if (!ref.current) return;
37+
38+
const currentScrollY = ref.current.scrollTop;
39+
const maxScroll = ref.current.scrollHeight - ref.current.clientHeight;
40+
41+
if (currentScrollY > maxScroll - 5) {
42+
return;
43+
}
44+
45+
if (currentScrollY < 3) {
46+
if (lastScrollY.current > 3) {
47+
updateScrollDirection(false);
48+
}
49+
lastScrollY.current = currentScrollY;
50+
return;
51+
}
52+
53+
const difference = currentScrollY - lastScrollY.current;
54+
const isScrollingDown = difference > 5;
55+
56+
if (Math.abs(difference) > 5) {
57+
updateScrollDirection(isScrollingDown);
58+
}
59+
60+
lastScrollY.current = currentScrollY;
61+
}, [ref, updateScrollDirection]);
62+
2363
useEffect(() => {
24-
updateScrollDirection(isScrollingDown);
25-
}, [isScrollingDown, updateScrollDirection]);
64+
const element = ref.current;
65+
if (!element) return;
66+
67+
const throttledHandleScroll = throttle(handleScroll, 100); // throttle 100ms
68+
69+
element.addEventListener("scroll", throttledHandleScroll, {
70+
passive: true,
71+
});
72+
73+
return () => {
74+
element.removeEventListener("scroll", throttledHandleScroll);
75+
};
76+
}, [handleScroll, ref]);
2677

2778
return (
2879
<StyledContainer ref={ref} className={className}>

0 commit comments

Comments
 (0)