Skip to content

Commit 7561ca8

Browse files
authored
Merge pull request #41 from iranpsc/feat/about-me
fix aboutMe bugs
2 parents da7c8b5 + 57674f4 commit 7561ca8

5 files changed

Lines changed: 25 additions & 16 deletions

File tree

src/components/Button.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import loaderGif from "../assets/gif/ajax-loader.gif";
33

44
const ButtonElement = styled.button`
55
border-radius: 10px;
6+
white-space: nowrap;
67
background-color: ${(props) =>
78
props.color
89
? props.disabled

src/pages/Settings/Tabs/aboutme-tab/AboutMeTab.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const Container = styled.div`
1414
height: 100%;
1515
overflow-y: auto;
1616
padding-right: 15px;
17+
padding-left: 1%;
1718
1819
`;
1920

src/pages/Settings/Tabs/aboutme-tab/CountryCity.jsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const Label = styled.label`
3232

3333
const CountryCity = () => {
3434
const { state, dispatch } = useGlobalState();
35+
3536
const [fields, setFields] = useState({
3637
cities: [],
3738
countries: [],
@@ -42,6 +43,7 @@ const CountryCity = () => {
4243
useEffect(() => {
4344
if (!isFieldsLoaded) {
4445
const loadFields = () => {
46+
4547
setFields({
4648
cities: getFieldsByTabName("misc", "iranian-cities"),
4749
countries: getFieldsByTabName("misc", "countries"),
@@ -53,20 +55,25 @@ const CountryCity = () => {
5355
}
5456
}, [isFieldsLoaded]);
5557

56-
const getTranslation = (fieldsType, stateValue) => {
57-
if (!isFieldsLoaded) return "";
58-
const selectedField = fields[fieldsType].find(
59-
(field) => field.name.trim().toLowerCase() === stateValue?.trim().toLowerCase()
60-
);
61-
return selectedField ? selectedField.translation : "";
62-
};
58+
const getTranslation = (fieldsType, stateValue) => {
59+
if (!isFieldsLoaded) return "";
60+
const selectedField = fields[fieldsType].find(
61+
(field) =>
62+
field?.name &&
63+
field.name.trim().toLowerCase() === stateValue?.trim().toLowerCase()
64+
);
65+
return selectedField ? selectedField.translation : "";
66+
};
6367

64-
const handleFieldChange = (fieldsType, translation, actionType) => {
65-
const selectedField = fields[fieldsType].find((field) => field.translation === translation);
66-
if (selectedField) {
67-
dispatch({ type: actionType, payload: selectedField.name });
68-
}
69-
};
68+
69+
const handleFieldChange = (fieldsType, translation, actionType) => {
70+
const selectedField = fields[fieldsType].find(
71+
(field) => field?.translation === translation
72+
);
73+
if (selectedField) {
74+
dispatch({ type: actionType, payload: selectedField.name });
75+
}
76+
};
7077

7178
const options = [
7279
{

src/pages/Settings/Tabs/aboutme-tab/EducationsAndJob.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ const EducationsAndJob = () => {
7373
<Container>
7474
<div>
7575
<Label htmlFor="education">
76-
{getFieldTranslationByNames("479")}
76+
{getFieldTranslationByNames("1440")}
7777
</Label>
7878
<Select
7979
id="education"
8080
value={state.education || ""}
8181
onChange={handleEducationChange}
8282
>
83-
<option value="">{getFieldTranslationByNames("479")}</option>
83+
<option value="">{getFieldTranslationByNames("1440")}</option>
8484
{educationFields.map((field) => (
8585
<option key={field.name} value={field.name}>
8686
{field.translation}

src/pages/Settings/Tabs/aboutme-tab/SaveInfo.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const SaveInfo = () => {
6565
{getFieldTranslationByNames("780")}
6666
</p>
6767
</Text>
68-
<Button label={getFieldTranslationByNames("782")} fit onclick={saveData} />
68+
<Button label={getFieldTranslationByNames("782")} fit onclick={saveData} />
6969
</Header>
7070
</>
7171
);

0 commit comments

Comments
 (0)