From b34d1d9dfbe379d2f1397b0d2503ec73c4fd9a0d Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Wed, 25 May 2022 23:30:16 -0500 Subject: rough in Share components --- src/web/src/components/System/Shares/Share.js | 25 ++++++++ src/web/src/components/System/Shares/index.js | 82 +++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 src/web/src/components/System/Shares/Share.js create mode 100644 src/web/src/components/System/Shares/index.js (limited to 'src') diff --git a/src/web/src/components/System/Shares/Share.js b/src/web/src/components/System/Shares/Share.js new file mode 100644 index 00000000..eadcd07b --- /dev/null +++ b/src/web/src/components/System/Shares/Share.js @@ -0,0 +1,25 @@ +import React from 'react'; + +import { + Item, +} from 'semantic-ui-react'; + +const Share = ({ share = {}, onBrowse } = {}) => { + const { id, remotePath, localPath, mask, alias, isExcluded } = share; + + return ( + + + {remotePath} + Description + +
+            {JSON.stringify({ id, localPath, mask, alias, isExcluded }, null, 2)}
+          
+
+
+
+ ); +}; + +export default Share; \ No newline at end of file diff --git a/src/web/src/components/System/Shares/index.js b/src/web/src/components/System/Shares/index.js new file mode 100644 index 00000000..5f3ae971 --- /dev/null +++ b/src/web/src/components/System/Shares/index.js @@ -0,0 +1,82 @@ +import React, { useState, useEffect } from 'react'; +import { toast } from 'react-toastify'; + +import * as sharesLib from '../../../lib/shares'; +import { LoaderSegment } from '../../Shared'; +import Share from './Share'; + +import { + Modal, + Button, +} from 'semantic-ui-react'; + +const Index = () => { + const [loading, setLoading] = useState(true); + const [shares, setShares] = useState([]); + const [everything, setEverything] = useState(); + const [modal, setModal] = useState(false); + + useEffect(() => { + getAll(); + }, []); + + const getAll = async () => { + try { + setLoading(true); + setShares(await sharesLib.getAll()); + setLoading(false); + } catch (error) { + console.error(error); + toast.error(error?.response?.data ?? error?.message ?? error); + } finally { + setLoading(false); + } + }; + + const browse = async ({ id }) => { + setEverything(await sharesLib.browse({ id })); + setModal(true); + }; + + if (loading) { + return LoaderSegment; + } + + return ( + <> +
+
    + {shares.map(share => ( + browse({ id: share.id })}/> + ))} +
+
+          {JSON.stringify(everything, null, 2)}
+        
+
+ setModal(false)} + style={{ color: 'red' }} + > + Delete Your Account + +
+            {JSON.stringify(everything, null, 2)}
+          
+
+ + + + +
+ + ); +}; + +export default Index; \ No newline at end of file -- cgit v1.2.3