@adriansteffan/reactive 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{mod-CnN_S4je.js → mod-DBeKCZPw.js} +1263 -1253
- package/dist/mod.d.ts +12 -3
- package/dist/reactive.es.js +1 -1
- package/dist/reactive.umd.js +30 -30
- package/dist/{web-VTeCNj5V.js → web-Cn7aXqsT.js} +1 -1
- package/dist/{web-BcQhbLeU.js → web-D2WVWjaK.js} +1 -1
- package/package.json +1 -1
- package/src/components/enterfullscreen.tsx +3 -0
- package/src/components/prolificending.tsx +5 -2
- package/src/components/upload.tsx +22 -10
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ export default function EnterFullscreen({
|
|
|
15
15
|
buttonText,
|
|
16
16
|
className,
|
|
17
17
|
containerClass,
|
|
18
|
+
animate,
|
|
18
19
|
next,
|
|
19
20
|
data,
|
|
20
21
|
updateStore,
|
|
@@ -25,6 +26,7 @@ export default function EnterFullscreen({
|
|
|
25
26
|
buttonText?: string;
|
|
26
27
|
className?: string;
|
|
27
28
|
containerClass?: string;
|
|
29
|
+
animate?: boolean;
|
|
28
30
|
delayMs?: number;
|
|
29
31
|
} & BaseComponentProps) {
|
|
30
32
|
const contentWrap = (
|
|
@@ -137,6 +139,7 @@ export default function EnterFullscreen({
|
|
|
137
139
|
updateStore={updateStore}
|
|
138
140
|
className={className}
|
|
139
141
|
containerClass={containerClass}
|
|
142
|
+
animate={animate}
|
|
140
143
|
content={contentWrap}
|
|
141
144
|
buttonText={buttonText ?? 'Enter Fullscreen Mode'}
|
|
142
145
|
next={handleEnterFullscreenClick}
|
|
@@ -12,9 +12,12 @@ registerComponentParams('ProlificEnding', [
|
|
|
12
12
|
|
|
13
13
|
export default function ProlificEnding({
|
|
14
14
|
prolificCode,
|
|
15
|
+
className,
|
|
16
|
+
containerClass,
|
|
17
|
+
animate,
|
|
15
18
|
data,
|
|
16
19
|
updateStore
|
|
17
|
-
}: { prolificCode?: string } & BaseComponentProps) {
|
|
20
|
+
}: { prolificCode?: string; className?: string; containerClass?: string; animate?: boolean } & BaseComponentProps) {
|
|
18
21
|
let prolificCodeUsed = prolificCode ?? getParam('cc', '', 'string') ?? null;
|
|
19
22
|
|
|
20
23
|
const content = (
|
|
@@ -37,5 +40,5 @@ export default function ProlificEnding({
|
|
|
37
40
|
</div>
|
|
38
41
|
);
|
|
39
42
|
|
|
40
|
-
return <Text data={data} updateStore={updateStore} content={content} buttonText='' next={() => {}} />;
|
|
43
|
+
return <Text data={data} updateStore={updateStore} className={className} containerClass={containerClass} animate={animate} content={content} buttonText='' next={() => {}} />;
|
|
41
44
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { useMutation } from '@tanstack/react-query';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
import { post } from '../utils/request';
|
|
@@ -228,6 +228,11 @@ export default function Upload({
|
|
|
228
228
|
uploadRaw = true,
|
|
229
229
|
autoUpload = false,
|
|
230
230
|
androidFolderName,
|
|
231
|
+
className,
|
|
232
|
+
containerClass,
|
|
233
|
+
content,
|
|
234
|
+
uploadingContent,
|
|
235
|
+
errorContent,
|
|
231
236
|
}: BaseComponentProps & {
|
|
232
237
|
sessionID?: string | null;
|
|
233
238
|
generateFiles?: (sessionID: string, data: TrialData[], store?: Store) => FileUpload[];
|
|
@@ -235,6 +240,11 @@ export default function Upload({
|
|
|
235
240
|
uploadRaw?: boolean;
|
|
236
241
|
autoUpload?: boolean;
|
|
237
242
|
androidFolderName?: string;
|
|
243
|
+
className?: string;
|
|
244
|
+
containerClass?: string;
|
|
245
|
+
content?: React.ReactNode;
|
|
246
|
+
uploadingContent?: React.ReactNode;
|
|
247
|
+
errorContent?: React.ReactNode;
|
|
238
248
|
}) {
|
|
239
249
|
const [uploadState, setUploadState] = useState<'initial' | 'uploading' | 'success' | 'error'>(
|
|
240
250
|
'initial',
|
|
@@ -370,12 +380,11 @@ export default function Upload({
|
|
|
370
380
|
}, [uploadState]);
|
|
371
381
|
|
|
372
382
|
return (
|
|
373
|
-
<div className=
|
|
383
|
+
<div className={`min-h-screen ${containerClass ?? ''}`}>
|
|
384
|
+
<div className={`flex flex-col items-center justify-center gap-4 p-6 text-xl mt-16 px-10 ${className ?? ''}`}>
|
|
374
385
|
{uploadState == 'initial' && !autoUpload && (
|
|
375
386
|
<>
|
|
376
|
-
<p
|
|
377
|
-
Thank you for participating! Please click the button below to submit your data.
|
|
378
|
-
</p>
|
|
387
|
+
{content ?? <p>Thank you for participating! Please click the button below to submit your data.</p>}
|
|
379
388
|
<button
|
|
380
389
|
onClick={handleUpload}
|
|
381
390
|
className='mt-8 cursor-pointer bg-white px-8 py-3 border-2 border-black font-bold text-black text-lg rounded-xl shadow-[2px_2px_0px_rgba(0,0,0,1)] hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none'
|
|
@@ -386,18 +395,20 @@ export default function Upload({
|
|
|
386
395
|
)}
|
|
387
396
|
{uploadState == 'uploading' && (
|
|
388
397
|
<>
|
|
389
|
-
|
|
390
|
-
|
|
398
|
+
{uploadingContent ?? <>
|
|
399
|
+
<div className='w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin'></div>
|
|
400
|
+
<p>Uploading your data...</p>
|
|
401
|
+
</>}
|
|
391
402
|
</>
|
|
392
403
|
)}
|
|
393
404
|
{uploadState == 'success' && <></>}
|
|
394
405
|
|
|
395
406
|
{uploadState == 'error' && (
|
|
396
407
|
<>
|
|
397
|
-
<div className='text-red-500 mb-4'>
|
|
398
|
-
<p
|
|
408
|
+
{errorContent ?? <div className='text-red-500 mb-4'>
|
|
409
|
+
<p>Sorry, there was an error uploading your data.</p>
|
|
399
410
|
<p>Please try again or contact the researcher.</p>
|
|
400
|
-
</div>
|
|
411
|
+
</div>}
|
|
401
412
|
<button
|
|
402
413
|
onClick={handleUpload}
|
|
403
414
|
className='cursor-pointer bg-white px-8 py-3 border-2 border-black font-bold text-black text-lg rounded-xl shadow-[2px_2px_0px_rgba(0,0,0,1)] hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-none'
|
|
@@ -407,5 +418,6 @@ export default function Upload({
|
|
|
407
418
|
</>
|
|
408
419
|
)}
|
|
409
420
|
</div>
|
|
421
|
+
</div>
|
|
410
422
|
);
|
|
411
423
|
}
|