diff --git a/apps/web/src/api/dropbox.ts b/apps/web/src/api/dropbox.ts index a319ccb2..54ba0279 100644 --- a/apps/web/src/api/dropbox.ts +++ b/apps/web/src/api/dropbox.ts @@ -10,6 +10,12 @@ export const getFiles = async (id?: string) => { path: string; fileId: string; }; + directory: { + id: string; + name: string; + path: string; + fileId: string; + }; directories: { id: string; name: string; diff --git a/apps/web/src/api/googledrive.ts b/apps/web/src/api/googledrive.ts index 35199b68..deb84bdb 100644 --- a/apps/web/src/api/googledrive.ts +++ b/apps/web/src/api/googledrive.ts @@ -8,6 +8,12 @@ export const getFiles = async (parent_id?: string) => { path: string; fileId: string; }; + directory: { + id: string; + name: string; + path: string; + fileId: string; + }; directories: { id: string; name: string; diff --git a/apps/web/src/pages/dropbox/Dropbox.tsx b/apps/web/src/pages/dropbox/Dropbox.tsx index 4a80222d..d2c880c3 100644 --- a/apps/web/src/pages/dropbox/Dropbox.tsx +++ b/apps/web/src/pages/dropbox/Dropbox.tsx @@ -19,7 +19,6 @@ export type DropboxProps = { const Dropbox = (props: DropboxProps) => { const { data, isLoading } = useFilesQuery(props.fileId); - const { data: parent } = useFilesQuery(data?.parentDirectory?.fileId); const playFile = async (id: string) => { console.log(">> Playing file:", id); @@ -155,16 +154,16 @@ const Dropbox = (props: DropboxProps) => { { - {parent?.parentDirectory?.path === "/Music" - ? "" - : parent?.parentDirectory?.name} + {data?.parentDirectory?.path === "/Music" + ? "Dropbox" + : data?.parentDirectory?.name} } @@ -173,9 +172,9 @@ const Dropbox = (props: DropboxProps) => { marginBottom={"25px"} className="!text-[var(--color-text)]" > - {data?.parentDirectory?.path === "/Music" + {data?.directory?.path === "/Music" ? "Dropbox" - : data?.parentDirectory?.name} + : data?.directory?.name} diff --git a/apps/web/src/pages/googledrive/GoogleDrive.tsx b/apps/web/src/pages/googledrive/GoogleDrive.tsx index 891414ca..6df0c031 100644 --- a/apps/web/src/pages/googledrive/GoogleDrive.tsx +++ b/apps/web/src/pages/googledrive/GoogleDrive.tsx @@ -19,7 +19,6 @@ export type GoogleDriveProps = { const GoogleDrive = (props: GoogleDriveProps) => { const { data, isLoading } = useFilesQuery(props.fileId); - const { data: parent } = useFilesQuery(data?.parentDirectory?.fileId); const columns = [ columnHelper.accessor("name", { @@ -150,16 +149,16 @@ const GoogleDrive = (props: GoogleDriveProps) => { { - {parent?.parentDirectory?.path === "/Music" - ? "" - : parent?.parentDirectory?.name} + {data?.parentDirectory?.path === "/Music" + ? "Google Drive" + : data?.parentDirectory?.name} } @@ -168,9 +167,9 @@ const GoogleDrive = (props: GoogleDriveProps) => { marginBottom={"25px"} className="!text-[var(--color-text)]" > - {data?.parentDirectory?.path === "/Music" + {data?.directory?.path === "/Music" ? "Google Drive" - : data?.parentDirectory?.name} + : data?.directory?.name}