Skip to content

Commit

Permalink
More feedback cos he hates me
Browse files Browse the repository at this point in the history
  • Loading branch information
faucomte97 committed Oct 18, 2024
1 parent 5917439 commit acc2adf
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/components/StudentCredentialsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const StudentCredentialsPDF: FC<{
padding: 20,
},
text: {
textAlign: "justify",
marginBottom: 5,
fontSize: 12,
},
Expand All @@ -73,19 +74,17 @@ const StudentCredentialsPDF: FC<{
style={pdfStyles.image}
/>
<View>
{/*TODO: Auto login link is too long and doesn't fit in PDF.*/}
{/*TODO: Improve overall styles for this.*/}
<Text style={pdfStyles.text}>
Directly log in with{" "}
Directly log in with:{"\n"}
{makeAutoLoginLink(classLoginLink, student)}
</Text>
<Text style={pdfStyles.text}>
OR class link: {classLoginLink}
</Text>
<Text style={pdfStyles.text}>
Name: {student.user.first_name}
</Text>
<Text style={pdfStyles.text}>
Password: {student.user.password}
Name: {student.user.first_name} Password:{" "}
{student.user.password}
</Text>
</View>
</View>
Expand Down Expand Up @@ -148,11 +147,18 @@ const DownloadCSVButton: FC<DownloadButtonProps> = ({
students,
}) => {
const generateCSV: () => string = () => {
let csvContent = "Name,Password,Class Link,Login URL\n"
const lines = [["Name", "Password", "Class Link", "Login URL"].join(",")]
students.forEach(student => {
csvContent += `${student.user.first_name},${student.user.password},${classLoginLink},${makeAutoLoginLink(classLoginLink, student)}\n`
lines.push(

Check warning on line 152 in src/components/StudentCredentialsTable.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/StudentCredentialsTable.tsx#L149-L152

Added lines #L149 - L152 were not covered by tests
[
student.user.first_name,
student.user.password,
classLoginLink,
makeAutoLoginLink(classLoginLink, student),
].join(","),
)
})
return csvContent
return lines.join("\n")

Check warning on line 161 in src/components/StudentCredentialsTable.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/StudentCredentialsTable.tsx#L161

Added line #L161 was not covered by tests
}
const linkRef = useRef<HTMLAnchorElement | null>(null)

Check warning on line 163 in src/components/StudentCredentialsTable.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/StudentCredentialsTable.tsx#L163

Added line #L163 was not covered by tests

Expand Down

0 comments on commit acc2adf

Please sign in to comment.