Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge to prod #120

Merged
merged 41 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7ee66e4
feat(userTabs): refactor user description html
ruby10127130 Oct 30, 2024
e543af5
Merge pull request #108 from ruby10127130/feature/refactor-user-descr…
JohnsonMao Oct 30, 2024
149b93b
fix: correct user description styling issue on mobile devices
ruby10127130 Oct 30, 2024
b814bd1
Merge pull request #109 from ruby10127130/fix/adjust-user-description…
JohnsonMao Oct 31, 2024
dfbdeea
chore: add conditional logic to control avatar display
whalekiller03 Oct 31, 2024
c979e5a
fix(Profile/Edit): handle waiting state for submit result
whalekiller03 Oct 31, 2024
098bbae
feat: add input validation for user creation on SignIn page
whalekiller03 Oct 31, 2024
759e38f
fix(signin): remove unneccessary comparisons
whalekiller03 Oct 31, 2024
644dc27
chore: add staticPageGenerationTimeout in next.config to prevent Noti…
whalekiller03 Nov 1, 2024
1ca8506
Merge pull request #112 from daodaoedu/feature/registration
hsuifang Nov 1, 2024
bb3b420
feat(group): add terms link and consent checkbox
JohnsonMao Nov 2, 2024
d0620c3
feat(group): modify form fields per new requirements
JohnsonMao Nov 2, 2024
21222a6
feat(shared): add text with links component
JohnsonMao Nov 3, 2024
f849619
feat(group): modify detailed per new requirement
JohnsonMao Nov 3, 2024
cb4019c
feat(group): modify search per new requestments
JohnsonMao Nov 3, 2024
8b4f7a1
feat(group): modify key description to content
JohnsonMao Nov 3, 2024
f811b20
feat(group): set activity category default value
JohnsonMao Nov 3, 2024
9ba35fb
feat(group): auto-focus on input field after error
JohnsonMao Nov 3, 2024
82471f2
feat(group): update group page features per requirements (#113)
JohnsonMao Nov 3, 2024
a72c63d
feat(profile): modify edit per new requestment
JohnsonMao Nov 3, 2024
b566bdf
feat(shared): add complete info reminder dialog
JohnsonMao Nov 3, 2024
aec62ad
feat(shared): add info complete guard
JohnsonMao Nov 3, 2024
af67088
fix(group): 401 runtime error
JohnsonMao Nov 3, 2024
cf06d17
Merge branch 'dev' into feat/group
JohnsonMao Nov 3, 2024
d59d79f
fix: sonar cloud issue
JohnsonMao Nov 3, 2024
602a02e
Merge pull request #114 from daodaoedu/feat/group
JohnsonMao Nov 3, 2024
9109795
Feature/group detail/update page info (#115)
ruby10127130 Nov 4, 2024
d744e7f
fix(profile): check complete bug
JohnsonMao Nov 4, 2024
2272378
feat(shared): save reminder popup status to localStorage
JohnsonMao Nov 4, 2024
2d65b9f
chore: modify web style
JohnsonMao Nov 4, 2024
6b6c0f1
chore(group): modify text and check reminder
JohnsonMao Nov 4, 2024
b93c762
Merge pull request #116 from daodaoedu/feat/group
JohnsonMao Nov 4, 2024
e4c9f0f
fix(profile): check every key
JohnsonMao Nov 4, 2024
cb17590
Merge pull request #117 from daodaoedu/feat/group
JohnsonMao Nov 4, 2024
91fb6ac
fix: check complete and profile toast bug
JohnsonMao Nov 4, 2024
f7679ab
Merge pull request #118 from daodaoedu/feat/group
JohnsonMao Nov 4, 2024
78bd81a
fix: update the option description
vincentxuu Nov 4, 2024
5954152
fix: update the option description
vincentxuu Nov 4, 2024
bfc6de9
fix(profile): check login and info complete
JohnsonMao Nov 5, 2024
ec236f2
feat(group): random cover image
JohnsonMao Nov 5, 2024
a26de8a
Merge pull request #119 from daodaoedu/feat/group
JohnsonMao Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/Group/Banner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled from '@emotion/styled';
import Button from '@/shared/components/Button';
import groupBannerImg from '@/public/assets/group-banner.png';
import Image from '@/shared/components/Image';
import InfoCompletionGuard from '@/shared/components/InfoCompletionGuard';

const StyledBanner = styled.div`
position: relative;
Expand Down Expand Up @@ -60,7 +61,9 @@ const Banner = () => {
<h1>揪團</h1>
<p>想一起組織有趣的活動或學習小組嗎?</p>
<p>註冊並加入我們,然後創建你的活動,讓更多人一起參加!</p>
<Button onClick={() => router.push('/group/create')}>我想揪團</Button>
<InfoCompletionGuard>
<Button onClick={() => router.push('/group/create')}>我想揪團</Button>
</InfoCompletionGuard>
</div>
</StyledBanner>
);
Expand Down
6 changes: 5 additions & 1 deletion components/Group/Form/Fields/AreaCheckbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function AreaCheckbox({
itemLabel,
itemValue,
name,
value,
value = [],
control,
}) {
const [isPhysicalArea, setIsPhysicalArea] = useState(false);
Expand Down Expand Up @@ -57,12 +57,14 @@ export default function AreaCheckbox({
<FormControlLabel
control={<Checkbox onClick={toggleIsPhysicalArea} />}
label="實體活動"
disabled={value.includes('待討論')}
checked={isPhysicalArea}
/>
<Select
name={name}
options={options}
placeholder="地點"
disabled={value.includes('待討論')}
value={physicalAreaValue}
itemLabel={itemLabel}
itemValue={itemValue}
Expand All @@ -73,6 +75,7 @@ export default function AreaCheckbox({
<FormControlLabel
control={<Checkbox onClick={() => handleCheckboxChange('線上')} />}
label="線上"
disabled={value.includes('待討論')}
checked={value.includes('線上')}
/>
</div>
Expand All @@ -81,6 +84,7 @@ export default function AreaCheckbox({
control={<Checkbox onClick={() => handleCheckboxChange('待討論')} />}
label="待討論"
checked={value.includes('待討論')}
disabled={value.some((item) => item !== '待討論')}
/>
</div>
</>
Expand Down
41 changes: 41 additions & 0 deletions components/Group/Form/Fields/CheckboxGroup.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import Box from '@mui/material/Box';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';

export default function CheckboxGroup({
options,
name,
value = [],
control,
handleValues,
}) {
const handleCheckboxChange = (_value) => {
const hasValue = value.includes(_value);
const updatedValue = hasValue
? value.filter((v) => v !== _value)
: [...value, _value];
const newValue = handleValues(
hasValue ? 'remove' : 'add',
_value,
updatedValue,
);

control.onChange({ target: { name, value: newValue } });
};

return (
<Box sx={{ display: 'flex', flexWrap: 'wrap' }}>
{options.map((option) => (
<FormControlLabel
key={option.value}
sx={{ flex: '0 0 124px' }}
control={
<Checkbox onClick={() => handleCheckboxChange(option.value)} />
}
label={option.label}
checked={value.includes(option.value)}
/>
))}
</Box>
);
}
68 changes: 68 additions & 0 deletions components/Group/Form/Fields/DateRadio.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import dayjs from 'dayjs';
import { useEffect, useState } from 'react';
import Box from '@mui/material/Box';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
import TextField from '@mui/material/TextField';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { MobileDatePicker } from '@mui/x-date-pickers/MobileDatePicker';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';

export default function DateRadio({
name,
customValueName,
value,
isCustomValue,
control,
}) {
const [isCustomDate, setIsCustomDate] = useState(isCustomValue);
const [date, setDate] = useState(value);

useEffect(() => {
control.onChange({ target: { name, value: date } });
control.onChange({
target: { name: customValueName, value: isCustomDate },
});
}, [name, date, customValueName, isCustomDate]);

return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<Box
sx={{
display: 'flex',
alignItems: 'center',
label: { whiteSpace: 'nowrap' },
}}
>
<FormControlLabel
control={<Checkbox onClick={() => setIsCustomDate(true)} />}
label="自訂"
checked={isCustomDate}
/>
<MobileDatePicker
inputFormat="YYYY/MM/DD"
value={date}
onChange={setDate}
onAccept={() => setIsCustomDate(true)}
minDate={dayjs().add(1, 'day')}
maxDate={dayjs().add(4, 'year')}
renderInput={(params) => (
<TextField
{...params}
size="small"
sx={{ '& legend': { display: 'none' } }}
fullWidth
/>
)}
/>
</Box>
<div>
<FormControlLabel
control={<Checkbox onClick={() => setIsCustomDate(false)} />}
label="不限"
checked={!isCustomDate}
/>
</div>
</LocalizationProvider>
);
}
4 changes: 2 additions & 2 deletions components/Group/Form/Fields/Select.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useState } from 'react';
import FormControl from '@mui/material/FormControl';
import MuiSelect from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem';
Expand All @@ -14,7 +13,7 @@ export default function Select({
sx,
disabled,
control,
value,
value = [],
error,
}) {
const getValue = (any, key) => (typeof any === 'object' ? any[key] : any);
Expand All @@ -27,6 +26,7 @@ export default function Select({
return (
<FormControl size="small" fullWidth>
<MuiSelect
inputRef={(element) => control.setRef?.(name, element)}
displayEmpty
multiple={multiple}
fullWidth={fullWidth}
Expand Down
1 change: 1 addition & 0 deletions components/Group/Form/Fields/TagsField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function TagsField({ name, helperText, control, value = [] }) {
))}
{value.length < 8 && (
<input
ref={(element) => control.setRef?.(name, element)}
value={input}
onCompositionStart={() => {
isComposing.current = true;
Expand Down
3 changes: 2 additions & 1 deletion components/Group/Form/Fields/TextField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function TextField({
return (
<>
<MuiTextField
inputRef={(element) => control.setRef?.(name, element)}
fullWidth
id={id}
name={name}
Expand All @@ -21,7 +22,7 @@ export default function TextField({
placeholder={placeholder}
value={value}
multiline={multiline}
rows={multiline && 10}
rows={multiline && 6}
helperText={helperText}
{...control}
/>
Expand Down
25 changes: 18 additions & 7 deletions components/Group/Form/Fields/Upload.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { useEffect, useRef, useState } from 'react';
import { GiPerspectiveDiceSixFacesThree } from 'react-icons/gi';
import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
import DeleteSvg from '@/public/assets/icons/delete.svg';
import Image from '@/shared/components/Image';
import { StyledUpload } from '../Form.styled';
import UploadSvg from './UploadSvg';

export default function Upload({ name, value, control }) {
const [preview, setPreview] = useState(value || '');
const [preview, setPreview] = useState(value);
const [error, setError] = useState('');
const inputRef = useRef();
const isLoading = useRef(false);

const changeHandler = (file) => {
const event = {
Expand Down Expand Up @@ -66,15 +67,25 @@ export default function Upload({ name, value, control }) {
if (files?.[0]) handleFile(files[0]);
};

const handleClear = () => {
const handleRandom = () => {
setPreview('');
setError('');
inputRef.current.value = '';
changeHandler('');
};

useEffect(() => {
if (typeof value === 'string') setPreview(value);
if (typeof value === 'string' && value) {
setPreview(value);
} else if (!isLoading.current && !value) {
isLoading.current = true;
fetch('https://picsum.photos/436/244')
.then((res) => res.blob())
.then(handleFile)
.then(() => {
isLoading.current = false;
});
}
}, [value]);

return (
Expand All @@ -92,10 +103,10 @@ export default function Upload({ name, value, control }) {
marginTop: 0.25,
},
}}
onClick={handleClear}
onClick={handleRandom}
>
<img src={DeleteSvg.src} alt="delete icon" />
<span>清除</span>
<GiPerspectiveDiceSixFacesThree size={20} />
<span>隨機圖片</span>
</Button>
)}
<StyledUpload
Expand Down
4 changes: 4 additions & 0 deletions components/Group/Form/Fields/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import TagsField from './TagsField';
import TextField from './TextField';
import Upload from './Upload';
import Wrapper from './Wrapper';
import CheckboxGroup from './CheckboxGroup';
import DateRadio from './DateRadio';

const withWrapper = (Component) => (props) => {
const id = useId();
Expand All @@ -25,6 +27,8 @@ const withWrapper = (Component) => (props) => {

const Fields = {
AreaCheckbox: withWrapper(AreaCheckbox),
CheckboxGroup: withWrapper(CheckboxGroup),
DateRadio: withWrapper(DateRadio),
Select: withWrapper(Select),
TagsField: withWrapper(TagsField),
TextField: withWrapper(TextField),
Expand Down
4 changes: 3 additions & 1 deletion components/Group/Form/Form.styled.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ export const StyledLabel = styled(InputLabel)`
`;

export const StyledGroup = styled.div`
margin-bottom: 20px;
& + & {
margin-top: 20px;
}

.error-message {
font-size: 14px;
Expand Down
Loading
Loading