feat: combine post and comment uploads into a single file
This commit is contained in:
@@ -58,6 +58,8 @@ const SummaryStats = ({userData, timeData, contentData, summary}: SummaryStatsPr
|
||||
const [selectedUser, setSelectedUser] = useState<string | null>(null);
|
||||
const selectedUserData: User | null = userData?.users.find((u) => u.author === selectedUser) ?? null;
|
||||
|
||||
console.log(summary)
|
||||
|
||||
return (
|
||||
<div style={styles.page}>
|
||||
|
||||
|
||||
@@ -8,20 +8,18 @@ const styles = StatsStyling;
|
||||
|
||||
const UploadPage = () => {
|
||||
let postFile: File | undefined;
|
||||
let commentFile: File | undefined;
|
||||
let topicBucketFile: File | undefined;
|
||||
const [returnMessage, setReturnMessage] = useState('')
|
||||
const navigate = useNavigate()
|
||||
|
||||
const uploadFiles = async () => {
|
||||
if (!postFile || !commentFile || !topicBucketFile) {
|
||||
if (!postFile || !topicBucketFile) {
|
||||
alert('Please upload all files before uploading.')
|
||||
return
|
||||
}
|
||||
|
||||
const formData = new FormData()
|
||||
formData.append('posts', postFile)
|
||||
formData.append('comments', commentFile)
|
||||
formData.append('topics', topicBucketFile)
|
||||
|
||||
try {
|
||||
@@ -44,10 +42,6 @@ const UploadPage = () => {
|
||||
<h2 style={{color: "black" }}>Posts File</h2>
|
||||
<input style={{color: "black" }} type="file" onChange={(e) => postFile = e.target.files?.[0]}></input>
|
||||
</div>
|
||||
<div style={{ ...styles.card }}>
|
||||
<h2 style={{color: "black" }}>Comments File</h2>
|
||||
<input style={{color: "black" }} type="file" onChange={(e) => commentFile = e.target.files?.[0]}></input>
|
||||
</div>
|
||||
<div style={{ ...styles.card }}>
|
||||
<h2 style={{color: "black" }}>Topic Buckets File</h2>
|
||||
<input style={{color: "black" }} type="file" onChange={(e) => topicBucketFile = e.target.files?.[0]}></input>
|
||||
|
||||
Reference in New Issue
Block a user