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

Post dev #52

Merged
merged 25 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
58a3b07
add prototype of Post section
cuttle-fish-my Mar 14, 2024
1123965
finished the main part of post
cuttle-fish-my Mar 15, 2024
48aca81
Add CV/SoP button to applicant profile
Mar 15, 2024
23f4974
add `type` key in request body of add_post
cuttle-fish-my Mar 15, 2024
a98f171
Fix a bug
Mar 15, 2024
7cffd33
add download button for cv and sop
cuttle-fish-my Mar 15, 2024
ee11414
Merge remote-tracking branch 'origin/post-dev' into post-dev
cuttle-fish-my Mar 15, 2024
ac48e3f
Add cv/sop upload in addmodifyapplicant
Mar 16, 2024
638c749
Add searchbar to post page
Mar 16, 2024
697a7fa
Fix a bug in SoP
Mar 16, 2024
baa8f48
now the searchBar in post session can search authors
cuttle-fish-my Mar 16, 2024
a1e0a22
fix bug in post searching
cuttle-fish-my Mar 16, 2024
3ef8c2a
fix bug in post searching
cuttle-fish-my Mar 16, 2024
6c35f3e
fix bug in post searching
cuttle-fish-my Mar 16, 2024
036ceb6
change user guide layout
Mar 16, 2024
d8f3bf6
change user guide layout a little bit, to be done
Mar 17, 2024
0765aba
fix bugs in PostData
cuttle-fish-my Mar 17, 2024
899e68c
adjust the layout of HowToUse.jsx
cuttle-fish-my Mar 17, 2024
45f2115
adjust the post content layout
cuttle-fish-my Mar 17, 2024
9efeb55
adjust the post content layout
cuttle-fish-my Mar 17, 2024
554224c
Fix CV & SoP bug
Mar 17, 2024
b161278
adjust the post content layout
cuttle-fish-my Mar 17, 2024
66c6acf
Merge remote-tracking branch 'origin/post-dev' into post-dev
cuttle-fish-my Mar 17, 2024
00ec3eb
Merge branch 'dev' into post-dev
boynextdoor-cze Mar 17, 2024
9c85b71
Fix a bug
Mar 17, 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: 5 additions & 0 deletions src/APIs/APIs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ export const GET_METADATA = ROOT + "api/user/get_metadata";
export const GET_AVATAR = ROOT + "api/user/get_avatar";
export const TOGGLE_NICKNAME = ROOT + "api/my/toggle_nickname";
export const UPDATE_CONTACT = ROOT + "api/user/update_contact";
export const POST_LIST = ROOT + "api/list/posts";
export const GET_POST_CONTENT = ROOT + "api/query/post_content";
export const REMOVE_POST = ROOT + "api/mutating/remove_post";
export const ADD_POST = ROOT + "api/mutating/new_post";
export const MODIFY_POST = ROOT + "api/mutating/modify_post";
10 changes: 10 additions & 0 deletions src/Components/Admin/AdminEmail/AdminEmailPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import RestoreFromTrashIcon from '@mui/icons-material/RestoreFromTrash';
import DeleteForeverIcon from '@mui/icons-material/DeleteForever';
import {useState} from "react";
import {TimeTick2String} from "../../../Data/Common";

Check warning on line 17 in src/Components/Admin/AdminEmail/AdminEmailPage.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import {TimeTick2String} from "../../../Data/Common";

Check warning on line 17 in src/Components/Admin/AdminEmail/AdminEmailPage.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import {TimeTick2String} from "../../../Data/Common";

export async function loader() {
const inboxes = await getEmailList('inbox');
Expand Down Expand Up @@ -135,6 +136,15 @@
width: "30%",
justifyContent: 'flex-end'
}}>{
// TimeTick2String(email.time, {
// hour12: false,
// year: 'numeric',
// month: '2-digit',
// day: '2-digit',
// hour: '2-digit',
// minute: '2-digit',
// second: '2-digit'
// })
new Date(email.time).toDateString()
.toLocaleString('en-US', {
hour12: false,
Expand Down
4 changes: 2 additions & 2 deletions src/Components/DataPoints/DataPoints.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export function DataGrid({records, insideProgramPage, style = {}}) {
filter={!insideProgramPage}
filterPlaceholder="搜索项目"
className="ProgramIDColumn"
style={{minWidth: '12rem'}}
style={{width: '10rem'}}
/>}
<Column
field='Status'
Expand Down Expand Up @@ -310,7 +310,7 @@ export function DataGrid({records, insideProgramPage, style = {}}) {
filterPlaceholder="搜索申请季"
body={programPeriodBodyTemplate}
className="SeasonColumn"
style={{minWidth: '8rem'}}
style={{width: '7rem'}}
/>
<Column
field='TimeLine.Decision'
Expand Down
14 changes: 7 additions & 7 deletions src/Components/Errors/ErrorPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ export default function ErrorPage() {
</p>
))}
</div>
{/*<div className="error-stack">*/}
{/* {stackLines.map((line, index) => (*/}
{/* <p key={index} className="stack-line">*/}
{/* <small>{line}</small>*/}
{/* </p>*/}
{/* ))}*/}
{/*</div>*/}
<div className="error-stack">
{stackLines.map((line, index) => (
<p key={index} className="stack-line">
<small>{line}</small>
</p>
))}
</div>
</div>
);
}
217 changes: 128 additions & 89 deletions src/Components/HowToUse/HowToUse.jsx
Original file line number Diff line number Diff line change
@@ -1,123 +1,162 @@
import {
Accordion,
AccordionDetails,
AccordionSummary, Button, Dialog, DialogActions,
AccordionSummary, Box, Button, Dialog, DialogActions,
DialogContent,
DialogContentText,
DialogTitle, ListItem, ListItemButton
DialogTitle, Divider, ListItem, ListItemButton, Paper, Typography

Check warning on line 7 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import specifier Paper

Check warning on line 7 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import specifier Paper
} from "@mui/material";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
import React, {useState} from "react";
import profile from "../../Assets/imgs/profile.png";

Check warning on line 11 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import profile from "../../Assets/imgs/profile.png";

Check warning on line 11 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import profile from "../../Assets/imgs/profile.png";
import applicant from "../../Assets/imgs/applicant.png";

Check warning on line 12 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import applicant from "../../Assets/imgs/applicant.png";

Check warning on line 12 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import applicant from "../../Assets/imgs/applicant.png";
import newApplicant from "../../Assets/imgs/new-applicant.png";

Check warning on line 13 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import newApplicant from "../../Assets/imgs/new-applicant.png";

Check warning on line 13 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import newApplicant from "../../Assets/imgs/new-applicant.png";
import record from "../../Assets/imgs/record.png";

Check warning on line 14 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import record from "../../Assets/imgs/record.png";

Check warning on line 14 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import record from "../../Assets/imgs/record.png";
import program from "../../Assets/imgs/program.png";

Check warning on line 15 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import program from "../../Assets/imgs/program.png";

Check warning on line 15 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused import

Unused import program from "../../Assets/imgs/program.png";
import {Link, useLoaderData, useNavigate} from "react-router-dom";
import {Link as MuiLink} from '@mui/material';
import PersonOutlineIcon from "@mui/icons-material/PersonOutline";
import Grid2 from "@mui/material/Unstable_Grid2";
import {BoldTypography} from "../common";


export function HowToUse() {
const loaderData = useLoaderData();
return (
<div style={{width: '90%'}}>
<h1 style={{textAlign: 'center'}}>OpenSIST使用指南</h1>
<Box sx={{p: '1rem'}}>
<BoldTypography variant="h4" sx={{textAlign: 'center'}}>OpenSIST使用指南</BoldTypography>
<Graduated loaderData={loaderData}/>
<Current/>
</div>
</Box>
)
}

export function GuidanceGrid({Index, TitlePrime, TitleSecond, Content, ButtonLink, ButtonContent}) {
return (
<Grid2 xs={12} sm={6} md={6} xl={3}
sx={{
display: 'flex',
flexDirection: 'column',
gap: '3rem',
justifyContent: 'space-between'
}}
>
<Box sx={{display: 'flex', flexDirection: "column", gap: "1.5rem"}}>
<BoldTypography variant="h5">{Index}.</BoldTypography>
<Box>
<BoldTypography variant='h6'
sx={{color: (theme) => theme.palette.mode === 'dark' ? "#fff" : "#000"}}>
{TitlePrime}
</BoldTypography>
<BoldTypography variant='h6'
sx={{color: (theme) => theme.palette.mode === 'dark' ? "#fff" : "#000"}}>
{TitleSecond}
</BoldTypography>
</Box>
<Typography>{Content}</Typography>
</Box>
<Button component={Link} to={ButtonLink} variant='contained'>
{`${ButtonContent}`}
</Button>
</Grid2>

)

}

function Graduated({loaderData}) {
const applicantIDs = loaderData.metaData.ApplicantIDs;
const [open, setOpen] = useState(false);
const navigate = useNavigate();

Check warning on line 70 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused local symbol

Unused constant navigate

Check warning on line 70 in src/Components/HowToUse/HowToUse.jsx

View workflow job for this annotation

GitHub Actions / qodana

Unused local symbol

Unused constant navigate
return (
<Accordion sx={{bgcolor: '#448aff1a'}}>
<AccordionSummary
expandIcon={<ArrowDropDownIcon/>}
>
<h2 style={{margin: 0}}><b>毕业生或大四研三请阅读:</b></h2>
</AccordionSummary>
<AccordionDetails>
<h3><b>我来这个网站应该干什么?</b></h3>
<h5><b>为了给SIST学弟学妹们提供更多海外申请的信息,我们希望你能抽出宝贵的15分钟,做三件事情:</b></h5>
<ol>
<li>
<b>贡献自己申请时的背景(可选匿名)</b>。考虑到有的人也许会有多于一年的申请经历,因此每个用户可添加多个申请人,以申请年份作区分。
</li>
<li>
<b>尽可能多地贡献自己的申请记录</b>,也就是你申请的各个项目的admit/reject的结果,最终呈现出来的就像在一亩三分地或opencs上浏览申请结果一样。
</li>
<li>
<b>贡献海外高校graduate program信息</b>,如果你对某些项目有着很深入的了解,我们希望你把你了解到的给写上,这样能为学弟学妹们提供更多insight。
</li>
</ol>
<h3><b>上面说的这三件事该咋做?</b></h3>
<h5>我们在下方提供了详细的图文教程,但是——</h5>
<h4><b><i>如果您懒得读和申请人相关的详细教程,可以直接前往<MuiLink
href='/profile/new-applicant'>添加申请人</MuiLink>。</i></b></h4>
<h4>
<b><i>
添加完申请人之后,可为该申请人<MuiLink onClick={() => setOpen(true)} style={{cursor: 'pointer'}}>添加申请记录</MuiLink>。
</i></b>
</h4>
<h4><b><i>如果您觉得项目信息表的教程也太长,可以直接移步<MuiLink href='/programs'>项目信息表</MuiLink>。</i></b>
</h4>
<Dialog open={open} onClose={() => {
setOpen(false);
}}>
<DialogTitle>请选择要添加记录的申请人</DialogTitle>
<DialogContent>
{applicantIDs.length > 0 ? applicantIDs.map((applicantID, index) => {
return (
<ListItem key={index}>
<ListItemButton
sx={{justifyContent: 'center'}}
onClick={() => {
navigate(`/profile/new-record`, { state: {applicantID: applicantID, from: window.location.pathname } })
}}
>
<PersonOutlineIcon/> {applicantID}
</ListItemButton>
</ListItem>
)
}) : <DialogContentText>您还没有申请人,请先添加申请人信息</DialogContentText>}
</DialogContent>
<DialogActions>
<Button onClick={() => {
setOpen(false);
}}>
取消
</Button>
</DialogActions>
</Dialog>
<h3><b>申请人信息和申请记录的添加和修改:</b></h3>
<ol style={{paddingLeft: '1rem'}}>
<li>点击右上角头像,在下拉菜单中选择Profile。</li>
<li>
在Profile页面,下图介绍了该页面的一些按钮功能,你也可以阅读页面右侧使用指南来获取更详细的信息。
<img src={profile} alt='profile' width='100%'/>
</li>
<li>
点击左侧“添加申请人”按钮,可以在右侧界面填写你的申请人信息。
<img src={newApplicant} alt='new-applicant' width='100%'/>
</li>
<li>
添加完申请人信息后,你可以打开自己的申请人信息页,添加自己的申请记录。
<img src={applicant} alt='applicant' width='100%'/>
<img src={record} alt='add-modify-record' width='100%'/>
</li>
</ol>
<h3><b>海外graduate program的添加和修改:</b></h3>
<ol style={{paddingLeft: '1rem'}}>
<li>点击顶部导航栏的“项目信息表”按钮,即可前往查看各个项目。使用前请先阅读该页面的使用指南。</li>
<li>下图展示了该页面的项目添加和修改功能:</li>
<img src={program} alt='program' width='100%'/>
</ol>
</AccordionDetails>
</Accordion>
<Box sx={{display: 'flex', flexDirection: 'column', gap: "2rem", m: '2rem'}}>
<BoldTypography variant="h5">我来这个网站应该干什么?</BoldTypography>
<BoldTypography variant="subtitl1">
为了给SIST学弟学妹们提供更多海外申请的信息,我们希望你能抽出宝贵的一点时间,按个人意愿来做至多四件事情:
</BoldTypography>
<Divider variant='middle'/>
<Grid2 container columnSpacing={7} rowSpacing={3}>
<GuidanceGrid
Index={1}
TitlePrime='填写申请时的'
TitleSecond='个人背景(可匿名)'
Content='考虑到有的人也许会有多于一年的申请经历,因此每个用户可添加多个申请人,以申请年份作区分'
ButtonLink='/profile/new-applicant'
ButtonContent='添加申请人'
/>
<GuidanceGrid
Index={2}
TitlePrime='填写申请项目'
TitleSecond='admit/reject的情况'
Content='尽可能多地填写自己的申请记录,也就是你申请的各个项目的admit/reject的结果'
ButtonLink='/profile/new-record'
ButtonContent='添加申请记录'
/>
<GuidanceGrid
Index={3}
TitlePrime='分享你所了解的'
TitleSecond='海外硕博项目细节'
Content='如果你对某些项目有着很深入的了解,我们希望你能够把你所了解的内容进行分享,为学弟学妹们提供更多insight'
ButtonLink='/programs/new'
ButtonContent='添加项目信息'
/>
<GuidanceGrid
Index={4}
TitlePrime='在本站'
TitleSecond='分享你的申请经验'
Content='在本站发布申请分享帖,分享你申请过程中的心得体会,包括但不限于选校、套磁、申请总结等方面'
ButtonLink='/posts/new'
ButtonContent='添加申请分享帖'
/>
</Grid2>
<Dialog open={open} onClose={() => {
setOpen(false);
}}>
<DialogTitle>请选择要添加记录的申请人</DialogTitle>
<DialogContent>
{applicantIDs.length > 0 ? applicantIDs.map((applicantID, index) => {
return (
<ListItem key={index}>
<ListItemButton component={Link} to={`/profile/${applicantID}/new-record`}
sx={{justifyContent: 'center'}}>
<PersonOutlineIcon/> {applicantID}
</ListItemButton>
</ListItem>
)
}) : <DialogContentText>您还没有申请人,请先添加申请人信息</DialogContentText>}
</DialogContent>
<DialogActions>
<Button onClick={() => {
setOpen(false);
}}>
取消
</Button>
</DialogActions>
</Dialog>
{/*<h3><b>申请人信息和申请记录的添加和修改:</b></h3>*/}
{/*<ol style={{paddingLeft: '1rem'}}>*/}
{/* <li>点击右上角头像,在下拉菜单中选择Profile。</li>*/}
{/* <li>*/}
{/* 在Profile页面,下图介绍了该页面的一些按钮功能,你也可以阅读页面右侧使用指南来获取更详细的信息。*/}
{/* <img src={profile} alt='profile' width='100%'/>*/}
{/* </li>*/}
{/* <li>*/}
{/* 点击左侧“添加申请人”按钮,可以在右侧界面填写你的申请人信息。*/}
{/* <img src={newApplicant} alt='new-applicant' width='100%'/>*/}
{/* </li>*/}
{/* <li>*/}
{/* 添加完申请人信息后,你可以打开自己的申请人信息页,添加自己的申请记录。*/}
{/* <img src={applicant} alt='applicant' width='100%'/>*/}
{/* <img src={record} alt='add-modify-record' width='100%'/>*/}
{/* </li>*/}
{/*</ol>*/}
{/*<h3><b>海外graduate program的添加和修改:</b></h3>*/}
{/*<ol style={{paddingLeft: '1rem'}}>*/}
{/* <li>点击顶部导航栏的“项目信息表”按钮,即可前往查看各个项目。使用前请先阅读该页面的使用指南。</li>*/}
{/* <li>下图展示了该页面的项目添加和修改功能:</li>*/}
{/* <img src={program} alt='program' width='100%'/>*/}
{/*</ol>*/}
</Box>
)
}

Expand Down
Loading
Loading