From 3e8fbb01bbddfe8ae9191d61911b9e9f35d566f9 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Tue, 28 Sep 2021 16:07:00 +0200 Subject: [PATCH] the big refactor 2: ObjID --- codegen.yml | 5 +- package.json | 1 + src/components/Breadcrum.tsx | 37 +- src/components/FileBrowser.tsx | 43 +- src/components/FileBrowserContextMenu.tsx | 6 +- src/components/FileBrowserList.tsx | 17 +- src/components/FileOpen.tsx | 3 +- src/functions/genDownloadLink.ts | 6 +- src/functions/pathRename.ts | 11 - src/functions/uploadFile.ts | 6 +- src/generated/graphql.tsx | 73 +- src/generated/schema.json | 1682 ++++++++++----------- src/graphql/copy.graphql | 2 +- src/graphql/createDir.graphql | 2 +- src/graphql/deleteDir.graphql | 2 +- src/graphql/deleteFile.graphql | 2 +- src/graphql/getFile.graphql | 2 +- src/graphql/move.graphql | 2 +- src/graphql/openDir.graphql | 4 +- src/index.tsx | 33 + src/types/ObjID.ts | 82 + yarn.lock | 27 + 22 files changed, 1096 insertions(+), 952 deletions(-) delete mode 100644 src/functions/pathRename.ts create mode 100644 src/types/ObjID.ts diff --git a/codegen.yml b/codegen.yml index 1c2ec82..4a94f06 100644 --- a/codegen.yml +++ b/codegen.yml @@ -10,7 +10,10 @@ generates: - "typescript" - "typescript-operations" - "typescript-react-apollo" + - add: + content: "import ObjID from './../types/ObjID'" config: withHooks: true scalars: - DateTime: string \ No newline at end of file + DateTime: string + objID: ObjID \ No newline at end of file diff --git a/package.json b/package.json index 445cd40..9c05803 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ }, "devDependencies": { "@craco/craco": "^6.2.0", + "@graphql-codegen/add": "^3.1.0", "@graphql-codegen/cli": "1.21.7", "@graphql-codegen/introspection": "1.18.2", "@graphql-codegen/typescript": "^1.23.0", diff --git a/src/components/Breadcrum.tsx b/src/components/Breadcrum.tsx index f338a7d..e744d64 100644 --- a/src/components/Breadcrum.tsx +++ b/src/components/Breadcrum.tsx @@ -1,25 +1,36 @@ import React from "react" +import ObjID from "../types/ObjID" import { ReactComponent as BreadcrumImage } from "./../assets/breadcrum.svg" interface Props{ - path: string - onDirClick?: (path: string) => void + path: ObjID + onDirClick?: (path: ObjID) => void } const Breadcrum: React.FC = (props) => { - const parts = props.path.split("/").filter(e=>e.length > 0) + const keyParts = props.path.key.split("/").filter(e=>e.length > 0) return ( -