Skip to content

Commit

Permalink
NTUEEPLUS-288. Let users select their advisor professor (#254)
Browse files Browse the repository at this point in the history
* add advising prof row in profile

* can select multiple profs when editing profile

* advisingProfessor under mobile

* can show advising Professor in the Profile

* add all professor names

* delete all prof names comments

* Select component can show advising prof by default

* NTUEEPLUS-295. Add Materials (#253)

* add material route

* material collapse

* build settings

* fix: up to date

* fix: up to date

* fix: up to date

* defaultLayout update

* material/medium update and delete comments

* Make defaultLayout model invisible in profile page

* Update DefaultLayout model delete comment

* only shows defaultLayout when no advisProf exists

* make code clean

* fix: use <Link> to redirect to edit_profile page

---------

Co-authored-by: VincentWu <vincentwu0628@gmail.com>
  • Loading branch information
cynthialin1228 and vwvwMM authored Dec 11, 2023
1 parent 11d8bdc commit 94bd3af
Show file tree
Hide file tree
Showing 8 changed files with 295 additions and 42 deletions.
4 changes: 4 additions & 0 deletions backend/routes/Schemas/user_visual_new.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Profile_Schema = new Schema({
account: { type: String, required: true, lowercase: true },
username: { type: String, required: true },
nickname: String,
advisingProfessor: [{ label: String, value: String }],
profile: String,
major: String,
double_major: String,
Expand Down Expand Up @@ -44,6 +45,7 @@ Profile_Schema.statics.smartQuery = function (keywords) {
{ account: reg },
{ username: reg },
{ nickname: reg },
{ advisingProfessor: reg },
{ profile: reg },
{ major: reg },
{ double_major: reg },
Expand Down Expand Up @@ -71,6 +73,7 @@ Profile_Schema.methods.getPublic = function () {
account,
username,
nickname,
advisingProfessor,
profile,
major,
double_major,
Expand All @@ -92,6 +95,7 @@ Profile_Schema.methods.getPublic = function () {
account,
username,
nickname,
advisingProfessor,
profile,
major,
double_major,
Expand Down
3 changes: 3 additions & 0 deletions backend/routes/srcs/in/profile_new/searchProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const srhProfile = async function (req, res, next) {
account,
username,
nickname,
advisingProfessor,
profile,
publicEmail,
cellphone,
Expand All @@ -80,6 +81,7 @@ const srhProfile = async function (req, res, next) {
account,
username,
nickname,
advisingProfessor,
profile,
publicEmail,
cellphone,
Expand Down Expand Up @@ -122,6 +124,7 @@ const rules = [
'account',
'username',
'nickname',
'advisingProfessor',
'profile',
'publicEmail',
'cellphone',
Expand Down
3 changes: 3 additions & 0 deletions backend/routes/srcs/in/profile_new/updateProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const updateProfile = async (req, res, next) => {
const query = ({
username,
nickname,
advisingProfessor,
profile,
publicEmail,
cellphone,
Expand All @@ -62,6 +63,7 @@ const updateProfile = async (req, res, next) => {
doctor,
Occupation,
} = req.body)
query.advisingProfessor = JSON.parse(query.advisingProfessor)
query['userimage'] = parseFile(req.file)
const toSet = updateQuery(query)
console.log('toSet', toSet)
Expand All @@ -84,6 +86,7 @@ const rules = [
'account',
'username',
'nickname',
'advisingProfessor',
'profile',
'publicEmail',
'cellphone',
Expand Down
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-router-hash-link": "^2.4.3",
"react-select": "^5.7.4",
"react-tooltip": "^4.2.21",
"react-tsparticles": "^1.39.0",
"react-vertical-timeline-component": "^3.3.3",
Expand Down
57 changes: 35 additions & 22 deletions client/src/layout/DefaultLayout.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,59 @@
import React, { useState, useEffect } from 'react'
import { useLocation } from 'react-router-dom'
import { Link, useLocation } from 'react-router-dom'
import { useSelector } from 'react-redux'
import { selectLogin } from '../slices/loginSlice'
import { AppContent, AppSidebar, AppFooter, AppHeader } from '../components/index'
import { CModal, CModalHeader, CModalTitle, CModalBody, CModalFooter, CButton } from '@coreui/react'
import axios from 'axios'

const DefaultLayout = () => {
const pathname = useLocation().pathname.split('/')[1]
const { isLogin } = useSelector(selectLogin)
const noModal = ['forget', 'register_entry', 'reset_password', 'change_password']
const noModal = [
'edit_profile',
'profile',
'forget',
'register_entry',
'reset_password',
'change_password',
]
const [isModal, setIsModal] = useState(false)
useEffect(() => {
setIsModal(!noModal.includes(pathname) && isLogin)
if (isLogin) {
axios
.get('api/profile')
.then((res) => {
if (res.data.advisingProfessor.length) {
setIsModal(false)
} else {
setIsModal(!noModal.includes(pathname))
}
})
.catch((err) => {
console.log(err)
})
} else {
setIsModal(false)
}
}, [isLogin])
return (
<>
{/* <CModal size="l" visible={isModal} onDismiss={() => setIsModal(false)} alignment="center">
<CModal size="l" visible={isModal} onDismiss={() => setIsModal(false)} alignment="center">
<CModalHeader onDismiss={() => setIsModal(false)}>
<CModalTitle>注意!</CModalTitle>
<CModalTitle>請大家去新增專題教授</CModalTitle>
</CModalHeader>
<CModalBody>
為了資安的考量,請您先至<a href="/change_password">此網址</a>更改密碼。
EE+推出新功能,讓大家可以在上面登錄自己跟過的專題教授啦~
請點擊下方按鈕新增您跟過的專題教授吧!
</CModalBody>
<CModalFooter>
<CButton
color="warning"
onClick={() => {
setIsModal(false)
}}
>
我更改過密碼了!
</CButton>
<CButton
color="primary"
onClick={() => {
setIsModal(false)
}}
>
我是新註冊的帳號!
<CButton onClick={() => setIsModal(false)}>
<Link to={`/edit_profile`} style={{ color: 'white' }}>
立即填寫
</Link>
</CButton>
</CModalFooter>
</CModal> */}
</CModal>
<div>
<AppSidebar />
<div className="wrapper d-flex flex-column min-vh-100">
Expand Down
28 changes: 9 additions & 19 deletions client/src/views/in/material/Medium.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
import React, { useState } from 'react'
import { CCollapse } from '@coreui/react'
import CIcon from '@coreui/icons-react'

// B03
// 許秉鈞 2019 Fall CS M.S. 經驗分享(上篇:經驗傳承), 2019 Fall CS M.S. 經驗分享(下篇:顛覆印象)
// 許凱傑 EE Ph.D. Application https://medium.com/phd-in-america/introduction-b80879fe10e6
// 卓伯鴻 M.S. ECE/CS Applications https://jaycho2007.medium.com/m-s-ece-cs-applications-776098fca74e, 2021 SWE New Grad 找工雜談 https://jaycho2007.medium.com/2021-swe-new-grad-%E6%89%BE%E5%B7%A5%E9%9B%9C%E8%AB%87-816ce8b93677
// 楊其昇 北美硬體 VLSI 找實習/正職心得 https://chisheny.medium.com/%E5%8C%97%E7%BE%8E%E7%A1%AC%E9%AB%94-vlsi-%E6%89%BE%E5%AF%A6%E7%BF%92-%E6%AD%A3%E8%81%B7%E5%BF%83%E5%BE%97-1960e0d2ed7a, UM ECE MS 兩年修課心得 https://chisheny.medium.com/um-ece-ms-%E5%85%A9%E5%B9%B4%E4%BF%AE%E8%AA%B2%E5%BF%83%E5%BE%97-f3e6e61a9a42
// 孫凡耕 申請美國EE/CS PhD經驗分享(1)-總結、感想 https://medium.com/@sunfankeng/%E7%94%B3%E8%AB%8B%E7%BE%8E%E5%9C%8Bee-cs-phd%E7%B6%93%E9%A9%97%E5%88%86%E4%BA%AB-%E7%B8%BD%E7%B5%90-%E6%84%9F%E6%83%B3-%E6%84%9F%E8%AC%9D-959b8eccc3f0
// 張博智 走點彎路的碩士申請(一):背景、動機 https://primesnow.medium.com/%E8%B5%B0%E9%BB%9E%E5%BD%8E%E8%B7%AF%E7%9A%84%E7%A2%A9%E5%A3%AB%E7%94%B3%E8%AB%8B-%E4%B8%80-%E8%83%8C%E6%99%AF-%E5%8B%95%E6%A9%9F-2260c537b520

// B04
// 莫絲羽 CMU Robotics MS 申請美國機器人相關碩士經驗分享 https://medium.com/momo%E7%9A%84%E6%A9%9F%E5%99%A8%E4%BA%BA%E7%95%99%E5%AD%B8%E5%A4%A2/%E7%94%B3%E8%AB%8B%E7%BE%8E%E5%9C%8B%E6%A9%9F%E5%99%A8%E4%BA%BA%E7%9B%B8%E9%97%9C%E7%A2%A9%E5%A3%AB%E5%BF%83%E5%BE%97%E5%88%86%E4%BA%AB-d85a519b1974
// 吳倉永 2020 Fall 申請美國硬體 MS/MEng https://tywu13.medium.com/2020-fall-%E7%94%B3%E8%AB%8B%E7%BE%8E%E5%9C%8B%E7%A1%AC%E9%AB%94-ms-meng-4fee92a73bec, 2020 COVID19 北美找工作心得分享 https://tywu13.medium.com/2020-covid19-%E5%8C%97%E7%BE%8E%E6%89%BE%E5%B7%A5%E4%BD%9C%E5%BF%83%E5%BE%97%E5%88%86%E4%BA%AB-685731a4cda, 美國硬體工程師必勝面經 https://tywu13.medium.com/%E7%BE%8E%E5%9C%8B%E7%A1%AC%E9%AB%94%E5%B7%A5%E7%A8%8B%E5%B8%AB%E5%BF%85%E5%8B%9D%E9%9D%A2%E7%B6%93-c1a7423a9498

// B05
// 許秉倫 Open Source 開源社群的第一門課 | 如何成為 Apache Committer https://byronhsu1230.medium.com/open-source-%E9%96%8B%E6%BA%90%E7%A4%BE%E7%BE%A4%E7%9A%84%E7%AC%AC%E4%B8%80%E9%96%80%E8%AA%B2-%E5%A6%82%E4%BD%95%E6%88%90%E7%82%BA-apache-committer-451d42e853d6

// B06
// MikeWang 2022 Fall US CS Master 申請心得 https://medium.com/@mike_tcwang/2022-fall-us-cs-master-%E7%94%B3%E8%AB%8B%E5%BF%83%E5%BE%97-b0f9ccb23196?mibextid=Zxz2cZ

const Medium = () => {
const mediums = {
B03: [
Expand Down Expand Up @@ -139,6 +120,15 @@ const Medium = () => {
},
],
},
{
name: '謝承延',
materials: [
{
title: '北美CS申請: A Complete Guide to Enter Top CS Schools 申請心得',
link: 'https://medium.com/@chengyenhsieh0806/%E5%8C%97%E7%BE%8Ecs%E7%94%B3%E8%AB%8B-a-complete-guide-to-enter-top-cs-schools-66ea80396a4b',
},
],
},
],
}
const [visibles, setVisibles] = useState({
Expand Down
15 changes: 15 additions & 0 deletions client/src/views/in/profile/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@ const Profile = () => {
</CCol>
</CRow>
<hr className="mt-1 mb-3" />
<CRow>
<CCol sm="3" className="px-4">
<h6 className="mb-0 ">Advising Professor</h6>
</CCol>
<CCol sm="9" className="text-secondary">
{data.advisingProfessor.map((item, index) => {
return index === data.advisingProfessor.length - 1 ? (
<span key={index}>{item.value}</span>
) : (
<span key={index}>{item.value}</span>
)
})}
</CCol>
</CRow>
<hr className="mt-1 mb-3" />
</CCardBody>
</CCard>
<CRow>
Expand Down
Loading

0 comments on commit 94bd3af

Please sign in to comment.