From 317e601aed75497edeae85690ebcc4c728d5f84f Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 10 Jun 2021 16:17:14 +0200 Subject: [PATCH] hide sign up cta when authenticated --- packages/website/src/components/Uploader/Uploader.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/website/src/components/Uploader/Uploader.js b/packages/website/src/components/Uploader/Uploader.js index dadd1c64..8e6343ce 100644 --- a/packages/website/src/components/Uploader/Uploader.js +++ b/packages/website/src/components/Uploader/Uploader.js @@ -10,6 +10,7 @@ import { useDropzone } from "react-dropzone"; import { SkynetClient } from "skynet-js"; import { useTimeoutFn } from "react-use"; import ms from "ms"; +import useAuthenticatedStatus from "../../services/useAuthenticatedStatus"; import Link from "../Link"; const getFilePath = (file) => file.webkitRelativePath || file.path || file.name; @@ -147,6 +148,9 @@ const Uploader = () => { const [mode, setMode] = React.useState("file"); const [files, setFiles] = React.useState([]); + const { data: authenticationStatus } = useAuthenticatedStatus(); + const authenticated = authenticationStatus?.authenticated ?? false; + const handleDrop = async (acceptedFiles) => { if (mode === "directory" && acceptedFiles.length) { const rootDir = getRootDirectory(acceptedFiles[0]); // get the file path from the first file @@ -307,7 +311,7 @@ const Uploader = () => { )} - {files.length === 0 && ( + {files.length === 0 && !authenticated && (