From 0ddc16d476eccb5c87b2b26ec7483df8903338e3 Mon Sep 17 00:00:00 2001 From: Mirian Okradze Date: Tue, 10 Oct 2023 12:52:53 +0400 Subject: [PATCH] refactor: vite eslint config and fix errors --- apps/ui/package.json | 12 +- .../AvatarGenerator/AvatarGenerator.tsx | 1 + .../components/BreadCrumbs/routeConfig.tsx | 15 - apps/ui/src/components/DataGrid/DataGrid.tsx | 10 +- apps/ui/src/components/Mentions/Mentions.tsx | 4 +- .../ui/src/components/Spotlight/Spotlight.tsx | 4 +- .../components/Spotlight/useSuggestions.ts | 46 +-- apps/ui/src/interfaces/index.ts | 1 - .../modals/AIChatModal/components/ChatV2.tsx | 4 +- .../modals/AIChatModal/hooks/useChatSocket.ts | 12 +- .../AIChatModal/hooks/useUpdateChatCache.ts | 15 +- .../modals/AIChatModal/utils/localStorage.ts | 24 -- apps/ui/src/pages/Addons.tsx | 172 ------------ .../pages/ApiKeys/EditApiKey/EditApiModal.tsx | 1 + apps/ui/src/services/chat/index.ts | 1 - .../services/chat/useUpscaleAiMediaService.ts | 33 --- apps/ui/src/services/interfaces/index.ts | 1 - apps/ui/src/services/types/chat.ts | 3 - apps/ui/src/services/useAccountService.ts | 3 +- apps/ui/src/services/usePropertyService.ts | 265 ------------------ apps/ui/vite.config.ts | 2 +- 21 files changed, 33 insertions(+), 596 deletions(-) delete mode 100644 apps/ui/src/components/BreadCrumbs/routeConfig.tsx delete mode 100644 apps/ui/src/modals/AIChatModal/utils/localStorage.ts delete mode 100644 apps/ui/src/pages/Addons.tsx delete mode 100644 apps/ui/src/services/chat/useUpscaleAiMediaService.ts delete mode 100644 apps/ui/src/services/usePropertyService.ts diff --git a/apps/ui/package.json b/apps/ui/package.json index 7951bfb6f..6698a2352 100644 --- a/apps/ui/package.json +++ b/apps/ui/package.json @@ -78,12 +78,12 @@ "yup": "^0.32.11" }, "scripts": { - "start:local": "rm -rf ./node_modules/.cache/babel-loader && GENERATE_SOURCEMAP=false NODE_ENV=local vite --open", - "start:dev": "GENERATE_SOURCEMAP=false DISABLE_ESLINT_PLUGIN=true vite --mode develop --open", - "build": "NODE_OPTIONS=--max_old_space_size=4096 GENERATE_SOURCEMAP=true DISABLE_ESLINT_PLUGIN=true tsc && vite build", - "build:dev": "NODE_OPTIONS=--max_old_space_size=8192 GENERATE_SOURCEMAP=true DISABLE_ESLINT_PLUGIN=true vite build --mode develop", - "build:staging": "NODE_OPTIONS=--max_old_space_size=4096 GENERATE_SOURCEMAP=true DISABLE_ESLINT_PLUGIN=true vite build --mode staging", - "build:prod": "NODE_OPTIONS=--max_old_space_size=8192 GENERATE_SOURCEMAP=true DISABLE_ESLINT_PLUGIN=true vite build --mode production", + "start:local": "NODE_ENV=local vite --open", + "start:dev": "vite --mode develop --open", + "build": "NODE_OPTIONS=--max_old_space_size=8192 tsc && vite build", + "build:dev": "NODE_OPTIONS=--max_old_space_size=8192 vite build --mode develop", + "build:staging": "NODE_OPTIONS=--max_old_space_size=8192 vite build --mode staging", + "build:prod": "NODE_OPTIONS=--max_old_space_size=8192 vite build --mode production", "test": "vite test", "eject": "vite eject", "lint": "eslint --ext .ts,.tsx src", diff --git a/apps/ui/src/components/AvatarGenerator/AvatarGenerator.tsx b/apps/ui/src/components/AvatarGenerator/AvatarGenerator.tsx index ca99455cf..85d5de769 100644 --- a/apps/ui/src/components/AvatarGenerator/AvatarGenerator.tsx +++ b/apps/ui/src/components/AvatarGenerator/AvatarGenerator.tsx @@ -23,6 +23,7 @@ const AvatarGenerator = ({ avatar, }: AvatarGeneratorProps) => { return ( + // @ts-expect-error https://github.com/ambassify/react-avatar/issues/258 {userNamesById[match.params.userId]} - -const CustomPropsBreadcrumb = ({ someProp }) => {someProp} - -const routes = [ - { path: '/users/:userId', breadcrumb: DynamicUserBreadcrumb }, - { path: '/example', breadcrumb: 'Custom Example' }, - { - path: '/custom-props', - breadcrumb: CustomPropsBreadcrumb, - props: { someProp: 'Hi' }, - }, -] diff --git a/apps/ui/src/components/DataGrid/DataGrid.tsx b/apps/ui/src/components/DataGrid/DataGrid.tsx index 01507ef37..e7b14c2c2 100644 --- a/apps/ui/src/components/DataGrid/DataGrid.tsx +++ b/apps/ui/src/components/DataGrid/DataGrid.tsx @@ -19,8 +19,6 @@ import { // import useDataGrid from './useDataGrid' // import { AddRowButton } from './AddRowButton' -// import { useUpdateCacheThenServerProperty } from 'services/usePropertyService' - import processDataFromClipboard from './helpers/processDataFromClipboard' import styled from 'styled-components' import { LayoutContext } from 'contexts' @@ -248,7 +246,7 @@ const DataGrid = forwardRef( if (localHiddenData) { const JsonLocalData = await JSON.parse(localHiddenData) Object.entries(JsonLocalData[`${path}`]).forEach(function (key) { - params.columnApi.setColumnVisible(key[0], key[1]) + params.columnApi.setColumnVisible(key[0], key[1] as boolean) }) } @@ -303,7 +301,11 @@ const DataGrid = forwardRef( export default DataGrid -const StyledDiv = styled.div<{ headerHeight?: number; elementHeights?: number; maxHeight: number }>` +const StyledDiv = styled.div<{ + headerHeight?: number + elementHeights?: number + maxHeight: number | null +}>` height: ${p => p.elementHeights ? `calc(100vh - ${p.elementHeights}px) ` : 'calc(100vh - 175px)'}; // height: ${p => (p.elementHeights ? `100vh - ${p.elementHeights}` : '100vh')}; diff --git a/apps/ui/src/components/Mentions/Mentions.tsx b/apps/ui/src/components/Mentions/Mentions.tsx index 6516e5afa..c8ca23718 100644 --- a/apps/ui/src/components/Mentions/Mentions.tsx +++ b/apps/ui/src/components/Mentions/Mentions.tsx @@ -25,8 +25,8 @@ type MentionsProps = { onChange: OnChangeHandlerType onKeyDown: React.KeyboardEventHandler setValue: any - agentId: Nullable - teamId: Nullable + agentId?: Nullable + teamId?: Nullable } const Mentions = ({ diff --git a/apps/ui/src/components/Spotlight/Spotlight.tsx b/apps/ui/src/components/Spotlight/Spotlight.tsx index 053df6c2a..ec790ef4b 100644 --- a/apps/ui/src/components/Spotlight/Spotlight.tsx +++ b/apps/ui/src/components/Spotlight/Spotlight.tsx @@ -231,8 +231,8 @@ const Spotlight = () => { value={formValue} onKeyDown={handleKeyDown} setValue={setFormValue} - isGeneralChat={!agentId && !teamId} - chatType={agentId ? 'agent' : teamId ? 'team' : 'general'} + agentId={agentId} + teamId={teamId} /> diff --git a/apps/ui/src/components/Spotlight/useSuggestions.ts b/apps/ui/src/components/Spotlight/useSuggestions.ts index 8dac6dd84..79b17abf2 100644 --- a/apps/ui/src/components/Spotlight/useSuggestions.ts +++ b/apps/ui/src/components/Spotlight/useSuggestions.ts @@ -1,47 +1,3 @@ -import { useLocation } from 'react-router-dom' - -const homeSuggestions = [ - // 'Give me the top three minted assets in a table for all games.', - // 'Analyze my games and assets using our database to generate a report on player, transaction data, and other relevant insights.', - // 'Import polygon contract with address "X" in game "Y"', - // 'How many assets are in that game?', - // 'How many unique players are in all my game?', -] -const gameSuggestions = [ - // 'How many assets are in that game?', - // 'Give me table of top three minted assets in that game.', - // 'How many unique players are in that game?', - // 'Give me top three players in that game.', - // 'Import ethereum contract with address "0xeaa4c58427c184413b04db47889b28b5c98ebb7b" in that game', -] -const collectionSuggestions = [ - // 'How many assets are in that collection?', - // 'What is collection categories', - // 'collection?', - // 'How many collections are in that game?', - // 'Can you tell some dad jokes?', -] -const playerSuggestions = [ - // 'Give me top 3 players in that game.', - // 'What is player wallet address', - // 'How many players are in that game?', - // 'Give me top minted assets in that game.', - // 'Can you tell some dad jokes?', -] - export const useSuggestions = () => { - let chatSuggestions = homeSuggestions - - const location = useLocation() - const { pathname } = location - - if (pathname.includes('player')) { - chatSuggestions = playerSuggestions - } else if (pathname.includes('collection')) { - chatSuggestions = collectionSuggestions - } else if (pathname.includes('game')) { - chatSuggestions = gameSuggestions - } - - return { chatSuggestions } + return { chatSuggestions: [] } } diff --git a/apps/ui/src/interfaces/index.ts b/apps/ui/src/interfaces/index.ts index b1fa683b9..61965d3fb 100644 --- a/apps/ui/src/interfaces/index.ts +++ b/apps/ui/src/interfaces/index.ts @@ -1,5 +1,4 @@ export * from './account.interface' -export * from './game.interface' export * from './user.interface' export * from './tableRow.interface' export * from './accountSetting.interface' diff --git a/apps/ui/src/modals/AIChatModal/components/ChatV2.tsx b/apps/ui/src/modals/AIChatModal/components/ChatV2.tsx index 4af84a72b..ae3042134 100644 --- a/apps/ui/src/modals/AIChatModal/components/ChatV2.tsx +++ b/apps/ui/src/modals/AIChatModal/components/ChatV2.tsx @@ -72,7 +72,7 @@ const ChatV2 = () => { const [createClientChatMessage] = useCreateClientChatMessageService() - const { apiVersion, setAPIVersion, thinking, setThinking, socket } = useChatState() + const { thinking, setThinking, socket } = useChatState() const { data: chatMessages } = useChatMessagesService({ agentId, @@ -290,7 +290,9 @@ const ChatV2 = () => { { const { user, account } = useContext(AuthContext) @@ -81,10 +80,7 @@ const useChatSocket = () => { } if (data.type === 'CHAT_STATUS') { - upsertChatStatusConfig(data.config, { - agentId: data.agent_id, - teamId: data.team_id, - }) + upsertChatStatusConfig(data.config) } }) @@ -225,7 +221,9 @@ const useChatSocket = () => { const sendUserTyping = async (chat_id: string) => { const type = 'user_typing' - if(!user){ return } + if (!user) { + return + } // await send(type, { // content: user?.first_name, // example: false, diff --git a/apps/ui/src/modals/AIChatModal/hooks/useUpdateChatCache.ts b/apps/ui/src/modals/AIChatModal/hooks/useUpdateChatCache.ts index bf56ffb1f..393296f39 100644 --- a/apps/ui/src/modals/AIChatModal/hooks/useUpdateChatCache.ts +++ b/apps/ui/src/modals/AIChatModal/hooks/useUpdateChatCache.ts @@ -24,7 +24,7 @@ const useUpdateChatCache = () => { teamId?: Nullable chatId?: Nullable } = {}, - ) => { + ) => { let queryVariables = omitBy( { agent_id: agentId, @@ -89,21 +89,12 @@ const useUpdateChatCache = () => { ) } - const upsertChatStatusConfig = ( - config: Record, - { - agentId, - teamId, - }: { - agentId?: Nullable - teamId?: Nullable - } = {}, - ) => { + const upsertChatStatusConfig = (config: Record) => { apolloClient.cache.updateQuery({ query: CONFIGS_GQL }, data => { const configs = data?.configs || [] const newConfigs = [...configs] - const newConfig = { + const newConfig: any = { __typename: 'Config', ...config, } diff --git a/apps/ui/src/modals/AIChatModal/utils/localStorage.ts b/apps/ui/src/modals/AIChatModal/utils/localStorage.ts deleted file mode 100644 index 7f157d9d1..000000000 --- a/apps/ui/src/modals/AIChatModal/utils/localStorage.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { IChat } from '../types' - -// Utility function to save state to local storage -export const saveToLocalStorage = (key: string, value: [IChat]) => { - try { - localStorage.setItem(key, JSON.stringify(value)) - } catch (error) { - console.error(`Error saving to localStorage key=${key}: `, error) - } -} - -// Utility function to load state from local storage -export const loadFromLocalStorage = (key: string, defaultValue: IChat) => { - try { - const savedValue = localStorage.getItem(key) - if (savedValue) { - return JSON.parse(savedValue) - } - } catch (error) { - console.error(`Error loading from localStorage key=${key}: `, error) - } - - return defaultValue -} diff --git a/apps/ui/src/pages/Addons.tsx b/apps/ui/src/pages/Addons.tsx deleted file mode 100644 index a743f70f7..000000000 --- a/apps/ui/src/pages/Addons.tsx +++ /dev/null @@ -1,172 +0,0 @@ -import styled from 'styled-components' -import Modal from 'react-modal' -import { useState } from 'react' - -import concept_map from '../assets/images/concept_map.jpg' -import flow_chart from '../assets/images/flow_chart.jpg' -import mind_map from '../assets/images/mind_map.jpg' -import scamper from '../assets/images/scamper.jpg' - -const addonsData = [ - { name: 'concept map', description: 'concept map', img: concept_map }, - { name: 'flow chart', description: 'flow chart', img: flow_chart }, - { name: 'mind map', description: 'mind map', img: mind_map }, - { name: 's.c.a.m.p.e.r', description: 's.c.a.m.p.e.r', img: scamper }, -] - -const modalData: any = { - step_one: { - header_description: 'First X Free Per Person', - input_title: - 'Maximum number of NFTs someone can mint for free. Subject to Max NFTs Per Person and Max NFTs Per Transaction limits.', - button_value: 'Add', - }, - step_two: { - header_description: 'Max NFTs Per Transaction', - input_title: - 'Maximum number of NFTs someone can mint in one go. Helps prevent botting and give everyone a fair chance to mint.', - button_value: 'Enable', - }, -} - -const Addons = ({ setOpenAddonsModal }: any) => { - const [showModal, setShowModal] = useState(false) - const [modalScreens, setModalScreen] = useState('step_one') - - const onHandleModalClick = () => { - setShowModal(prevValue => !prevValue) - setModalScreen('step_one') - } - - return ( - <> - - - {addonsData.map(item => ( -
- - background - {item.name} - -
{item.name}
-
- ))} -
-
- - - - -

{modalData[modalScreens].header_description}

- x -
-
-

{modalData[modalScreens].input_title}

- -
- - setModalScreen('step_two') : onHandleModalClick - } - > - {modalData[modalScreens].button_value} - -
-
- - ) -} - -export default Addons - -const StyledContainer = styled.div` - display: grid; - align-items: center; - justify-items: center; - height: 100%; -` - -const StyledCard = styled.div` - width: 300px; - height: 200px; - border: 1px solid darkgray; - border-radius: 8px; - overflow: hidden; - position: relative; - cursor: pointer; - img { - width: 100%; - height: 100%; - position: absolute; - } -` - -const StyledModalBody = styled.div` - display: flex; - justify-content: space-around; - align-items: center; - flex-wrap: wrap; - gap: 30px; -` - -const StyledCloseButton = styled.div` - - font-size 25px; - border: 1px solid indigo; - text-align: center; - padding: 0px; - width: 30px; - height: 30px; - border-radius: 50%; - font-size: 18px; - justify-self: end; - cursor: pointer; -` - -export const StyledModalContainer = styled.div` - display: grid; -` - -export const StyledModalHeader = styled.div` - display: flex; - justify-content: space-between; -` - -export const StyledButton = styled.button` - box-sizing: border-box; - text-align: center; - width: 120px; - height: 34px; - background: radial-gradient(52.7% 52.7% at 50% 50%, #3e4ea9 0%, #111b52 100%); - border-radius: 8px; - margin-top: 20px; - justify-self: end; - color: #ffffff; -` diff --git a/apps/ui/src/pages/ApiKeys/EditApiKey/EditApiModal.tsx b/apps/ui/src/pages/ApiKeys/EditApiKey/EditApiModal.tsx index e680b18ae..ae9af9b79 100644 --- a/apps/ui/src/pages/ApiKeys/EditApiKey/EditApiModal.tsx +++ b/apps/ui/src/pages/ApiKeys/EditApiKey/EditApiModal.tsx @@ -40,6 +40,7 @@ type EditApiModalProps = { const EditApiModal = ({ closeModal, data, callback }: EditApiModalProps) => { const { t } = useTranslation() + // @ts-expect-error TODO: fix gamesOptions const { formik, gamesOptions } = useEditApiKey(data) const { setFieldValue } = formik diff --git a/apps/ui/src/services/chat/index.ts b/apps/ui/src/services/chat/index.ts index 254b9a920..be95887ec 100644 --- a/apps/ui/src/services/chat/index.ts +++ b/apps/ui/src/services/chat/index.ts @@ -1,3 +1,2 @@ -export { useUpscaleAiMediaService } from './useUpscaleAiMediaService' export { useCreateChatMessageService } from './useCreateChatMessageService' export { useChatMessagesService } from './useChatMessagesService' diff --git a/apps/ui/src/services/chat/useUpscaleAiMediaService.ts b/apps/ui/src/services/chat/useUpscaleAiMediaService.ts deleted file mode 100644 index 24aa4864c..000000000 --- a/apps/ui/src/services/chat/useUpscaleAiMediaService.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { useMutation } from '@apollo/client' -import UPSCALE_AI_MEDIA_GQL from '../../gql/chat/upscaleAiMedia.gql' -import { IAiMediaPrompt } from 'services/types' - -interface Data { - upscaleAiMedia: IAiMediaPrompt -} - -interface Variables { - id: string - button: string -} - -export const useUpscaleAiMediaService = () => { - const [mutation, { loading }] = useMutation(UPSCALE_AI_MEDIA_GQL) - - const upscaleAiMediaService = async (variables: Variables) => { - const { data, errors } = await mutation({ - variables, - }) - - if (errors?.length || !data) { - throw new Error(errors ? errors[0].message : 'Something went wrong') - } - - return data.upscaleAiMedia - } - - return { - upscaleAiMediaService, - loading, - } -} diff --git a/apps/ui/src/services/interfaces/index.ts b/apps/ui/src/services/interfaces/index.ts index 7e9553931..ae7f4014b 100644 --- a/apps/ui/src/services/interfaces/index.ts +++ b/apps/ui/src/services/interfaces/index.ts @@ -1,4 +1,3 @@ -export * from './game.interface' export * from './account.interface' export * from './user.interface' export * from './accountSetting.interface' diff --git a/apps/ui/src/services/types/chat.ts b/apps/ui/src/services/types/chat.ts index 822e6fc8a..e939124c3 100644 --- a/apps/ui/src/services/types/chat.ts +++ b/apps/ui/src/services/types/chat.ts @@ -1,6 +1,3 @@ - - - export enum ChatMessageVersionEnum { ChatConversational = 'chat_conversational', // PlanAndExecute = 'plan_and_execute', diff --git a/apps/ui/src/services/useAccountService.ts b/apps/ui/src/services/useAccountService.ts index 01c7588bb..3cc415c43 100644 --- a/apps/ui/src/services/useAccountService.ts +++ b/apps/ui/src/services/useAccountService.ts @@ -129,7 +129,8 @@ export const useAssignedUserListService = () => { // refetch, // } return { - data: [] + data: [], + refetch: () => {}, } } diff --git a/apps/ui/src/services/usePropertyService.ts b/apps/ui/src/services/usePropertyService.ts deleted file mode 100644 index ef2badbd7..000000000 --- a/apps/ui/src/services/usePropertyService.ts +++ /dev/null @@ -1,265 +0,0 @@ -import { useMutation, useQuery } from '@apollo/client' -// import { loader } from 'graphql.macro' - -import createPropertyGql from '../gql/property/createProperty.gql' -import propertiesGql from '../gql/property/properties.gql' -import propertyByIdGql from '../gql/property/propertyById.gql' -import updatePropertyByIdGql from '../gql/property/updatePropertyById.gql' -import deletePropertyByIdGql from '../gql/property/deletePropertyById.gql' -import updatePropertyMediaGql from '../gql/property/updatePropertyMedia.gql' - -// type createGameType = { -// name: String -// category: String -// description: String -// } - -type PropertiesType = { - page: number - limit: number - search_text: string - game_id?: string -} - -type PropertyMediasType = { - is_main: boolean - url: string - format: string -} - -export const useCreatePropertyService = () => { - const [mutation] = useMutation(createPropertyGql) - const createPropertyService = async (input: any, callback: any) => { - const { - data: { createProperty }, - } = await mutation({ - variables: { input }, - }) - if (callback) { - callback() - } - - return createProperty - } - - return [createPropertyService] -} - -export const useCreatePropertyInCacheThenServerService = ({ filter }: any) => { - const [createInCacheThenInServer] = useMutation(createPropertyGql, { - update(cache, { data: { createProperty } }) { - const options: any = { - query: propertiesGql, - variables: { filter }, - } - - const existingProperties: any = cache.readQuery(options) - const newProperties = { - ...existingProperties.properties, - items: [createProperty.property, ...existingProperties?.properties?.items], - } - cache.writeQuery({ - ...options, - data: { properties: newProperties }, - }) - }, - }) - - const createPropertyService = async (input: any) => { - const { data } = await createInCacheThenInServer({ - variables: { - input, - }, - optimisticResponse: { - createProperty: { - property: { - ...input, - config: null, - status: 'Pending', - id: 'TEMP-ID', - parent_id: null, - modified_by: null, - modified_on: new Date().toString(), - created_by: '36', - account_id: '36', - created_on: new Date().toString(), - __typename: 'Property', - }, - success: true, - message: 'The property was added in cache', - }, - }, - }) - - return data - } - - return [createPropertyService] -} - -export const usePropertiesService = ({ page, limit, search_text, game_id }: PropertiesType) => { - const { - data: { properties } = [], - error, - loading, - refetch, - } = useQuery(propertiesGql, { - variables: { - filter: { - game_id, - - search_text, - page, - limit, - sort: 'name', - order: 'ASC', - }, - }, - skip: !game_id, - fetchPolicy: 'cache-and-network', - // nextFetchPolicy: 'cache-only', - }) - - return { - data: properties || [], - error, - loading, - refetch, - } -} - -export const usePropertyIdService = ({ id }: { id?: any }) => { - const { - data: { propertyById } = [], - error, - loading, - refetch, - } = useQuery(propertyByIdGql, { - variables: { id }, - skip: !id, - }) - - return { - data: propertyById || {}, - error, - loading, - refetch, - } -} - -export const useUpdatePropertyByIdService = () => { - const [mutation] = useMutation(updatePropertyByIdGql) - const updatePropertyById = async (id: any, input: any): Promise<{ success: boolean }> => { - const { - data: { asset }, - } = await mutation({ - variables: { - id, - input, - }, - }) - return asset - } - - return [updatePropertyById] -} - -export const useUpdateCacheThenServerProperty = () => { - const [updateCacheThenServer] = useMutation(updatePropertyByIdGql, { - update(cache, { data }) { - cache.writeQuery({ - query: updatePropertyByIdGql, - data: { - updateProperty: { - property: { - ...data.updateProperty.property, - }, - success: true, - message: 'The property was successfully updated', - }, - }, - variables: { - id: data.updateProperty.property.id, - }, - }) - }, - }) - - const updateFn = ({ field, newValue, params }: { field: string; newValue: any; params: any }) => { - updateCacheThenServer({ - variables: { - id: params.data.id, - input: { - [field]: newValue, - game_id: params.data.game_id, - }, - }, - optimisticResponse: { - updateProperty: { - property: { - ...params.data, - id: params.data.id, - [field]: newValue, - }, - success: true, - message: 'The property was successfully updated', - }, - }, - }) - } - - return updateFn -} - -// export const useUpdatePropertyByIdInCache = (client: any) => { -// const writeQuery = client.writeQuery; -// const [mutation] = writeQuery(updatePropertyByIdGql); -// const updatePropertyByIdInCache = async ( -// id: any, -// input: any -// ): Promise<{ success: boolean }> => { -// const { -// data: { asset }, -// } = await mutation({ -// variables: { -// id, -// input, -// }, -// }); -// return asset; -// }; - -// return [updatePropertyByIdInCache]; -// }; - -export const useDeletePropertyByIdService = () => { - const [mutation] = useMutation(deletePropertyByIdGql) - - const deletePropertyById = async (id: string): Promise<{ message: string; success: boolean }> => { - const { - data: { deleteProperty }, - } = await mutation({ variables: { id } }) - return deleteProperty - } - return [deletePropertyById] -} - -export const useUpdatePropertyMedia = () => { - const [mutation] = useMutation(updatePropertyMediaGql) - const updatePropertyMedia = async ( - id: string, - input: PropertyMediasType[], - ): Promise<{ success: boolean }> => { - const { - data: { updatePropertyMedia }, - } = await mutation({ - variables: { - id, - input, - }, - }) - return updatePropertyMedia - } - - return [updatePropertyMedia] -} diff --git a/apps/ui/vite.config.ts b/apps/ui/vite.config.ts index aec455850..8a56ab679 100644 --- a/apps/ui/vite.config.ts +++ b/apps/ui/vite.config.ts @@ -16,7 +16,7 @@ export default defineConfig({ envPrefix: 'REACT_APP_', plugins: [ graphql() as any, - eslint({ emitWarning: false, cache: false }), + eslint(), react(), envCompatible(), viteTsconfigPaths(),