Skip to content

Commit

Permalink
Merge pull request #124 from daodaoedu/hotfix/user-completion-status-…
Browse files Browse the repository at this point in the history
…was-not-updated-on-initial-registration

hotfix: check completion status, add tag and line validate
  • Loading branch information
vincentxuu authored Nov 11, 2024
2 parents 22e4d0a + 703ec82 commit cfdc323
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions components/Group/Form/Fields/TagsField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function TagsField({ name, helperText, control, value = [] }) {
const handleChange = (e) => {
const _value = e.target.value;
if (_value.length > 8) setError('標籤最多 8 個字');
else if (value.includes(_value)) setError('請勿重複輸入');
else setError('');
setInput(_value);
};
Expand Down
2 changes: 2 additions & 0 deletions components/Group/Form/Form.styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const StyledLabel = styled(InputLabel)`
`;

export const StyledGroup = styled.div`
width: 100%;
& + & {
margin-top: 20px;
}
Expand Down
20 changes: 11 additions & 9 deletions components/Profile/Edit/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
import { MobileDatePicker } from '@mui/x-date-pickers/MobileDatePicker';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import InputTags from '../InputTags';
import Fields from '@/components/Group/Form/Fields';
import ErrorMessage from './ErrorMessage';

import TheAvator from './TheAvator';
Expand Down Expand Up @@ -356,12 +356,12 @@ function EditPage() {
>
<StyledGroup mt="0">
<Typography sx={{ fontWeight: 700, fontSize: '18px' }}>
聯絡方式
聯絡方式 *
</Typography>
<Typography
sx={{ color: '#92989A', fontWeight: 400, fontSize: '14px' }}
>
聯絡資訊會呈現在你的公開頁面上,讓夥伴能聯繫你
聯絡資訊會呈現在你的公開頁面上,讓夥伴能聯繫你,至少填寫一個社交媒體帳號
</Typography>
</StyledGroup>
<Grid container columnSpacing={1}>
Expand Down Expand Up @@ -408,7 +408,7 @@ function EditPage() {
sx={{ fontWeight: 500 }}
ref={(element) => setRef('wantToDoList', element)}
>
想和夥伴一起
想和夥伴一起 *
</Typography>
<StyledSelectWrapper>
{WANT_TO_DO_WITH_PARTNER.map(({ label, value }) => (
Expand Down Expand Up @@ -453,11 +453,13 @@ function EditPage() {
</StyledGroup>
<StyledGroup>
<Typography sx={{ fontWeight: 500 }}>標籤</Typography>
<InputTags
ref={(element) => setRef('tagList', element)}
<Fields.TagsField
name="tagList"
value={userState.tagList}
change={(value) => {
onChangeHandler({ key: 'tagList', value, isMultiple: true });
control={{
setRef: (name, element) => setRef(name, element),
onChange: ({ target }) =>
onChangeHandler({ key: target.name, value: target.value }),
}}
/>
<Typography
Expand All @@ -475,7 +477,7 @@ function EditPage() {

<StyledGroup>
<Typography sx={{ fontWeight: 500, mb: '6px' }}>
個人簡介
個人簡介 *
</Typography>
<TextareaAutosize
ref={(element) => setRef('selfIntroduction', element)}
Expand Down
6 changes: 3 additions & 3 deletions components/Profile/Edit/useEditProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const initialState = {
tagList: [],
selfIntroduction: '',
share: '',
isOpenLocation: false,
isOpenProfile: false,
isOpenLocation: true,
isOpenProfile: true,
isLoadingSubmit: false,
country: '',
city: '',
Expand Down Expand Up @@ -72,7 +72,7 @@ const schema = z.object({
),
line: buildValidator(
20,
/^($|[a-zA-Z0-9_.]{6,20})$/,
/^($|[a-zA-Z0-9_.]{3,20})$/,
'長度最多20個字元',
'長度最少6個字元,支援英文、數字、底線、句號',
),
Expand Down
2 changes: 1 addition & 1 deletion components/Signin/useValidation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const initialState = {
birthDay: dayjs(),
gender: '',
roleList: [],
isSubscribeEmail: false,
isSubscribeEmail: true,
};

const userReducer = (state, payload) => {
Expand Down
1 change: 1 addition & 0 deletions redux/reducers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const reducer = (state = initialState, action) => {
...state,
...action.payload,
apiState: 'Resolve',
isComplete: checkIsComplete(action.payload),
};
}
case 'UPDATE_USER_PROFILE_API_STATE_RESET': {
Expand Down

0 comments on commit cfdc323

Please sign in to comment.