diff --git a/components/Profile/MyGroup/index.jsx b/components/Profile/MyGroup/index.jsx index 33dc0090..e9cb6f35 100644 --- a/components/Profile/MyGroup/index.jsx +++ b/components/Profile/MyGroup/index.jsx @@ -25,10 +25,13 @@ const StyledGroupsWrapper = styled.div` ${(props) => props.sx} `; -const MyGroup = ({ hasTitle = true, sx }) => { +const MyGroup = ({ hasTitle = true, sx, userId }) => { + if (!userId) { + return 趕快發起屬於你的揪團吧~; + } + const [response, setResponse] = useState(null); - const me = useSelector((state) => state.user); - const { isFetching } = useFetch(`${GROUP_API_URL}/user/${me?._id}`, { + const { isFetching } = useFetch(`${GROUP_API_URL}/user/${userId}`, { onSuccess: setResponse, }); diff --git a/components/Profile/UserCard/index.jsx b/components/Profile/UserCard/index.jsx index 634b1f04..6330c0f6 100644 --- a/components/Profile/UserCard/index.jsx +++ b/components/Profile/UserCard/index.jsx @@ -228,10 +228,10 @@ function UserCard({ - {' '} + {location ? location.length >= 2 - ? locations.join('').replace('台灣', '').replace('null', '') + ? locations.join('').replace('台灣', '').replaceAll('null', '') : locations.join('') : '-'} diff --git a/components/Profile/UserTabs/UserInfoBasic.jsx b/components/Profile/UserTabs/UserInfoBasic.jsx index 4dedec0c..c01558b9 100644 --- a/components/Profile/UserTabs/UserInfoBasic.jsx +++ b/components/Profile/UserTabs/UserInfoBasic.jsx @@ -19,7 +19,7 @@ function UserInfoBasic({ description = '', wantToDoList = [], share = '' }) {

簡介

{description ? ( - description.split('\n').map((d) => {d}) + description.split('\n').map((d) => {d}) ) : ( 尚未填寫 )} diff --git a/components/Profile/UserTabs/index.jsx b/components/Profile/UserTabs/index.jsx index 98b44a77..f98ab55b 100644 --- a/components/Profile/UserTabs/index.jsx +++ b/components/Profile/UserTabs/index.jsx @@ -29,6 +29,7 @@ const UserTabs = ({ panels = [] }) => { {panels.length > 0 && panels.map((panel) => ( { {panels.length > 0 && panels.map((panel) => ( - + {panel.content} ))} diff --git a/components/Profile/index.jsx b/components/Profile/index.jsx index 9703ac80..480c19a7 100644 --- a/components/Profile/index.jsx +++ b/components/Profile/index.jsx @@ -53,6 +53,7 @@ const ROLELIST = mapToTable(ROLE); const EDUCATION_STAGE_TABLE = mapToTable(EDUCATION_STAGE); const Profile = ({ + _id, name, email, photoURL, @@ -182,9 +183,12 @@ const Profile = ({ title: '發起的揪團', content: ( { const router = useRouter(); const mobileScreen = useMediaQuery('(max-width: 767px)'); + const me = useSelector((state) => state.user); + const tabsItems = tabs.map((tab) => + tab.id === 'my-group' + ? { + ...tab, + view: , + } + : tab, + ); + const [value, setValue] = useState(() => { const id = new URLSearchParams(location.search).get('id'); const tabIndex = tabs.findIndex((tab) => tab.id === id); @@ -156,7 +167,7 @@ const ProfilePage = () => { - {tabs.map((tab, index) => ( + {tabsItems.map((tab, index) => ( {tab.view}