From 5cbfdbff1351b3ceb0742bc145dffff394dfaff8 Mon Sep 17 00:00:00 2001 From: Konstantsin Kryulenia Date: Fri, 7 Jun 2024 16:17:37 +0300 Subject: [PATCH] use workspace title --- src/api/api.ts | 2 +- src/api/fetcher.ts | 5 ++++- src/components/app.tsx | 9 ++------- src/types.ts | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/api/api.ts b/src/api/api.ts index 5900a29..f6d745b 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -13,7 +13,7 @@ const getCommandApiUrl = (host: string) => { export async function getMe(): Promise { const me = await apiCall<{ email: string; - workspaces: Array<{ name: string }>; + workspaces: Array<{ name: string; title: string }>; }>(meUrl, { method: "GET" }); return { ...me, diff --git a/src/api/fetcher.ts b/src/api/fetcher.ts index 171bc21..d85672b 100644 --- a/src/api/fetcher.ts +++ b/src/api/fetcher.ts @@ -79,7 +79,10 @@ const createEntityCommands = ({ throw Error(`Type ${type["fibery/name"]} doesn't have title field`); } const urlField = type["fibery/fields"].find((field) => { - return field["fibery/meta"]["ui/type"] === "url"; + return ( + field["fibery/meta"]["ui/type"] === "url" || + field["fibery/type"] === "fibery/url" + ); }); return [ { diff --git a/src/components/app.tsx b/src/components/app.tsx index 8ff2d61..b0ecfd9 100644 --- a/src/components/app.tsx +++ b/src/components/app.tsx @@ -74,11 +74,6 @@ function getTypes(schema: Schema) { return typesByGroup; } -function getWorkspaceName(host: string) { - const [name] = host.split("."); - return name; -} - function TypesSelect({ onChange, value, @@ -325,9 +320,9 @@ function Form({ id="workspace" > - {me.workspaces.map(({ name }) => ( + {me.workspaces.map(({ name, title }) => ( ))} diff --git a/src/types.ts b/src/types.ts index a3ba0c3..e1fc340 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,6 +1,6 @@ export type User = { email: string; - workspaces: Array<{ name: string }>; + workspaces: Array<{ name: string; title: string }>; lastUsedWorkspace?: string; lastUsedType?: string; lastUsedTypeName?: string;