Skip to content

Commit

Permalink
Merge pull request #75 from daodaoedu/dev
Browse files Browse the repository at this point in the history
merge dev into prod
  • Loading branch information
hsuifang authored Aug 8, 2024
2 parents b908ef9 + bb96532 commit 16ea19d
Show file tree
Hide file tree
Showing 21 changed files with 545 additions and 384 deletions.
6 changes: 2 additions & 4 deletions components/Group/SearchField/SelectedEducationStep.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Select from '@/shared/components/Select';
import { EDUCATION_STEP } from '@/constants/member';
import { EDUCATION_STAGE } from '@/constants/member';
import useSearchParamsManager from '@/hooks/useSearchParamsManager';

const EduStep = EDUCATION_STEP.slice(0, 7);

export default function SelectedEducationStep() {
const QUERY_KEY = 'partnerEducationStep';
const [getSearchParams, pushState] = useSearchParamsManager();
Expand All @@ -17,7 +15,7 @@ export default function SelectedEducationStep() {
multiple
value={getSearchParams(QUERY_KEY)}
onChange={handleChange}
items={EduStep}
items={EDUCATION_STAGE}
itemLabel="label"
itemValue="label"
renderValue={(selected) =>
Expand Down
64 changes: 45 additions & 19 deletions components/Group/detail/Contact/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useId, useState, forwardRef, useEffect } from 'react';
import { useRouter } from 'next/router';
import { useSelector } from 'react-redux';
import Link from 'next/link';
import styled from '@emotion/styled';
import {
Avatar,
Expand All @@ -23,6 +24,19 @@ import Feedback from './Feedback';

const ROLELIST = mapToTable(ROLE);

const StyledButton = styled(Button)`
padding: 8px 36px;
line-height: 1.5;
border-radius: 20px;
color: #ffff;
background-color: #16b9b3;
font-size: 16px;
&:disabled img {
mix-blend-mode: difference;
opacity: 0.3;
}
`;
const StyledTitle = styled.label`
display: block;
color: var(--black-white-gray-dark, #293a3d);
Expand All @@ -41,15 +55,27 @@ const StyledTextArea = styled(TextareaAutosize)`
width: 100%;
min-height: 128px;
`;
const StyledLink = styled(Link)`
margin-top: 6px;
margin-left: 6px;
display: block;
color: black;
font-size: 12px;
`;
const StyledSpan = styled.span`
padding: 0 2px;
color: #16b9b3;
text-decoration: underline;
`;

const Transition = forwardRef((props, ref) => {
return <Slide direction="up" ref={ref} {...props} />;
});

function ContactButton({
user,
children,
title,
label,
activityTitle,
description,
descriptionPlaceholder,
isLoading,
Expand All @@ -66,6 +92,7 @@ function ContactButton({
const descriptionId = `modal-description-${id}`;
const messageId = `message-${id}`;
const contactId = `contact-${id}`;
const isLogin = !!me?._id;
const role =
ROLE.find(({ key }) => user?.roleList?.includes(key))?.label || '暫無資料';

Expand Down Expand Up @@ -98,7 +125,8 @@ function ContactButton({
photoUrl: me.photoURL,
from: me.email,
to: user.email,
subject: '【島島阿學】點開 Email,認識新夥伴',
subject: '【島島阿學】點開 Email,揪團有新消息',
activityTitle,
title: '你發起的揪團有人來信!',
text: message,
information: [me.email, contact],
Expand All @@ -107,30 +135,28 @@ function ContactButton({

useEffect(() => {
if (!me?._id && open) router.push('/login');
}, [me, open, router]);
}, [me?._id, open, router]);

return (
<>
<Button
<div>
<StyledButton
variant="contained"
sx={{
p: '8px 36px',
lineHeight: 1.5,
borderRadius: '20px',
color: '#ffff',
bgcolor: '#16B9B3',
fontSize: '16px',
}}
disabled={isLoading}
disabled={!isLogin || isLoading}
onClick={() => setOpen(true)}
>
<img
src={chatSvg.src}
alt="contact icon"
style={{ marginRight: '8px' }}
/>
{children || title}
</Button>
{label}
</StyledButton>
{!isLogin && (
<StyledLink href="/login">
<StyledSpan>註冊</StyledSpan><StyledSpan>登入</StyledSpan>
即可聯繫主揪!
</StyledLink>
)}
<Dialog
keepMounted
scroll="body"
Expand Down Expand Up @@ -161,7 +187,7 @@ function ContactButton({
textAlign: 'center',
}}
>
{title}
{label}
</DialogTitle>
<IconButton
aria-label="close"
Expand Down Expand Up @@ -284,7 +310,7 @@ function ContactButton({
</Box>
</Dialog>
<Feedback type={feedback} onClose={() => setFeedback('')} />
</>
</div>
);
}

Expand Down
2 changes: 1 addition & 1 deletion components/Group/detail/More.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function More() {
>
<MenuItem
component="a"
href="https://docs.google.com/forms/d/e/1FAIpQLSfgpHNzm9OAk44Jbgamkq7--odZfC3h4vgw96DPLYvZ07wC_g/viewform"
href="https://forms.gle/NkVbDWC3eXk4P4gv7"
target="_blank"
sx={{ minWidth: '146px' }}
onClick={handleClose}
Expand Down
3 changes: 2 additions & 1 deletion components/Group/detail/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ function GroupDetail({ id, source, isLoading }) {
) : (
<ContactButton
user={source?.user || {}}
title="聯繫主揪"
activityTitle={source?.title}
label="聯繫主揪"
description="想跟主揪說的話"
descriptionPlaceholder="想參加主揪的團體嗎?可以簡單的自我介紹,寫下想加入的原因。"
/>
Expand Down
73 changes: 45 additions & 28 deletions components/Profile/InputTags/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const Tag = ({ label, onCancel }) => {
borderRadius: '4px',
padding: '4px 8px',
mr: '8px',
mb: '8px',
}}
>
<Typography
Expand All @@ -36,9 +37,20 @@ const Tag = ({ label, onCancel }) => {
);
};

const StyledTagsField = styled(TextField)`
const StyledTagsWrapper = styled(Box)`
width: 100%;
border: 1px solid #dbdbdb;
border-radius: 4px;
align-items: center;
padding: 8px 16px;
min-height: 50px;
div {
&::before {
border-color: transparent;
}
}
input {
padding-left: ${({ hasData }) => (hasData ? '0' : '16px')};
padding: 0;
}
`;

Expand All @@ -51,33 +63,38 @@ function InputTags({ value = [], change }) {
}
}
};

return (
<StyledTagsField
hasData={value.length > 0}
fullWidth="true"
placeholder="搜尋或新增標籤"
onKeyDown={keyDownHandle}
className="input-tags"
InputProps={
value.length && {
startAdornment: (
<Box sx={{ marginTop: '5px', display: 'flex' }}>
{Array.isArray(value) &&
value.map(
(item) =>
typeof item === 'string' && (
<Tag
key={item}
label={item}
onCancel={() => change(item)}
/>
),
)}
</Box>
),
}
}
/>
<StyledTagsWrapper>
<Box
sx={{
marginTop: '5px',
display: 'flex',
flexWrap: 'wrap',
alignItems: 'center',
}}
>
{Array.isArray(value) &&
value.map(
(item) =>
typeof item === 'string' && (
<Tag key={item} label={item} onCancel={() => change(item)} />
),
)}
<TextField
fullWidth="true"
placeholder={value.length ? '' : '搜尋或新增標籤'}
onKeyDown={keyDownHandle}
variant="standard"
className="text-field"
sx={{
padding: '0',
minWidth: '50px',
width: 'auto',
}}
/>
</Box>
</StyledTagsWrapper>
);
}

Expand Down
38 changes: 38 additions & 0 deletions components/Profile/UserCard/Avator.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react';
import { LazyLoadImage } from 'react-lazy-load-image-component';
import { Skeleton } from '@mui/material';

const Avator = ({ photoURL }) => {
return (
<LazyLoadImage
alt="login"
src={photoURL || ''}
height={80}
width={80}
effect="opacity"
style={{
borderRadius: '100%',
background: 'rgba(240, 240, 240, .8)',
objectFit: 'cover',
objectPosition: 'center',
minHeight: '80px',
minWidth: '80px',
}}
placeholder={
// eslint-disable-next-line react/jsx-wrap-multilines
<Skeleton
sx={{
height: '80px',
width: '80px',
background: 'rgba(240, 240, 240, .8)',
marginTop: '4px',
}}
variant="circular"
animation="wave"
/>
}
/>
);
};

export default Avator;
2 changes: 1 addition & 1 deletion components/Profile/UserCard/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Dropdown({ sx }) {
<StyledMenu anchorEl={anchorEl} open={open} onClose={handleClose}>
<MenuItem
component="a"
href="https://docs.google.com/forms/d/e/1FAIpQLSfgpHNzm9OAk44Jbgamkq7--odZfC3h4vgw96DPLYvZ07wC_g/viewform"
href="https://forms.gle/NkVbDWC3eXk4P4gv7"
target="_blank"
sx={{ minWidth: '146px' }}
onClick={handleClose}
Expand Down
15 changes: 15 additions & 0 deletions components/Profile/UserCard/SocialMediaItem.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { Box } from '@mui/material';

const SocialMediaItem = ({ link, text, tag, iconComponent }) => {
return (
<Box as={tag || 'div'}>
{iconComponent}
<a target="_blank" rel="noreferrer" href={link}>
{text}
</a>
</Box>
);
};

export default SocialMediaItem;
19 changes: 19 additions & 0 deletions components/Profile/UserCard/Tag.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Chip } from '@mui/material';

const Tag = ({ label }) => {
return (
<Chip
label={label}
value={label}
sx={{
margin: '5px',
whiteSpace: 'nowrap',
fontWeight: 400,
fontSize: '14px',
bgcolor: '#DEF5F5',
}}
/>
);
};

export default Tag;
Loading

0 comments on commit 16ea19d

Please sign in to comment.