@adriansteffan/reactive 0.1.16 → 0.1.17

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.
@@ -1,4 +1,4 @@
1
- import { W as e } from "./mod-CnN_S4je.js";
1
+ import { W as e } from "./mod-Da037dsK.js";
2
2
  class s extends e {
3
3
  async enable() {
4
4
  console.log("Immersive mode is only available on Android");
@@ -1,4 +1,4 @@
1
- import { W as P, b as x, E } from "./mod-CnN_S4je.js";
1
+ import { W as P, b as x, E } from "./mod-Da037dsK.js";
2
2
  function m(w) {
3
3
  const e = w.split("/").filter((t) => t !== "."), r = [];
4
4
  return e.forEach((t) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adriansteffan/reactive",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -12,9 +12,11 @@ registerComponentParams('ProlificEnding', [
12
12
 
13
13
  export default function ProlificEnding({
14
14
  prolificCode,
15
+ className,
16
+ containerClass,
15
17
  data,
16
18
  updateStore
17
- }: { prolificCode?: string } & BaseComponentProps) {
19
+ }: { prolificCode?: string; className?: string; containerClass?: string } & BaseComponentProps) {
18
20
  let prolificCodeUsed = prolificCode ?? getParam('cc', '', 'string') ?? null;
19
21
 
20
22
  const content = (
@@ -37,5 +39,5 @@ export default function ProlificEnding({
37
39
  </div>
38
40
  );
39
41
 
40
- return <Text data={data} updateStore={updateStore} content={content} buttonText='' next={() => {}} />;
42
+ return <Text data={data} updateStore={updateStore} className={className} containerClass={containerClass} content={content} buttonText='' next={() => {}} />;
41
43
  }
@@ -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='flex flex-col items-center justify-center gap-4 p-6 text-xl mt-16 px-10'>
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 className=''>
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
- <div className='w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin'></div>
390
- <p className=''>Uploading your data...</p>
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 className=''>Sorry, there was an error uploading your data.</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
  }