From 1feae7564d8284e10e1c4addcad7ad8acac7dc41 Mon Sep 17 00:00:00 2001 From: Vladan Date: Mon, 4 Mar 2024 17:06:35 +0100 Subject: [PATCH 1/6] feat: subscription pods --- package-lock.json | 75 +++++++++----- package.json | 2 +- src/api/files.ts | 23 +++-- src/api/pod.ts | 43 +++++++- .../Buttons/DriveToggle/DriveToggle.tsx | 53 ++++++---- .../Connect/Metamask/MetamaskConnect.tsx | 2 +- .../MetamaskUsernamePassword.tsx | 2 +- .../DirectoryPath/DirectoryPath.tsx | 9 +- .../DriveItemDropdown/DriveItemMenu.tsx | 35 ++++--- .../Dropdowns/PodDropdown/PodDropdownMenu.tsx | 47 ++++++--- .../PodDropdown/PodDropdownToggle.tsx | 12 ++- src/components/Forms/LoginForm/LoginForm.tsx | 2 +- src/components/Inputs/SearchBar/SearchBar.tsx | 4 +- .../CreateFolderModal/CreateFolderModal.tsx | 6 +- .../ImportFileModal/ImportFileModal.tsx | 4 +- .../PreviewFileModal/PreviewFileModal.tsx | 12 ++- .../UploadFileModal/UploadFileModal.tsx | 16 +-- .../DriveActionBar/DriveActionBar.tsx | 6 +- .../DriveActionBar/DriveActionBarMobile.tsx | 52 +++++----- .../DriveActionHeaderMobile.tsx | 3 + .../DriveSideBar/DriveSideBar.tsx | 98 +++++++++++++++---- .../MainNavigationBar/MainNavigationBar.tsx | 4 +- src/context/FdpStorageContext.tsx | 30 +++--- src/context/LocalesContext.tsx | 18 ++-- src/context/PodContext.tsx | 26 ++++- src/data/networks.ts | 24 +++-- src/data/subscription.ts | 21 ++++ src/locales/de-DE.json | 8 +- src/locales/en-US.json | 6 +- src/locales/es-ES.json | 6 +- src/locales/fr-FR.json | 6 +- src/locales/hu-HU.json | 8 +- src/locales/it-IT.json | 6 +- src/locales/{jp-JP.json => ja-JP.json} | 6 +- src/locales/pt-PT.json | 6 +- src/locales/sl-SI.json | 6 +- src/locales/{rs-RS.json => sr-LATN.json} | 6 +- src/locales/tr-TR.json | 6 +- src/locales/{ch-CH.json => zh.json} | 6 +- src/pages/drive/index.tsx | 50 ++++++---- src/utils/ens.ts | 14 ++- src/utils/pod.ts | 17 ++++ 42 files changed, 567 insertions(+), 219 deletions(-) create mode 100644 src/data/subscription.ts rename src/locales/{jp-JP.json => ja-JP.json} (99%) rename src/locales/{rs-RS.json => sr-LATN.json} (99%) rename src/locales/{ch-CH.json => zh.json} (99%) create mode 100644 src/utils/pod.ts diff --git a/package-lock.json b/package-lock.json index 73874493..77d6de1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@emotion/react": "^11.4.1", "@emotion/styled": "^11.3.0", "@fairdatasociety/blossom": "^0.5.0", - "@fairdatasociety/fdp-storage": "^0.13.0", + "@fairdatasociety/fdp-storage": "^0.18.0", "@headlessui/react": "^1.7.14", "@metamask/sdk": "^0.5.6", "@types/react-blockies": "^1.4.1", @@ -3072,29 +3072,41 @@ } }, "node_modules/@fairdatasociety/fdp-contracts-js": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.8.0.tgz", - "integrity": "sha512-Lfr/kxCBZ4IYWwAkeRa2fSi9suYd5DxTG5xunfuwMm32FeB99fL7tI19sb5tjPyRj6bphJPaRWmFCdPJ+yfZsg==", + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.10.1.tgz", + "integrity": "sha512-letk0QcHlv2nNrM7ZF0iazT07IWseM+T0iC9Ax61/dHeR0j/aLkGFv/IiFbMTEXs6xc2iFp+Thoa4x5bmd51Jw==", "peerDependencies": { "ethers": ">=5.6.4" } }, "node_modules/@fairdatasociety/fdp-storage": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.13.0.tgz", - "integrity": "sha512-7AWAC/enq1SQCisMuD3wT5cKSOxe8KdC5f3nolWcruCUpdWcwe65YtjDeL88m/E/kcituQGAl2IgWGkqoysB/g==", + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.18.0.tgz", + "integrity": "sha512-WfBU/IFTcCvJGL6g7V7fW6XX2ZVZ6VUTAMPwH+Gkg7qcA+ra6LHGIidFKWjINNbzs/gHP1DI9oxxTC6XzAlnBQ==", "dependencies": { "@ethersphere/bee-js": "^6.2.0", - "@fairdatasociety/fdp-contracts-js": "^3.8.0", - "crypto-js": "^4.1.1", + "@fairdatasociety/fdp-contracts-js": "^3.10.0", + "crypto-js": "^4.2.0", + "elliptic": "^6.5.4", "ethers": "^5.5.2", - "js-sha3": "^0.8.0" + "js-sha3": "^0.9.2", + "pako": "^2.1.0" }, "engines": { "node": ">=16.0.0", - "npm": ">=8.0.0" + "npm": ">=9.0.0" } }, + "node_modules/@fairdatasociety/fdp-storage/node_modules/js-sha3": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.9.3.tgz", + "integrity": "sha512-BcJPCQeLg6WjEx3FE591wVAevlli8lxsxm9/FzV4HXkV49TmBH38Yvrpce6fjbADGMKFrBMGTqrVz3qPIZ88Gg==" + }, + "node_modules/@fairdatasociety/fdp-storage/node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + }, "node_modules/@formatjs/intl-unified-numberformat": { "version": "3.3.7", "resolved": "https://registry.npmjs.org/@formatjs/intl-unified-numberformat/-/intl-unified-numberformat-3.3.7.tgz", @@ -9819,8 +9831,9 @@ } }, "node_modules/crypto-js": { - "version": "4.1.1", - "license": "MIT" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" }, "node_modules/crypto-random-string": { "version": "2.0.0", @@ -25002,21 +25015,35 @@ } }, "@fairdatasociety/fdp-contracts-js": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.8.0.tgz", - "integrity": "sha512-Lfr/kxCBZ4IYWwAkeRa2fSi9suYd5DxTG5xunfuwMm32FeB99fL7tI19sb5tjPyRj6bphJPaRWmFCdPJ+yfZsg==", + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.10.1.tgz", + "integrity": "sha512-letk0QcHlv2nNrM7ZF0iazT07IWseM+T0iC9Ax61/dHeR0j/aLkGFv/IiFbMTEXs6xc2iFp+Thoa4x5bmd51Jw==", "requires": {} }, "@fairdatasociety/fdp-storage": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.13.0.tgz", - "integrity": "sha512-7AWAC/enq1SQCisMuD3wT5cKSOxe8KdC5f3nolWcruCUpdWcwe65YtjDeL88m/E/kcituQGAl2IgWGkqoysB/g==", + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-storage/-/fdp-storage-0.18.0.tgz", + "integrity": "sha512-WfBU/IFTcCvJGL6g7V7fW6XX2ZVZ6VUTAMPwH+Gkg7qcA+ra6LHGIidFKWjINNbzs/gHP1DI9oxxTC6XzAlnBQ==", "requires": { "@ethersphere/bee-js": "^6.2.0", - "@fairdatasociety/fdp-contracts-js": "^3.8.0", - "crypto-js": "^4.1.1", + "@fairdatasociety/fdp-contracts-js": "^3.10.0", + "crypto-js": "^4.2.0", + "elliptic": "^6.5.4", "ethers": "^5.5.2", - "js-sha3": "^0.8.0" + "js-sha3": "^0.9.2", + "pako": "^2.1.0" + }, + "dependencies": { + "js-sha3": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.9.3.tgz", + "integrity": "sha512-BcJPCQeLg6WjEx3FE591wVAevlli8lxsxm9/FzV4HXkV49TmBH38Yvrpce6fjbADGMKFrBMGTqrVz3qPIZ88Gg==" + }, + "pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + } } }, "@formatjs/intl-unified-numberformat": { @@ -29926,7 +29953,9 @@ } }, "crypto-js": { - "version": "4.1.1" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" }, "crypto-random-string": { "version": "2.0.0" diff --git a/package.json b/package.json index f1cd9020..640e9c80 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@emotion/react": "^11.4.1", "@emotion/styled": "^11.3.0", "@fairdatasociety/blossom": "^0.5.0", - "@fairdatasociety/fdp-storage": "^0.13.0", + "@fairdatasociety/fdp-storage": "^0.18.0", "@headlessui/react": "^1.7.14", "@metamask/sdk": "^0.5.6", "@types/react-blockies": "^1.4.1", diff --git a/src/api/files.ts b/src/api/files.ts index 99ace5d3..19a08816 100644 --- a/src/api/files.ts +++ b/src/api/files.ts @@ -3,12 +3,14 @@ import { FileItem, UploadProgressInfo, } from '@fairdatasociety/fdp-storage'; +import { PodShareInfo } from '@fairdatasociety/fdp-storage/dist/pod/types'; +import { isSharedPod } from '@utils/pod'; import { formatUrl } from '@utils/url'; interface DownloadFileData { filename: string; directory: string; - podName: string; + pod: string | PodShareInfo; } interface ShareFileData { @@ -54,12 +56,21 @@ export async function downloadFile( fdp: FdpStorage, data: DownloadFileData ): Promise { + const { pod, directory, filename } = data; const writePath = - data.directory === 'root' ? '/' : '/' + formatUrl(data.directory) + '/'; - const downloadFile = await fdp.file.downloadData( - data.podName, - `${writePath}${data.filename}` - ); + data.directory === 'root' ? '/' : '/' + formatUrl(directory) + '/'; + const path = `${writePath}${filename}`; + let downloadFile: Uint8Array; + + if (isSharedPod(pod)) { + downloadFile = await fdp.file.downloadArbitraryPodData( + pod.podAddress, + pod.password, + path + ); + } else { + downloadFile = await fdp.file.downloadData(pod, path); + } return new Blob([downloadFile]); } diff --git a/src/api/pod.ts b/src/api/pod.ts index 3e0cb8a9..162feb2c 100644 --- a/src/api/pod.ts +++ b/src/api/pod.ts @@ -1,4 +1,7 @@ +import { SubItem } from '@data/subscription'; import { DirectoryItem, FdpStorage } from '@fairdatasociety/fdp-storage'; +import { PodShareInfo } from '@fairdatasociety/fdp-storage/dist/pod/types'; +import { isSharedPod } from '@utils/pod'; export interface GetPodResponse { pod_name: string[]; @@ -16,6 +19,35 @@ export async function getPods(fdp: FdpStorage): Promise { return response as GetPodResponse; } +export async function getUsersSubItems( + fdp: FdpStorage, + address: string +): Promise { + return fdp.dataHub.getAllSubItems(address); +} + +export async function getSubscriptionPods( + fdp: FdpStorage, + subItems: SubItem[] +): Promise { + const subs: PodShareInfo[] = []; + + for (const subItem of subItems) { + try { + const sub = await fdp.personalStorage.openSubscribedPod( + subItem.subHash, + subItem.unlockKeyLocation + ); + + subs.push(sub); + } catch (error) { + console.warn(String(error)); + } + } + + return subs; +} + export async function createPod(fdp: FdpStorage, pod_name: string) { return await fdp.personalStorage.create(pod_name); } @@ -38,8 +70,15 @@ export function getFdpPathByDirectory(directory: string): string { export async function getFilesAndDirectories( fdp: FdpStorage, - podName: string, + pod: string | PodShareInfo, directory: string ): Promise { - return fdp.directory.read(podName, getFdpPathByDirectory(directory), false); + if (isSharedPod(pod)) { + return fdp.directory.readFromShared( + pod, + getFdpPathByDirectory(directory), + false + ); + } + return fdp.directory.read(pod, getFdpPathByDirectory(directory), false); } diff --git a/src/components/Buttons/DriveToggle/DriveToggle.tsx b/src/components/Buttons/DriveToggle/DriveToggle.tsx index 7f9a3bd7..ac34e1cb 100644 --- a/src/components/Buttons/DriveToggle/DriveToggle.tsx +++ b/src/components/Buttons/DriveToggle/DriveToggle.tsx @@ -3,10 +3,15 @@ import { FC } from 'react'; interface DriveToggleProps { activeTab: string; + showSubscribed: boolean; setActiveTab: (tab: string) => void; } -const DriveToggle: FC = ({ activeTab, setActiveTab }) => { +const DriveToggle: FC = ({ + activeTab, + showSubscribed, + setActiveTab, +}) => { const { intl } = useLocales(); const activeClass = @@ -16,24 +21,36 @@ const DriveToggle: FC = ({ activeTab, setActiveTab }) => { 'font-normal text-color-accents-plum-black dark:text-color-accents-grey-cloud bg-color-shade-dark-4-day dark:bg-color-shade-dark-3-night effect-style-small-button-drop-shadow'; return ( -
- +
+
+ - + +
+ {showSubscribed && ( + + )}
); }; diff --git a/src/components/Connect/Metamask/MetamaskConnect.tsx b/src/components/Connect/Metamask/MetamaskConnect.tsx index 9917e233..4a9eef7f 100644 --- a/src/components/Connect/Metamask/MetamaskConnect.tsx +++ b/src/components/Connect/Metamask/MetamaskConnect.tsx @@ -65,7 +65,7 @@ const MetamaskConnect = ({ onConnect }: MetamaskConnectProps) => { const wallet = await decryptWallet(localBasicWallet, password); const mnemonic = wallet.mnemonic.phrase; markInviteAsParticipated(); - setFdpStorageType('native', network.config); + setFdpStorageType('native', network.ensConfig, network.datahubConfig); fdpClientRef.current.account.setAccountFromMnemonic(mnemonic); setIsLoggedIn(true); setLoginType('metamask'); diff --git a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskUsernamePassword.tsx b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskUsernamePassword.tsx index d23cc3df..f8a087be 100644 --- a/src/components/Dialogs/MetamaskMigrationDialog/MetamaskUsernamePassword.tsx +++ b/src/components/Dialogs/MetamaskMigrationDialog/MetamaskUsernamePassword.tsx @@ -40,7 +40,7 @@ export default function MetamaskUsernamePassword({ setLoading(true); setErrorMessage(null); - setFdpStorageConfig(network.config); + setFdpStorageConfig(network.ensConfig, network.datahubConfig); const usernameAvailable = await fdpClientRef.current.account.ens.isUsernameAvailable(username); diff --git a/src/components/DirectoryPath/DirectoryPath.tsx b/src/components/DirectoryPath/DirectoryPath.tsx index a8908fae..8a1667e6 100644 --- a/src/components/DirectoryPath/DirectoryPath.tsx +++ b/src/components/DirectoryPath/DirectoryPath.tsx @@ -3,9 +3,11 @@ import PageDownLight from '@media/UI/page-down-light.svg'; import PageDownDark from '@media/UI/page-down-dark.svg'; import { Button } from '@components/Buttons'; import ThemeContext from '@context/ThemeContext'; +import { useLocales } from '@context/LocalesContext'; interface DirectoryPathProps { podName: string; + subscribedPod: boolean; directory: string; onDirectorySelect: (newDirectory: string) => void; onBackToDrive: () => void; @@ -19,6 +21,7 @@ const selectableClasses = 'cursor-pointer hover:bg-color-shade-dark-3-day'; const DirectoryPath = ({ podName, + subscribedPod, directory, onDirectorySelect, onBackToDrive, @@ -29,6 +32,7 @@ const DirectoryPath = ({ const folders = (directory === 'root' ? '' : directory).split('/'); return [folders, folders.slice(-MAX_FOLDERS)]; }, [directory]); + const { intl } = useLocales(); const offset = folders.length - displayedFolders.length; @@ -54,10 +58,13 @@ const DirectoryPath = ({ )} {offset > 0 &&  / ...} {displayedFolders.map((folder, index) => ( diff --git a/src/components/Dropdowns/DriveItemDropdown/DriveItemMenu.tsx b/src/components/Dropdowns/DriveItemDropdown/DriveItemMenu.tsx index f039a7a9..4cafffd6 100644 --- a/src/components/Dropdowns/DriveItemDropdown/DriveItemMenu.tsx +++ b/src/components/Dropdowns/DriveItemDropdown/DriveItemMenu.tsx @@ -17,6 +17,7 @@ import { getFdpPathByDirectory } from '@api/pod'; import { UpdateDriveProps } from '@interfaces/handlers'; import DropdownTransition from '../DropdownTransition'; import { useLocales } from '@context/LocalesContext'; +import { getPodName, isSharedPod } from '@utils/pod'; interface DriveItemMenuProps extends UpdateDriveProps { type: 'folder' | 'file'; @@ -41,13 +42,15 @@ const DriveItemMenu: FC = ({ const [showConfirmDeleteModal, setShowConfirmDeleteModal] = useState(false); const { intl } = useLocales(); const previewLabel = intl.get(type === 'file' ? 'PREVIEW' : 'OPEN'); + const podName = getPodName(activePod); + const canEdit = !isSharedPod(activePod); const handleDownloadClick = async () => { try { const response = await downloadFile(fdpClientRef.current, { filename: data?.name, directory: directoryName, - podName: activePod, + pod: activePod, }); FileSaver.saveAs(response, data?.name); @@ -80,7 +83,7 @@ const DriveItemMenu: FC = ({ try { await deleteFile(fdpClientRef.current, { file_name: itemName, - podName: activePod, + podName, path: formatDirectory(directoryName), }); @@ -95,7 +98,7 @@ const DriveItemMenu: FC = ({ setShowConfirmDeleteModal(false); removeItemFromCache( userAddress, - activePod, + podName, fdpPath, itemName, ContentType.FILE @@ -118,7 +121,7 @@ const DriveItemMenu: FC = ({ try { await deleteDirectory(fdpClientRef.current, { - podName: activePod, + podName, path: deletePath, }); @@ -133,7 +136,7 @@ const DriveItemMenu: FC = ({ setShowConfirmDeleteModal(false); removeItemFromCache( userAddress, - activePod, + podName, fdpPath, itemName, ContentType.DIRECTORY @@ -162,7 +165,7 @@ const DriveItemMenu: FC = ({
- {type === 'file' ? ( + {type === 'file' && canEdit ? ( = ({ ) : null} - {type === 'file' ? ( + {type === 'file' && canEdit ? ( = ({ ) : null} - - {intl.get('DELETE')} - + {canEdit && ( + + {intl.get('DELETE')} + + )}
@@ -198,7 +203,7 @@ const DriveItemMenu: FC = ({ showModal={showShareFileModal} closeModal={() => setShowShareFileModal(false)} fileName={data?.name} - podName={activePod} + podName={podName} path={formatDirectory(directoryName)} /> ) : null} diff --git a/src/components/Dropdowns/PodDropdown/PodDropdownMenu.tsx b/src/components/Dropdowns/PodDropdown/PodDropdownMenu.tsx index 4aedf1c7..013b8871 100644 --- a/src/components/Dropdowns/PodDropdown/PodDropdownMenu.tsx +++ b/src/components/Dropdowns/PodDropdown/PodDropdownMenu.tsx @@ -5,32 +5,43 @@ import PodContext from '@context/PodContext'; import sortAlphabetically from '@utils/sortAlphabetically'; import DropdownTransition from '../DropdownTransition'; import { useLocales } from '@context/LocalesContext'; +import { getPodName } from '@utils/pod'; +import { PodShareInfo } from '@fairdatasociety/fdp-storage/dist/pod/types'; const PodItem = ({ - podName, + pod, onPodSelect, }: { - podName: string; - onPodSelect: (podName: string) => void; + pod: string | PodShareInfo; + onPodSelect: (podName: string | PodShareInfo) => void; }) => { return ( onPodSelect(podName)} + onClick={() => onPodSelect(pod)} > - {podName} + {getPodName(pod)} ); }; const PodDropdownMenu = () => { - const { activePod, pods, setActivePod, setDirectoryName, directoryName } = - useContext(PodContext); + const { + activePod, + pods, + subscribedPods, + setActivePod, + setDirectoryName, + directoryName, + } = useContext(PodContext); const { intl } = useLocales(); + const podName = getPodName(activePod); - const onPodSelect = (podName: string) => { - setActivePod(podName); + const onPodSelect = (pod: string | PodShareInfo) => { + console.log(pod); + + setActivePod(pod); setDirectoryName('root'); }; @@ -39,9 +50,9 @@ const PodDropdownMenu = () => {

- {activePod || intl.get('SELECT_A_POD')} + {podName || intl.get('SELECT_A_POD')}

- {activePod && directoryName !== 'root' && ( + {podName && directoryName !== 'root' && ( {
{sortAlphabetically(pods?.pod_name).map((podName) => ( - + ))} {sortAlphabetically(pods?.shared_pod_name).map((podName) => ( - + + ))} + + {subscribedPods?.length > 0 && ( +
+ {intl.get('SUBSCRIBED')}: +
+ )} + + {subscribedPods?.map((pod) => ( + ))}
diff --git a/src/components/Dropdowns/PodDropdown/PodDropdownToggle.tsx b/src/components/Dropdowns/PodDropdown/PodDropdownToggle.tsx index 2c30dde3..037085a2 100644 --- a/src/components/Dropdowns/PodDropdown/PodDropdownToggle.tsx +++ b/src/components/Dropdowns/PodDropdown/PodDropdownToggle.tsx @@ -8,12 +8,14 @@ import { Button } from '@components/Buttons'; import PageDownLight from '@media/UI/page-down-light.svg'; import PageDownDark from '@media/UI/page-down-dark.svg'; +import { getPodName, isSharedPod } from '@utils/pod'; const PodDropdownToggele = () => { const { theme } = useContext(ThemeContext); const { loading, activePod, setActivePod, setDirectoryName } = useContext(PodContext); const { intl } = useLocales(); + const podName = getPodName(activePod); const onBackToDrive = () => { setActivePod(''); @@ -22,7 +24,7 @@ const PodDropdownToggele = () => { return ( <> - {activePod && ( + {podName && (
diff --git a/src/components/NavigationBars/MainNavigationBar/MainNavigationBar.tsx b/src/components/NavigationBars/MainNavigationBar/MainNavigationBar.tsx index 0678c37c..e7f344e0 100644 --- a/src/components/NavigationBars/MainNavigationBar/MainNavigationBar.tsx +++ b/src/components/NavigationBars/MainNavigationBar/MainNavigationBar.tsx @@ -16,6 +16,7 @@ import NavigationMenuDark from '@media/UI/drive-view-list-dark.svg'; import ThemeContext from '@context/ThemeContext'; import PodContext from '@context/PodContext'; import { Transition } from '@headlessui/react'; +import { getPodName } from '@utils/pod'; // import ActivityDropdown from './ActivityDropdown/ActivityDropdown'; @@ -26,6 +27,7 @@ const MainNavigationBar: FC> = () => { const { metamaskMigrationNotification } = useContext(UserContext); const { setMobileNavigationOpen } = useDialogs(); const { activePod } = useContext(PodContext); + const podName = getPodName(activePod); return (