From 817b1aae0cd5513321a58a0a94ed57718a767a51 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Thu, 22 Aug 2024 12:46:24 +0300 Subject: [PATCH] Doceditor: fix ts problems --- packages/doceditor/src/app/(root)/layout.tsx | 10 +--------- packages/doceditor/src/components/Error/Error.tsx | 4 +--- packages/doceditor/src/components/Root.tsx | 11 +++-------- .../doceditor/src/components/file-password/index.tsx | 2 +- .../doceditor/src/providers/TranslationProvider.tsx | 7 ------- packages/doceditor/src/providers/index.tsx | 4 ++-- packages/doceditor/src/utils/actions.ts | 2 -- 7 files changed, 8 insertions(+), 32 deletions(-) diff --git a/packages/doceditor/src/app/(root)/layout.tsx b/packages/doceditor/src/app/(root)/layout.tsx index 6e4f1b65b6..6e22a44e5a 100644 --- a/packages/doceditor/src/app/(root)/layout.tsx +++ b/packages/doceditor/src/app/(root)/layout.tsx @@ -55,18 +55,14 @@ export default async function RootLayout({ return <>; } - const startDate = new Date(); const [user, settings, colorTheme] = await Promise.all([ getUser(), getSettings(), getColorTheme(), ]); - const timer = new Date().getTime() - startDate.getTime(); if (settings === "access-restricted") redirect(`${getBaseUrl()}/${settings}`); - const api_host = process.env.API_HOST?.trim(); - return ( @@ -82,11 +78,7 @@ export default async function RootLayout({ - + {children} diff --git a/packages/doceditor/src/components/Error/Error.tsx b/packages/doceditor/src/components/Error/Error.tsx index 832c230346..e26f254ea3 100644 --- a/packages/doceditor/src/components/Error/Error.tsx +++ b/packages/doceditor/src/components/Error/Error.tsx @@ -9,7 +9,6 @@ import type { TFirebaseSettings } from "@docspace/shared/api/settings/types"; import useI18N from "@/hooks/useI18N"; import useTheme from "@/hooks/useTheme"; import useDeviceType from "@/hooks/useDeviceType"; -import useWhiteLabel from "@/hooks/useWhiteLabel"; import pkg from "../../../package.json"; @@ -18,7 +17,7 @@ import { ErrorProps } from "./Error.types"; const Error = ({ settings, user, error }: ErrorProps) => { const { i18n } = useI18N({ settings, user }); const { currentDeviceType } = useDeviceType(); - const { logoUrls } = useWhiteLabel(); + const { theme } = useTheme({ user }); const firebaseHelper = useMemo(() => { @@ -32,7 +31,6 @@ const Error = ({ settings, user, error }: ErrorProps) => { errorLog={error} version={pkg.version} user={user ?? ({} as TUser)} - whiteLabelLogoUrls={logoUrls} firebaseHelper={firebaseHelper} currentDeviceType={currentDeviceType} /> diff --git a/packages/doceditor/src/components/Root.tsx b/packages/doceditor/src/components/Root.tsx index 378b9aac04..b2aadac2c9 100644 --- a/packages/doceditor/src/components/Root.tsx +++ b/packages/doceditor/src/components/Root.tsx @@ -26,14 +26,14 @@ "use client"; -import React, { useEffect } from "react"; +import React from "react"; import { useTranslation } from "react-i18next"; import ErrorContainer from "@docspace/shared/components/error-container/ErrorContainer"; import { TResponse } from "@/types"; -import useError from "@/hooks/useError"; +import useError from "@/hooks/useError"; import useRootInit from "@/hooks/useRootInit"; import useDeepLink from "@/hooks/useDeepLink"; import useSelectFileDialog from "@/hooks/useSelectFileDialog"; @@ -46,6 +46,7 @@ import useStartFillingSelectDialog from "@/hooks/useStartFillingSelectDialog"; import DeepLink from "./deep-link"; import Editor from "./Editor"; + import SelectFileDialog from "./SelectFileDialog"; import SelectFolderDialog from "./SelectFolderDialog"; import SharingDialog from "./ShareDialog"; @@ -64,7 +65,6 @@ const Root = ({ doc, fileId, hash, - timer, }: TResponse) => { const editorRef = React.useRef(null); @@ -81,11 +81,6 @@ const Root = ({ const { t } = useTranslation(["Editor", "Common"]); - useEffect(() => { - console.log("editor timer: ", timer); - console.log("openEdit timer: ", config?.timer); - }, [config?.timer, timer]); - useRootInit({ documentType: config?.documentType, }); diff --git a/packages/doceditor/src/components/file-password/index.tsx b/packages/doceditor/src/components/file-password/index.tsx index 78cf52078e..735ec414b5 100644 --- a/packages/doceditor/src/components/file-password/index.tsx +++ b/packages/doceditor/src/components/file-password/index.tsx @@ -178,7 +178,7 @@ const FilePassword = ({ shareKey, title, entryTitle }: FilePasswordProps) => { id="password" inputName="password" placeholder={t("Common:Password")} - type={InputType.password} + inputType={InputType.password} inputValue={password} hasError={!!errorMessage} size={InputSize.large} diff --git a/packages/doceditor/src/providers/TranslationProvider.tsx b/packages/doceditor/src/providers/TranslationProvider.tsx index df62ddfa5c..f3556653cb 100644 --- a/packages/doceditor/src/providers/TranslationProvider.tsx +++ b/packages/doceditor/src/providers/TranslationProvider.tsx @@ -44,16 +44,9 @@ const TranslationProvider = ({ children, settings, user, - api_host, - timer, }: TTranslationProvider) => { const { i18n } = useI18N({ settings, user }); - React.useEffect(() => { - console.log("API_HOST: ", api_host); - console.log("LAYOUT API timer:", timer); - }, [api_host, timer]); - return {children}; }; diff --git a/packages/doceditor/src/providers/index.tsx b/packages/doceditor/src/providers/index.tsx index 5d955aa434..f1ffa53cde 100644 --- a/packages/doceditor/src/providers/index.tsx +++ b/packages/doceditor/src/providers/index.tsx @@ -48,9 +48,9 @@ export type TProviders = { contextData: TContextData; }; -const Providers = ({ children, contextData, api_host, timer }: TProviders) => { +const Providers = ({ children, contextData }: TProviders) => { return ( - + {children} diff --git a/packages/doceditor/src/utils/actions.ts b/packages/doceditor/src/utils/actions.ts index 8dcdc27b9d..9050912e2b 100644 --- a/packages/doceditor/src/utils/actions.ts +++ b/packages/doceditor/src/utils/actions.ts @@ -65,8 +65,6 @@ export async function getFillingSession( ); try { - console.log({ request }); - const response = await fetch(request); if (response.ok) return await response.json();