From 75a56be048e48f5a1d5ea250dccd00699067764a Mon Sep 17 00:00:00 2001 From: Mayursinh Sarvaiya Date: Mon, 16 Dec 2024 17:29:19 -0400 Subject: [PATCH] fix: lint Signed-off-by: Mayursinh Sarvaiya --- ui/src/features/auth/protected-route.tsx | 2 +- ...context.tsx => modal-context-provider.tsx} | 18 +---------------- ui/src/features/common/modal/modal-context.ts | 20 +++++++++++++++++++ 3 files changed, 22 insertions(+), 18 deletions(-) rename ui/src/features/common/modal/{modal-context.tsx => modal-context-provider.tsx} (80%) create mode 100644 ui/src/features/common/modal/modal-context.ts diff --git a/ui/src/features/auth/protected-route.tsx b/ui/src/features/auth/protected-route.tsx index 14f9f6f4d..7f0b25b0f 100644 --- a/ui/src/features/auth/protected-route.tsx +++ b/ui/src/features/auth/protected-route.tsx @@ -7,7 +7,7 @@ import { transport, transportWithAuth } from '@ui/config/transport'; import { PromotionDirectivesRegistryContextProvider } from '@ui/features/promotion-directives/registry/context/registry-context-provider'; import { getPublicConfig } from '@ui/gen/service/v1alpha1/service-KargoService_connectquery'; -import { ModalContextProvider } from '../common/modal/modal-context'; +import { ModalContextProvider } from '../common/modal/modal-context-provider'; import { useAuthContext } from './context/use-auth-context'; diff --git a/ui/src/features/common/modal/modal-context.tsx b/ui/src/features/common/modal/modal-context-provider.tsx similarity index 80% rename from ui/src/features/common/modal/modal-context.tsx rename to ui/src/features/common/modal/modal-context-provider.tsx index 48f153742..12b4690f3 100644 --- a/ui/src/features/common/modal/modal-context.tsx +++ b/ui/src/features/common/modal/modal-context-provider.tsx @@ -4,24 +4,8 @@ import { delay } from '@ui/utils/delay'; import { Portal } from '../portal'; -export interface ModalComponentProps { - hide: () => void; - visible: boolean; -} - -export type ModalComponent = React.FC; - -type ModalItem = { - component: ModalComponent; - visible: boolean; -}; - -interface ModalContextValue { - show: (key: string, element: ModalComponent) => void; - hide: (key: string) => void; -} +import { ModalComponent, ModalContext, ModalItem } from './modal-context'; -export const ModalContext = React.createContext(null); interface ModalProviderProps { children: React.ReactNode; container: HTMLElement | null; diff --git a/ui/src/features/common/modal/modal-context.ts b/ui/src/features/common/modal/modal-context.ts new file mode 100644 index 000000000..a75d488b0 --- /dev/null +++ b/ui/src/features/common/modal/modal-context.ts @@ -0,0 +1,20 @@ +import React from 'react'; + +export type ModalItem = { + component: ModalComponent; + visible: boolean; +}; + +export interface ModalContextValue { + show: (key: string, element: ModalComponent) => void; + hide: (key: string) => void; +} + +export const ModalContext = React.createContext(null); + +export interface ModalComponentProps { + hide: () => void; + visible: boolean; +} + +export type ModalComponent = React.FC;