Skip to content

Commit

Permalink
Add Documentation Field for Dev and TPM Portfolios (#503)
Browse files Browse the repository at this point in the history
* add support for documentation for tpm and devs

* prettier

* separate documentation input as component

* remove nullish-colesc

* typo

* update message
  • Loading branch information
andrew032011 authored Sep 26, 2023
1 parent 2a5d4ff commit c84e1cb
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
3 changes: 3 additions & 0 deletions backend/src/types/DataTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export type DBDevPortfolioSubmission = {
member: firestore.DocumentReference;
openedPRs: PullRequestSubmission[];
reviewedPRs: PullRequestSubmission[];
isLate?: boolean;
text?: string;
documentationText?: string;
status: SubmissionStatus;
};

Expand Down
1 change: 1 addition & 0 deletions common-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ interface DevPortfolioSubmission {
reviewedPRs: PullRequestSubmission[];
isLate?: boolean;
text?: string;
documentationText?: string;
status: SubmissionStatus;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ const DetailsTable: React.FC<DevPortfolioDetailsTableProps> = ({ portfolio, isAd
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>Opened PRs</Table.HeaderCell>
<Table.HeaderCell>Reviewed PRs</Table.HeaderCell>
<Table.HeaderCell>Documentation</Table.HeaderCell>
<Table.HeaderCell>Status</Table.HeaderCell>
{sortedSubmissions.some((submission) => submission.text) && (
<Table.HeaderCell></Table.HeaderCell>
Expand Down Expand Up @@ -256,6 +257,7 @@ const SubmissionDetails: React.FC<SubmissionDetailsProps> = ({
prSubmission={submission.reviewedPRs.length > 0 ? submission.reviewedPRs[0] : undefined}
/>
</Table.Cell>
<Table.Cell>{submission.documentationText}</Table.Cell>

{isAdminView ? (
<Table.Cell rowSpan={`${numRows}`}>
Expand Down Expand Up @@ -320,6 +322,7 @@ const SubmissionDetails: React.FC<SubmissionDetailsProps> = ({
prSubmission={i >= remainingReviewedPRs.length ? undefined : remainingReviewedPRs[i]}
/>
</Table.Cell>
<Table.Cell />
{!submission.text ? <div></div> : <></>}
</Table.Row>
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const DevPortfolioForm: React.FC = () => {
const [reviewPRs, setReviewedPRs] = useState(['']);
const [isLoading, setIsLoading] = useState<boolean>(true);
const [text, setText] = useState<string | undefined>(undefined);
const [documentationText, setDocumentationText] = useState<string>('');

useEffect(() => {
refreshDevPortfolios();
Expand Down Expand Up @@ -93,6 +94,11 @@ const DevPortfolioForm: React.FC = () => {
headerMsg: 'Paragraph Submission Empty',
contentMsg: 'Please write something for the paragraph section of the assignment.'
});
} else if (!documentationText) {
Emitters.generalError.emit({
headerMsg: 'Documentation Empty',
contentMsg: 'Please write something for the documentation section of the assignment.'
});
} else if (new Date(latestDeadline) < new Date()) {
Emitters.generalError.emit({
headerMsg: 'The deadline for this dev portfolio has passed',
Expand All @@ -115,6 +121,7 @@ const DevPortfolioForm: React.FC = () => {
status: 'pending'
})),
status: 'pending',
documentationText,
...(text && { text })
};
sendSubmissionRequest(newDevPortfolioSubmission, devPortfolio);
Expand Down Expand Up @@ -180,7 +187,7 @@ const DevPortfolioForm: React.FC = () => {
2. What did the team do the past two weeks?
</p>

<TextArea value={text} onChange={(e) => setText(e.target.value)}></TextArea>
<TextArea value={text} onChange={(e) => setText(e.target.value)} />

<p>
In addition, if you have created and/or reviewed pull requests, please include those
Expand All @@ -205,6 +212,10 @@ const DevPortfolioForm: React.FC = () => {
label="Reviewed Pull Request Github Link:"
isTpm={isTpm}
/>
<DocumentationInput
setDocumentationText={setDocumentationText}
documentationText={documentationText}
/>
</div>
<Message info>
<Message.Header>Please note</Message.Header>
Expand All @@ -230,6 +241,27 @@ const DevPortfolioForm: React.FC = () => {
);
};

const DocumentationInput = ({
documentationText,
setDocumentationText
}: {
documentationText: string;
setDocumentationText: React.Dispatch<React.SetStateAction<string>>;
}) => (
<div>
<label className={styles.bold}>
Documentation: <span className={styles.red_color}>*</span>
</label>
<p>
Please provide a link to at least one piece of documentation you added/updated. If it's
included in the PRs you added above, you may simply write "Documentation located in PR (insert
PR number here)". If you made a separate PR updating documentation in the codebase, please
link that PR here.
</p>
<TextArea value={documentationText} onChange={(e) => setDocumentationText(e.target.value)} />
</div>
);

const PRInputs = ({
prs,
setPRs,
Expand Down

0 comments on commit c84e1cb

Please sign in to comment.