Skip to content

Commit ae6282b

Browse files
committed
added org links on home page and removed add button on upload
1 parent 4d1acd3 commit ae6282b

File tree

3 files changed

+53
-11
lines changed

3 files changed

+53
-11
lines changed

src/components/FileUpload/FileUpload.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import FileViewer from '../FileViewer/FileViewer';
1010
import { useSetLoadingScreen } from '../../providers/LoadingScreenProvider';
1111
import Organization from '../../types/Organization';
1212
import Icon from '../Icon/Icon';
13+
import Logger from '../../utils/Logger';
1314

1415
interface Props {
1516
organizationProp: Organization | undefined;
@@ -34,14 +35,18 @@ function FileUpload({ organizationProp, afterUpload }: Props) {
3435
const selectedFiles = event.target.files;
3536
if (selectedFiles === null) return;
3637
setstagedFiles([...selectedFiles, ...Array.from(stagedFiles)]);
38+
setTimeout(() => {
39+
addFile([...selectedFiles, ...Array.from(stagedFiles)]);
40+
}, 300);
3741
};
3842

39-
const addFile = (force: boolean = false) => {
40-
if (stagedFiles.length === 0) {
43+
const addFile = (zfiles: File[], force: boolean = false) => {
44+
if (zfiles.length === 0) {
45+
Logger.log('No files to add');
4146
return;
4247
}
4348
if (!force) {
44-
for (const stagedFile of stagedFiles) {
49+
for (const stagedFile of zfiles) {
4550
for (const file of files) {
4651
if (
4752
file.name === stagedFile.name &&
@@ -51,7 +56,7 @@ function FileUpload({ organizationProp, afterUpload }: Props) {
5156
showChoiceNotification(
5257
'File upload',
5358
`The file ${stagedFile.name} is already in the list. Do you want to add it anyway?`,
54-
() => addFile(true),
59+
() => addFile(zfiles, true),
5560
() => {},
5661
'Yes',
5762
'No'
@@ -62,13 +67,13 @@ function FileUpload({ organizationProp, afterUpload }: Props) {
6267
}
6368
}
6469

65-
setFiles([...files, ...stagedFiles]);
70+
setFiles([...files, ...zfiles]);
6671
setstagedFiles([]);
6772
};
6873

69-
const discardFiles = () => {
74+
/* const discardFiles = () => {
7075
setstagedFiles([]);
71-
};
76+
}; */
7277

7378
const removeFile = (index: number) => {
7479
const newFiles = [...files];
@@ -166,14 +171,14 @@ function FileUpload({ organizationProp, afterUpload }: Props) {
166171
multiple={true}
167172
/>
168173
</div>
169-
<div className="hor mb">
174+
{/* <div className="hor mb">
170175
<button className="btn" onClick={() => addFile()}>
171176
Add
172177
</button>
173178
<button className="btn" onClick={discardFiles}>
174179
Discard
175180
</button>
176-
</div>
181+
</div> */}
177182
{files.map((file, index) => (
178183
<li className="file" key={index}>
179184
<div className="dot"></div>

src/views/Home/Home.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
.helpIcon {
99
margin-left: 10px;
1010
}
11+
h2 {
12+
margin-top: 70px;
13+
}
1114
}
1215

1316
.userStudy {

src/views/Home/Home.tsx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function Home() {
3838
Hi {username.slice(0, -2)}
3939
<span className="db">{username.slice(-2)}</span> 👋
4040
</h1>
41-
<div className="userStudy">
41+
{/* <div className="userStudy">
4242
<h2>User Study</h2>
4343
<p>
4444
<b>
@@ -67,13 +67,47 @@ function Home() {
6767
and download the file manually.
6868
</i>
6969
</p>
70-
</div>
70+
</div> */}
7171
<h2>
7272
T<span className="db">ip</span>
7373
</h2>
7474
<p>
7575
<i>{getRandomTip()}</i>
7676
</p>
77+
<h2>
78+
<span className="db">Or</span>ganization
79+
</h2>
80+
<p>
81+
You can view your organizations{' '}
82+
<span
83+
onClick={() => {
84+
navigate('/profile');
85+
}}
86+
style={{
87+
cursor: 'pointer',
88+
textDecoration: 'underline',
89+
}}
90+
>
91+
here
92+
</span>
93+
.
94+
</p>
95+
<p>
96+
Or you can create a new organization{' '}
97+
<span
98+
onClick={() => {
99+
navigate('/organization/create');
100+
}}
101+
style={{
102+
cursor: 'pointer',
103+
textDecoration: 'underline',
104+
}}
105+
>
106+
here
107+
</span>
108+
.
109+
</p>
110+
77111
<h2>
78112
Document <span className="db">Up</span>load{' '}
79113
<i

0 commit comments

Comments
 (0)