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

fix: not display contact button bug #47

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
308 changes: 153 additions & 155 deletions components/Group/detail/Contact/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function ContactButton({
title: '你發起的揪團有人來信!',
to: user.email,
text: message,
information: [me.email || '[email protected]', contact],
information: [me.email, contact],
}),
})
.then(() => {
Expand All @@ -102,183 +102,181 @@ function ContactButton({
}, [me, open, router]);

return (
me?._id === user?.email && (
<>
<Button
variant="contained"
<>
<Button
variant="contained"
sx={{
p: '8px 36px',
lineHeight: 1.5,
borderRadius: '20px',
color: '#ffff',
bgcolor: '#16B9B3',
fontSize: '16px',
}}
disabled={isLoading}
onClick={() => setOpen(true)}
>
<img
src={chatSvg.src}
alt="contact icon"
style={{ marginRight: '8px' }}
/>
{children || title}
</Button>
<Dialog
keepMounted
scroll="body"
fullScreen={isMobileScreen}
open={open}
onClose={handleClose}
aria-labelledby={titleId}
aria-describedby={descriptionId}
TransitionComponent={Transition}
sx={{
'.MuiPaper-root': {
marginTop: isMobileScreen ? '84px' : undefined,
},
}}
PaperProps={{
sx: {
p: '16px 40px 32px',
borderRadius: '16px',
},
}}
>
<DialogTitle
id={titleId}
sx={{
p: '8px 36px',
lineHeight: 1.5,
borderRadius: '20px',
color: '#ffff',
bgcolor: '#16B9B3',
fontSize: '16px',
color: '#536166',
fontWeight: 700,
fontSize: '18px',
textAlign: 'center',
}}
disabled={isLoading}
onClick={() => setOpen(true)}
>
<img
src={chatSvg.src}
alt="contact icon"
style={{ marginRight: '8px' }}
/>
{children || title}
</Button>
<Dialog
keepMounted
scroll="body"
fullScreen={isMobileScreen}
open={open}
onClose={handleClose}
aria-labelledby={titleId}
aria-describedby={descriptionId}
TransitionComponent={Transition}
{title}
</DialogTitle>
<IconButton
aria-label="close"
onClick={handleClose}
sx={{
'.MuiPaper-root': {
marginTop: isMobileScreen ? '84px' : undefined,
},
position: 'absolute',
right: 32,
top: 24,
color: '#536166',
}}
PaperProps={{
sx: {
p: '16px 40px 32px',
borderRadius: '16px',
},
>
<CloseIcon />
</IconButton>
<Box
sx={{
width: isMobileScreen ? '100%' : '400px',
display: 'flex',
flexDirection: 'column',
gap: '16px',
}}
>
<DialogTitle
id={titleId}
sx={{
color: '#536166',
fontWeight: 700,
fontSize: '18px',
textAlign: 'center',
}}
>
{title}
</DialogTitle>
<IconButton
aria-label="close"
onClick={handleClose}
<Box
sx={{
position: 'absolute',
right: 32,
top: 24,
color: '#536166',
p: '12px',
backgroundColor: '#DEF5F5',
display: 'flex',
borderRadius: '16px',
alignItems: 'center',
gap: '12px',
}}
>
<CloseIcon />
</IconButton>
<Avatar
src={user?.photoURL}
alt={`${user?.name} avatar`}
sx={{ width: '60px', height: '60px' }}
/>
<div>
<Typography
sx={{
display: 'block',
color: ' #293A3D',
fontWeight: 500,
fontSize: '16px',
lineHeight: '140%',
}}
>
{user?.name || '名稱'}
</Typography>
<Typography
sx={{
display: 'block',
color: ' #536166',
fontWeight: 400,
fontSize: '14px',
lineHeight: '140%',
}}
>
{role}
</Typography>
</div>
</Box>

<div>
<StyledTitle id={descriptionId} htmlFor={messageId}>
{description}
</StyledTitle>
<StyledTextArea
id={messageId}
value={message}
onChange={(e) => setMessage(e.target.value)}
placeholder={descriptionPlaceholder}
/>
</div>

<div>
<StyledTitle htmlFor={contactId}>聯絡資訊</StyledTitle>
<StyledTextArea
id={contactId}
value={contact}
onChange={(e) => setContact(e.target.value)}
placeholder="寫下您的聯繫資訊,如 e-mail、line、Facebook、Instagram 等等。"
/>
</div>

<Box
sx={{
width: isMobileScreen ? '100%' : '400px',
display: 'flex',
flexDirection: 'column',
gap: '16px',
}}
>
<Box
<Button
color="inherit"
sx={{
p: '12px',
backgroundColor: '#DEF5F5',
display: 'flex',
borderRadius: '16px',
alignItems: 'center',
gap: '12px',
flex: 1,
borderRadius: '20px',
borderColor: 'transparent',
boxShadow: '0 4px 10px #C4C2C166',
}}
variant="outlined"
disabled={isLoading}
onClick={handleClose}
>
<Avatar
src={user?.photoURL}
alt={`${user?.name} avatar`}
sx={{ width: '60px', height: '60px' }}
/>
<div>
<Typography
sx={{
display: 'block',
color: ' #293A3D',
fontWeight: 500,
fontSize: '16px',
lineHeight: '140%',
}}
>
{user?.name || '名稱'}
</Typography>
<Typography
sx={{
display: 'block',
color: ' #536166',
fontWeight: 400,
fontSize: '14px',
lineHeight: '140%',
}}
>
{role}
</Typography>
</div>
</Box>

<div>
<StyledTitle id={descriptionId} htmlFor={messageId}>
{description}
</StyledTitle>
<StyledTextArea
id={messageId}
value={message}
onChange={(e) => setMessage(e.target.value)}
placeholder={descriptionPlaceholder}
/>
</div>

<div>
<StyledTitle htmlFor={contactId}>聯絡資訊</StyledTitle>
<StyledTextArea
id={contactId}
value={contact}
onChange={(e) => setContact(e.target.value)}
placeholder="寫下您的聯繫資訊,如 e-mail、line、Facebook、Instagram 等等。"
/>
</div>

<Box
取消
</Button>
<Button
sx={{
display: 'flex',
gap: '16px',
flex: 1,
borderRadius: '20px',
color: '#ffff',
bgcolor: '#16B9B3',
boxShadow: '0 4px 10px #C4C2C166',
}}
variant="contained"
disabled={isLoading || !message || !contact}
onClick={handleSubmit}
>
<Button
color="inherit"
sx={{
flex: 1,
borderRadius: '20px',
borderColor: 'transparent',
boxShadow: '0 4px 10px #C4C2C166',
}}
variant="outlined"
disabled={isLoading}
onClick={handleClose}
>
取消
</Button>
<Button
sx={{
flex: 1,
borderRadius: '20px',
color: '#ffff',
bgcolor: '#16B9B3',
boxShadow: '0 4px 10px #C4C2C166',
}}
variant="contained"
disabled={isLoading || !message || !contact}
onClick={handleSubmit}
>
送出
</Button>
</Box>
送出
</Button>
</Box>
</Dialog>
<Feedback type={feedback} onClose={() => setFeedback('')} />
</>
)
</Box>
</Dialog>
<Feedback type={feedback} onClose={() => setFeedback('')} />
</>
);
}

Expand Down
23 changes: 23 additions & 0 deletions components/Group/detail/Detail.styled.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from '@emotion/styled';
import Button from '@mui/material/Button';

export const StyledGoBack = styled.div`
display: inline-block;
Expand Down Expand Up @@ -31,3 +32,25 @@ export const StyledContainer = styled.main`
width: 100%;
}
`;

export const StyledDesktopEditButton = styled(Button)`
position: absolute;
top: 0;
right: 0;
border-radius: 20px;

@media (max-width: 767px) {
display: none;
}
`;

export const StyledMobileEditButton = styled(Button)`
display: none;
max-width: 316px;
width: 100%;
border-radius: 20px;

@media (max-width: 767px) {
display: block;
}
`;
Loading
Loading