From 6173faf290f0e2c921fcec6e08b3e0895d895ccb Mon Sep 17 00:00:00 2001 From: ratankods <90516956+duplixx@users.noreply.github.com> Date: Fri, 24 May 2024 20:34:11 +0530 Subject: [PATCH 01/15] advertisement and plugin screen --- public/locales/en.json | 4 +- .../ActionItems/ActionItemsModal.tsx | 8 +- .../core/AddOnEntry/AddOnEntry.module.css | 6 +- .../AddOn/core/AddOnEntry/AddOnEntry.tsx | 15 +- .../core/AddOnStore/AddOnStore.module.css | 45 ++- .../AddOn/core/AddOnStore/AddOnStore.tsx | 360 ++++++++---------- .../support/services/Plugin.helper.test.ts | 13 +- .../AddOn/support/services/Plugin.helper.ts | 32 +- .../Advertisements/Advertisements.module.css | 26 +- .../Advertisements/Advertisements.tsx | 57 ++- .../AdvertisementEntry.module.css | 6 +- .../AdvertisementEntry/AdvertisementEntry.tsx | 27 +- .../AdvertisementRegister.module.css | 3 +- .../AdvertisementRegister.tsx | 8 +- .../EventCalendar/EventCalendar.module.css | 1 + 15 files changed, 353 insertions(+), 258 deletions(-) diff --git a/public/locales/en.json b/public/locales/en.json index 97d63a5073..3d80133f5c 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -745,7 +745,7 @@ "pDesc": "This Plugin enables UI for" }, "addOnStore": { - "title": "Add On Store", + "title": "Plugin Store", "searchName": "Ex: Donations", "enable": "Enabled", "disable": "Disabled", @@ -1028,7 +1028,7 @@ "RstartDate": "Select Start Date", "RendDate": "Select End Date", "RClose": "Close the window", - "addNew": "Create new advertisement", + "addNew": "Create", "EXname": "Ex. Cookie Shop", "EXlink": "Ex. http://yourwebsite.com/photo", "register": "Create Advertisement", diff --git a/src/components/ActionItems/ActionItemsModal.tsx b/src/components/ActionItems/ActionItemsModal.tsx index 8b8cafba4a..315eb1701d 100644 --- a/src/components/ActionItems/ActionItemsModal.tsx +++ b/src/components/ActionItems/ActionItemsModal.tsx @@ -19,8 +19,8 @@ export const ActionItemsModal = (props: InterfaceModalProp): JSX.Element => { return ( <> { diff --git a/src/components/AddOn/core/AddOnEntry/AddOnEntry.module.css b/src/components/AddOn/core/AddOnEntry/AddOnEntry.module.css index 1f1ea89996..c5dd86c8d4 100644 --- a/src/components/AddOn/core/AddOnEntry/AddOnEntry.module.css +++ b/src/components/AddOn/core/AddOnEntry/AddOnEntry.module.css @@ -7,8 +7,12 @@ margin-left: auto; display: flex !important; align-items: center; + background-color: transparent; + color: #31bb6b; +} +.card { + border: 4px solid green; } - .entryaction i { margin-right: 8px; } diff --git a/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx b/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx index 6f2cdaf1dc..76207a0a5d 100644 --- a/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx +++ b/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx @@ -15,9 +15,9 @@ interface InterfaceAddOnEntryProps { description: string; createdBy: string; component: string; - modified: any; + modified: boolean; uninstalledOrgs: string[]; - getInstalledPlugins: () => any; + getInstalledPlugins: () => void; } function addOnEntry({ @@ -28,9 +28,11 @@ function addOnEntry({ uninstalledOrgs, getInstalledPlugins, }: InterfaceAddOnEntryProps): JSX.Element { + console.log(id); const { t } = useTranslation('translation', { keyPrefix: 'addOnEntry' }); //getting orgId from URL const { orgId: currentOrg } = useParams(); + // console.log(currentOrg); if (!currentOrg) { return ; } @@ -62,7 +64,10 @@ function addOnEntry({ return ( <> - + {/* {uninstalledOrgs.includes(currentOrg) && ( )} */} - {title} + {title} {createdBy} @@ -95,7 +100,7 @@ function addOnEntry({ ) : ( )} {/* {installed ? 'Remove' : configurable ? 'Installed' : 'Install'} */} diff --git a/src/components/AddOn/core/AddOnStore/AddOnStore.module.css b/src/components/AddOn/core/AddOnStore/AddOnStore.module.css index 8a34c03be5..9f5bb6c868 100644 --- a/src/components/AddOn/core/AddOnStore/AddOnStore.module.css +++ b/src/components/AddOn/core/AddOnStore/AddOnStore.module.css @@ -11,8 +11,12 @@ border-bottom: 3px solid #31bb6b; width: 15%; } - -.actioninput { +.input { + display: flex; + position: relative; + width: 560px; +} +/* .actioninput { text-decoration: none; margin-bottom: 50px; border-color: #e8e5e5; @@ -23,9 +27,46 @@ padding-right: 10px; padding-left: 10px; box-shadow: none; +} */ +.actioninput { + margin-top: 10px; + margin-bottom: 10px; + background-color: white; + box-shadow: 0 1px 1px #31bb6b; +} +.inputField > button { + padding-top: 10px; + padding-bottom: 10px; } .actionradio input { width: fit-content; margin: inherit; } +.cardGridItem { + width: 38vw; +} +.justifysp { + display: grid; + width: 100%; + justify-content: space-between; + align-items: baseline; + grid-template-rows: auto; + grid-template-columns: repeat(2, 1fr); + grid-gap: 0.8rem 0.4rem; +} + +@media screen and (max-width: 600px) { + .cardGridItem { + width: 100%; + } + .justifysp { + display: grid; + width: 100%; + justify-content: center; + align-items: start; + grid-template-rows: auto; + grid-template-columns: 1fr; + grid-gap: 0.8rem 0.4rem; + } +} diff --git a/src/components/AddOn/core/AddOnStore/AddOnStore.tsx b/src/components/AddOn/core/AddOnStore/AddOnStore.tsx index 9eb65f9241..2b1e1676eb 100644 --- a/src/components/AddOn/core/AddOnStore/AddOnStore.tsx +++ b/src/components/AddOn/core/AddOnStore/AddOnStore.tsx @@ -1,15 +1,27 @@ import React, { useState } from 'react'; -// import PropTypes from 'react'; import styles from './AddOnStore.module.css'; import AddOnEntry from '../AddOnEntry/AddOnEntry'; -import Action from '../../support/components/Action/Action'; import { useQuery } from '@apollo/client'; import { PLUGIN_GET } from 'GraphQl/Queries/Queries'; // PLUGIN_LIST -import { Col, Form, Row, Tab, Tabs } from 'react-bootstrap'; +import { Col, Dropdown, Form, Row, Tab, Tabs, Button } from 'react-bootstrap'; import PluginHelper from 'components/AddOn/support/services/Plugin.helper'; import { store } from './../../../../state/store'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; +import { Search } from '@mui/icons-material'; + +interface InterfacePluginHelper { + _id: string; + pluginName?: string; + pluginDesc?: string; + pluginCreatedBy: string; + pluginInstallStatus?: boolean; + uninstalledOrgs: string[]; + installed: boolean; + enabled: boolean; + name: string; + component: string; +} function addOnStore(): JSX.Element { const { t } = useTranslation('translation', { keyPrefix: 'addOnStore' }); @@ -18,51 +30,42 @@ function addOnStore(): JSX.Element { const [isStore, setIsStore] = useState(true); const [showEnabled, setShowEnabled] = useState(true); const [searchText, setSearchText] = useState(''); - const [, setDataList] = useState([]); + const [, setDataList] = useState([]); - // type plugData = { pluginName: String, plug }; - const { data, loading } = useQuery(PLUGIN_GET); + const { data, loading } = useQuery<{ getPlugins: InterfacePluginHelper[] }>( + PLUGIN_GET, + ); + console.log(data); - const { orgId } = useParams(); + const { orgId } = useParams<{ orgId: string }>(); /* istanbul ignore next */ const getStorePlugins = async (): Promise => { let plugins = await new PluginHelper().fetchStore(); const installIds = (await new PluginHelper().fetchInstalled()).map( - (plugin: any) => plugin.id, + (plugin: InterfacePluginHelper) => plugin._id, ); - plugins = plugins.map((plugin: any) => { - plugin.installed = installIds.includes(plugin.id); + plugins = plugins.map((plugin: InterfacePluginHelper) => { + plugin.installed = installIds.includes(plugin._id); return plugin; }); store.dispatch({ type: 'UPDATE_STORE', payload: plugins }); }; - /* istanbul ignore next */ - const getInstalledPlugins: () => any = () => { - setDataList(data); - // setRender((current) => !current); - // const { - // data: newData, - // loading: newLoading, - // error: newError, - // } = useQuery(PLUGIN_GET); - // data = newData; - // loading = newLoading; - // error = newError; - // const plugins = await new PluginHelper().fetchInstalled(); - // store.dispatch({ type: 'UPDATE_INSTALLED', payload: plugins }); - // return plugins; + const getInstalledPlugins = (): void => { + if (data) { + setDataList(data.getPlugins); + } }; - const updateSelectedTab = (tab: any): void => { + const updateSelectedTab = (tab: string | null): void => { setIsStore(tab === 'available'); /* istanbul ignore next */ isStore ? getStorePlugins() : getInstalledPlugins(); }; - const filterChange = (ev: any): void => { - setShowEnabled(ev.target.value === 'enabled'); + const filterChange = (eventKey: string): void => { + setShowEnabled(eventKey === 'enabled'); }; /* istanbul ignore next */ @@ -75,9 +78,23 @@ function addOnStore(): JSX.Element { } return ( <> - - - + + +
setSearchText(e.target.value)} /> - + +
{!isStore && ( - -
-
- - -
-
-
+ filterChange(e ? e : '')}> + + {showEnabled ? t('enable') : t('disable')} + + + + {t('enable')} + + + {t('disable')} + + + )} - -
-

{t('pHeading')}

- {searchText ? ( -

- Search results for {searchText} -

- ) : null} - - + + - - {data.getPlugins.filter( - (val: { - _id: string; - pluginName: string | undefined; - pluginDesc: string | undefined; - pluginCreatedBy: string; - pluginInstallStatus: boolean | undefined; - getInstalledPlugins: () => any; - }) => { - if (searchText == '') { - return val; - } else if ( - val.pluginName - ?.toLowerCase() - .includes(searchText.toLowerCase()) - ) { - return val; - } - }, - ).length === 0 ? ( +
+ {data?.getPlugins.filter((val: InterfacePluginHelper) => { + if (searchText == '') { + return val; + } else if ( + val.pluginName + ?.toLowerCase() + .includes(searchText.toLowerCase()) + ) { + return val; + } + }).length === 0 ? (

{t('pMessage')}

) : ( - data.getPlugins - .filter( - (val: { - _id: string; - pluginName: string | undefined; - pluginDesc: string | undefined; - pluginCreatedBy: string; - pluginInstallStatus: boolean | undefined; - getInstalledPlugins: () => any; - }) => { +
+ {data?.getPlugins + .filter((val: InterfacePluginHelper) => { if (searchText == '') { return val; } else if ( @@ -176,51 +165,56 @@ function addOnStore(): JSX.Element { ) { return val; } - }, - ) - .map( - ( - plug: { - _id: string; - pluginName: string | undefined; - pluginDesc: string | undefined; - pluginCreatedBy: string; - uninstalledOrgs: string[]; - getInstalledPlugins: () => any; - }, - i: React.Key | null | undefined, - ): JSX.Element => ( - - ), - ) + }) + .map( + ( + plug: InterfacePluginHelper, + i: React.Key | null | undefined, + ): JSX.Element => ( +
+ +
+ ), + )} +
)} - - - {data.getPlugins +
+
+ +
+ {data?.getPlugins .filter( - (plugin: any) => !plugin.uninstalledOrgs.includes(orgId), + (plugin: InterfacePluginHelper) => + !plugin.uninstalledOrgs.includes(orgId ?? ''), ) - .filter( - (val: { - _id: string; - pluginName: string | undefined; - pluginDesc: string | undefined; - pluginCreatedBy: string; - pluginInstallStatus: boolean | undefined; - getInstalledPlugins: () => any; - }) => { + .filter((val: InterfacePluginHelper) => { + if (searchText === '') { + return val; + } else if ( + val.pluginName + ?.toLowerCase() + .includes(searchText.toLowerCase()) + ) { + return val; + } + }).length === 0 ? ( +

{t('pMessage')}

+ ) : ( + data?.getPlugins + .filter( + (plugin: InterfacePluginHelper) => + !plugin.uninstalledOrgs.includes(orgId ?? ''), + ) + .filter((val: InterfacePluginHelper) => { if (searchText == '') { return val; } else if ( @@ -230,67 +224,31 @@ function addOnStore(): JSX.Element { ) { return val; } - }, - ).length === 0 ? ( -

{t('pMessage')}

- ) : ( - data.getPlugins - .filter( - (plugin: any) => !plugin.uninstalledOrgs.includes(orgId), - ) - .filter( - (val: { - _id: string; - pluginName: string | undefined; - pluginDesc: string | undefined; - pluginCreatedBy: string; - pluginInstallStatus: boolean | undefined; - getInstalledPlugins: () => any; - }) => { - if (searchText == '') { - return val; - } else if ( - val.pluginName - ?.toLowerCase() - .includes(searchText.toLowerCase()) - ) { - return val; - } - }, - ) + }) .map( ( - plug: { - _id: string; - pluginName: string | undefined; - pluginDesc: string | undefined; - pluginCreatedBy: string; - uninstalledOrgs: string[]; - pluginInstallStatus: boolean | undefined; - getInstalledPlugins: () => any; - }, + plug: InterfacePluginHelper, i: React.Key | null | undefined, ): JSX.Element => ( - +
+ +
), ) )} - - -
- +
+ + +
); diff --git a/src/components/AddOn/support/services/Plugin.helper.test.ts b/src/components/AddOn/support/services/Plugin.helper.test.ts index e024734247..39f0a5d12c 100644 --- a/src/components/AddOn/support/services/Plugin.helper.test.ts +++ b/src/components/AddOn/support/services/Plugin.helper.test.ts @@ -9,7 +9,18 @@ describe('Testing src/components/AddOn/support/services/Plugin.helper.ts', () => expect(pluginHelper).toHaveProperty('generateLinks'); }); test('generateLinks should return proper objects', () => { - const obj = { enabled: true, name: 'demo', component: 'samplecomponent' }; + const obj = { + enabled: true, + name: 'demo', + component: 'samplecomponent', + _id: 'someId', + pluginName: 'pluginName', + pluginDesc: 'pluginDesc', + pluginCreatedBy: 'creator', + pluginInstallStatus: true, + uninstalledOrgs: ['org1', 'org2'], + installed: true, + }; const objToMatch = { name: 'demo', url: '/plugin/samplecomponent' }; const pluginHelper = new PluginHelper(); const val = pluginHelper.generateLinks([obj]); diff --git a/src/components/AddOn/support/services/Plugin.helper.ts b/src/components/AddOn/support/services/Plugin.helper.ts index 4730f0c568..1f3ddf8e03 100644 --- a/src/components/AddOn/support/services/Plugin.helper.ts +++ b/src/components/AddOn/support/services/Plugin.helper.ts @@ -1,18 +1,34 @@ +interface InterfacePluginHelper { + _id: string; + pluginName?: string; + pluginDesc?: string; + pluginCreatedBy: string; + pluginInstallStatus?: boolean; + uninstalledOrgs: string[]; + installed: boolean; + enabled: boolean; + name: string; + component: string; +} + class PluginHelper { - fetchStore = async (): Promise => { - const result = await fetch(`http://localhost:${process.env.PORT}/store`); - return await result.json(); + fetchStore = async (): Promise => { + const port = process.env.PORT || '4321'; // Default to 4321 if PORT is not defined + const result = await fetch(`http://localhost:${port}/store`); + return (await result.json()) as InterfacePluginHelper[]; }; - fetchInstalled = async (): Promise => { + fetchInstalled = async (): Promise => { const result = await fetch(`http://localhost:3005/installed`); - return await result.json(); + return (await result.json()) as InterfacePluginHelper[]; }; - generateLinks = (plugins: any[]): { name: string; url: string }[] => { + generateLinks = ( + plugins: InterfacePluginHelper[], + ): { name: string; url: string }[] => { return plugins - .filter((plugin: any) => plugin.enabled) - .map((installedPlugin: any) => { + .filter((plugin) => plugin.enabled) + .map((installedPlugin) => { return { name: installedPlugin.name, url: `/plugin/${installedPlugin.component.toLowerCase()}`, diff --git a/src/components/Advertisements/Advertisements.module.css b/src/components/Advertisements/Advertisements.module.css index 8a34c03be5..6d9eb7f612 100644 --- a/src/components/Advertisements/Advertisements.module.css +++ b/src/components/Advertisements/Advertisements.module.css @@ -1,6 +1,13 @@ .container { display: flex; } +.listBox { + display: grid; + width: 100%; + grid-template-rows: auto; + grid-template-columns: repeat(6, 1fr); + grid-gap: 0.8rem 0.4rem; +} .logintitle { color: #707070; @@ -11,15 +18,24 @@ border-bottom: 3px solid #31bb6b; width: 15%; } - +.input { + display: flex; + position: relative; + width: 560px; +} +.justifysp { + display: grid; + width: 100%; + margin-top: 30px; +} .actioninput { text-decoration: none; - margin-bottom: 50px; + /* margin-bottom: 50px; */ border-color: #e8e5e5; - width: 80%; + background-color: white; border-radius: 7px; - padding-top: 5px; - padding-bottom: 5px; + padding-top: 10px; + padding-bottom: 10px; padding-right: 10px; padding-left: 10px; box-shadow: none; diff --git a/src/components/Advertisements/Advertisements.tsx b/src/components/Advertisements/Advertisements.tsx index 95b95fb936..870ae37263 100644 --- a/src/components/Advertisements/Advertisements.tsx +++ b/src/components/Advertisements/Advertisements.tsx @@ -2,15 +2,17 @@ import React, { useEffect, useState } from 'react'; import styles from './Advertisements.module.css'; import { useQuery } from '@apollo/client'; import { ORGANIZATION_ADVERTISEMENT_LIST } from 'GraphQl/Queries/Queries'; -import { Col, Row, Tab, Tabs } from 'react-bootstrap'; +import { Button, Col, Form, Row, Tab, Tabs } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; import AdvertisementEntry from './core/AdvertisementEntry/AdvertisementEntry'; import AdvertisementRegister from './core/AdvertisementRegister/AdvertisementRegister'; import { useParams } from 'react-router-dom'; import type { InterfaceQueryOrganizationAdvertisementListItem } from 'utils/interfaces'; import InfiniteScroll from 'react-infinite-scroll-component'; +import { Search } from '@mui/icons-material'; export default function advertisements(): JSX.Element { + // const [searchText, setSearchText] = React.useState(); const { orgId: currentOrgId } = useParams(); const { t } = useTranslation('translation', { keyPrefix: 'advertisement' }); document.title = t('title'); @@ -21,8 +23,8 @@ export default function advertisements(): JSX.Element { name: string; type: 'BANNER' | 'MENU' | 'POPUP'; mediaUrl: string; - endDate: string; // Assuming it's a string in the format 'yyyy-MM-dd' - startDate: string; // Assuming it's a string in the format 'yyyy-MM-dd' + endDate: string; + startDate: string; }; const { @@ -32,6 +34,7 @@ export default function advertisements(): JSX.Element { data?: { organizations: InterfaceQueryOrganizationAdvertisementListItem[]; }; + // eslint-disable-next-line refetch: any; } = useQuery(ORGANIZATION_ADVERTISEMENT_LIST, { variables: { @@ -72,15 +75,45 @@ export default function advertisements(): JSX.Element { return ( <> - +
- + +
+ setSearchText("search")} + /> + +
+ + + - + new Date(ad.endDate) > new Date(), ).length !== 0 && (
-
{t('endOfResults')}
+ {/*
{t('endOfResults')}
*/}
) } @@ -155,7 +188,11 @@ export default function advertisements(): JSX.Element { )}
- + new Date(ad.endDate) < new Date(), ).length !== 0 && (
-
{t('endOfResults')}
+ {/*
{t('endOfResults')}
*/}
) } diff --git a/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.module.css b/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.module.css index 879d96a0a0..e4f244807f 100644 --- a/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.module.css +++ b/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.module.css @@ -20,7 +20,7 @@ .admedia { object-fit: cover; - height: 20rem; + height: 16rem; } .buttons { @@ -28,6 +28,10 @@ justify-content: flex-end; } +.card { + width: 28rem; +} + .dropdownButton { background-color: transparent; color: #000; diff --git a/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx b/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx index c6faa21de8..bf534261b8 100644 --- a/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx +++ b/src/components/Advertisements/core/AdvertisementEntry/AdvertisementEntry.tsx @@ -10,14 +10,6 @@ import AdvertisementRegister from '../AdvertisementRegister/AdvertisementRegiste import MoreVertIcon from '@mui/icons-material/MoreVert'; import { toast } from 'react-toastify'; -type Ad = { - _id: string; - name: string; - type: 'BANNER' | 'MENU' | 'POPUP'; - mediaUrl: string; - endDate: string; // Assuming it's a string in the format 'yyyy-MM-dd' - startDate: string; // Assuming it's a string in the format 'yyyy-MM-dd' -}; interface InterfaceAddOnEntryProps { id: string; name: string; @@ -26,7 +18,7 @@ interface InterfaceAddOnEntryProps { organizationId: string; startDate: Date; endDate: Date; - setAfter: any; + setAfter: (after: string | null) => void; } function advertisementEntry({ id, @@ -38,6 +30,7 @@ function advertisementEntry({ startDate, setAfter, }: InterfaceAddOnEntryProps): JSX.Element { + console.log(id, type); const { t } = useTranslation('translation', { keyPrefix: 'advertisement' }); const [buttonLoading, setButtonLoading] = useState(false); const [dropdown, setDropdown] = useState(false); @@ -64,9 +57,11 @@ function advertisementEntry({ toast.error('Advertisement Deleted'); setButtonLoading(false); setAfter(null); - } catch (error: any) { - toast.error(error.message); - setButtonLoading(false); + } catch (error: unknown) { + if (error instanceof Error) { + toast.error(error.message); + setButtonLoading(false); + } } }; const handleOptionsClick = (): void => { @@ -77,7 +72,7 @@ function advertisementEntry({ {Array.from({ length: 1 }).map((_, idx) => ( - +
{!isStore && ( - filterChange(e ? e : '')}> - + filterChange(e ? e : '') + } + > + {showEnabled ? t('enable') : t('disable')} @@ -172,111 +194,71 @@ function addOnStore(): JSX.Element { style={{ backgroundColor: 'white' }} >
- {data?.getPlugins.filter((val: InterfacePluginHelper) => { - if (searchText == '') { - return val; - } else if ( - val.pluginName - ?.toLowerCase() - .includes(searchText.toLowerCase()) - ) { - return val; + {(() => { + const filteredPlugins = filterPlugins( + data?.getPlugins || [], + searchText, + ); + + if (filteredPlugins.length === 0) { + return

{t('pMessage')}

; } - }).length === 0 ? ( -

{t('pMessage')}

- ) : ( -
- {data?.getPlugins - .filter((val: InterfacePluginHelper) => { - if (searchText == '') { - return val; - } else if ( - val.pluginName - ?.toLowerCase() - .includes(searchText.toLowerCase()) - ) { - return val; - } - }) - .map( - ( - plug: InterfacePluginHelper, - i: React.Key | null | undefined, - ): JSX.Element => ( -
- -
- ), - )} -
- )} -
-
- -
- {data?.getPlugins - .filter( - (plugin: InterfacePluginHelper) => - !plugin.uninstalledOrgs.includes(orgId ?? ''), - ) - .filter((val: InterfacePluginHelper) => { - if (searchText === '') { - return val; - } else if ( - val.pluginName - ?.toLowerCase() - .includes(searchText.toLowerCase()) - ) { - return val; - } - }).length === 0 ? ( -

{t('pMessage')}

- ) : ( - data?.getPlugins - .filter( - (plugin: InterfacePluginHelper) => - !plugin.uninstalledOrgs.includes(orgId ?? ''), - ) - .filter((val: InterfacePluginHelper) => { - if (searchText == '') { - return val; - } else if ( - val.pluginName - ?.toLowerCase() - .includes(searchText.toLowerCase()) - ) { - return val; - } - }) - .map( - ( - plug: InterfacePluginHelper, - i: React.Key | null | undefined, - ): JSX.Element => ( + + return ( +
+ {filteredPlugins.map((plug, i) => (
- ), - ) - )} + ))} +
+ ); + })()} +
+
+ +
+ {(() => { + const installedPlugins = (data?.getPlugins || []).filter( + (plugin) => !plugin.uninstalledOrgs.includes(orgId ?? ''), + ); + const filteredPlugins = filterPlugins( + installedPlugins, + searchText, + ); + + if (filteredPlugins.length === 0) { + return

{t('pMessage')}

; + } + + return filteredPlugins.map((plug, i) => ( +
+ +
+ )); + })()}
diff --git a/src/components/Advertisements/Advertisements.tsx b/src/components/Advertisements/Advertisements.tsx index f860de365a..5f0e2b2033 100644 --- a/src/components/Advertisements/Advertisements.tsx +++ b/src/components/Advertisements/Advertisements.tsx @@ -34,15 +34,9 @@ export default function advertisements(): JSX.Element { }; // GraphQL query to fetch the list of advertisements - const { - data: orgAdvertisementListData, - refetch, - }: { - data?: { - organizations: InterfaceQueryOrganizationAdvertisementListItem[]; - }; - refetch: any; - } = useQuery(ORGANIZATION_ADVERTISEMENT_LIST, { + const { data: orgAdvertisementListData, refetch } = useQuery<{ + organizations: InterfaceQueryOrganizationAdvertisementListItem[]; + }>(ORGANIZATION_ADVERTISEMENT_LIST, { variables: { id: currentOrgId, after: after, From 82836f05f2f83b12e3b2b89b11e40b74de25ee4a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:53:41 -0800 Subject: [PATCH 05/15] chore(deps): bump sass from 1.80.6 to 1.80.7 (#2433) Bumps [sass](https://github.com/sass/dart-sass) from 1.80.6 to 1.80.7. - [Release notes](https://github.com/sass/dart-sass/releases) - [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md) - [Commits](https://github.com/sass/dart-sass/compare/1.80.6...1.80.7) --- updated-dependencies: - dependency-name: sass dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0add51da52..165eb104cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -112,7 +112,7 @@ "jest-preview": "^0.3.1", "lint-staged": "^15.2.8", "postcss-modules": "^6.0.0", - "sass": "^1.80.6", + "sass": "^1.80.7", "tsx": "^4.19.1", "vite-plugin-svgr": "^4.2.0", "whatwg-fetch": "^3.6.20" @@ -10617,9 +10617,9 @@ } }, "node_modules/immutable": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.5.tgz", - "integrity": "sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.2.tgz", + "integrity": "sha512-1NU7hWZDkV7hJ4PJ9dur9gTNQ4ePNPN4k9/0YhwjzykTi/+3Q5pF93YU5QoVj8BuOnhLgaY8gs0U2pj4kSYVcw==", "devOptional": true }, "node_modules/import-fresh": { @@ -16284,13 +16284,13 @@ } }, "node_modules/sass": { - "version": "1.80.6", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.80.6.tgz", - "integrity": "sha512-ccZgdHNiBF1NHBsWvacvT5rju3y1d/Eu+8Ex6c21nHp2lZGLBEtuwc415QfiI1PJa1TpCo3iXwwSRjRpn2Ckjg==", + "version": "1.80.7", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.80.7.tgz", + "integrity": "sha512-MVWvN0u5meytrSjsU7AWsbhoXi1sc58zADXFllfZzbsBT1GHjjar6JwBINYPRrkx/zqnQ6uqbQuHgE95O+C+eQ==", "devOptional": true, "dependencies": { "chokidar": "^4.0.0", - "immutable": "^4.0.0", + "immutable": "^5.0.2", "source-map-js": ">=0.6.2 <2.0.0" }, "bin": { diff --git a/package.json b/package.json index 892a1331e4..f31394fce1 100644 --- a/package.json +++ b/package.json @@ -146,7 +146,7 @@ "jest-preview": "^0.3.1", "lint-staged": "^15.2.8", "postcss-modules": "^6.0.0", - "sass": "^1.80.6", + "sass": "^1.80.7", "tsx": "^4.19.1", "vite-plugin-svgr": "^4.2.0", "whatwg-fetch": "^3.6.20" From a97314cbf994d3b02c24a458cd256db1a4148b27 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:54:06 -0800 Subject: [PATCH 06/15] chore(deps): bump eslint-plugin-import from 2.30.0 to 2.31.0 (#2434) Bumps [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) from 2.30.0 to 2.31.0. - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.30.0...v2.31.0) --- updated-dependencies: - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 13 +++++++------ package.json | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 165eb104cc..872a2773ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -99,7 +99,7 @@ "babel-jest": "^29.7.0", "cross-env": "^7.0.3", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.30.0", + "eslint-plugin-import": "^2.31.0", "eslint-plugin-jest": "^28.8.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.1", @@ -8910,9 +8910,9 @@ } }, "node_modules/eslint-plugin-import": { - "version": "2.30.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.30.0.tgz", - "integrity": "sha512-/mHNE9jINJfiD2EKkg1BKyPyUk4zdnT54YgbOgfjSakWT5oyX/qQLVNTkehyfpcMxZXMy1zyonZ2v7hZTX43Yw==", + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz", + "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==", "dev": true, "dependencies": { "@rtsao/scc": "^1.1.0", @@ -8923,7 +8923,7 @@ "debug": "^3.2.7", "doctrine": "^2.1.0", "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.9.0", + "eslint-module-utils": "^2.12.0", "hasown": "^2.0.2", "is-core-module": "^2.15.1", "is-glob": "^4.0.3", @@ -8932,13 +8932,14 @@ "object.groupby": "^1.0.3", "object.values": "^1.2.0", "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.8", "tsconfig-paths": "^3.15.0" }, "engines": { "node": ">=4" }, "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" } }, "node_modules/eslint-plugin-import/node_modules/debug": { diff --git a/package.json b/package.json index f31394fce1..89f47e405d 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "babel-jest": "^29.7.0", "cross-env": "^7.0.3", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.30.0", + "eslint-plugin-import": "^2.31.0", "eslint-plugin-jest": "^28.8.0", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.1", From 32eb6a9d37f08c9afa2670ddcd12c162a2d04c51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:54:35 -0800 Subject: [PATCH 07/15] chore(deps): bump @mui/x-charts from 7.22.1 to 7.22.2 (#2435) Bumps [@mui/x-charts](https://github.com/mui/mui-x/tree/HEAD/packages/x-charts) from 7.22.1 to 7.22.2. - [Release notes](https://github.com/mui/mui-x/releases) - [Changelog](https://github.com/mui/mui-x/blob/v7.22.2/CHANGELOG.md) - [Commits](https://github.com/mui/mui-x/commits/v7.22.2/packages/x-charts) --- updated-dependencies: - dependency-name: "@mui/x-charts" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 872a2773ca..a06030b145 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@mui/material": "^6.1.6", "@mui/private-theming": "^6.1.6", "@mui/system": "^6.1.6", - "@mui/x-charts": "^7.22.1", + "@mui/x-charts": "^7.22.2", "@mui/x-data-grid": "^7.22.1", "@mui/x-date-pickers": "^7.22.1", "@pdfme/generator": "^5.1.7", @@ -3938,9 +3938,9 @@ } }, "node_modules/@mui/x-charts": { - "version": "7.22.1", - "resolved": "https://registry.npmjs.org/@mui/x-charts/-/x-charts-7.22.1.tgz", - "integrity": "sha512-zgr8CN4yLen5puqaX7Haj5+AoVG7E13HHsIiDoEAuQvuFDF0gKTxTTdLSKXqhd1qJUIIzJaztZtrr3YCVrENqw==", + "version": "7.22.2", + "resolved": "https://registry.npmjs.org/@mui/x-charts/-/x-charts-7.22.2.tgz", + "integrity": "sha512-0Y2du4Ed7gOT53l8vVJ4vKT+Jz4Dh/iHnLy8TtL3+XhbPH9Ndu9Q30WwyyzOn84yt37hSUru/njQ1BWaSvVPHw==", "dependencies": { "@babel/runtime": "^7.25.7", "@mui/utils": "^5.16.6 || ^6.0.0", diff --git a/package.json b/package.json index 89f47e405d..e1eba54ff0 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@mui/material": "^6.1.6", "@mui/private-theming": "^6.1.6", "@mui/system": "^6.1.6", - "@mui/x-charts": "^7.22.1", + "@mui/x-charts": "^7.22.2", "@mui/x-data-grid": "^7.22.1", "@mui/x-date-pickers": "^7.22.1", "@pdfme/schemas": "^5.1.6", From ab509f625c2b086870e0d10971002391deefdec4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:54:56 -0800 Subject: [PATCH 08/15] chore(deps): bump @types/react from 18.3.3 to 18.3.12 (#2436) Bumps [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) from 18.3.3 to 18.3.12. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index a06030b145..f54418a39c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -85,7 +85,7 @@ "@types/js-cookie": "^3.0.6", "@types/node": "^22.5.4", "@types/node-fetch": "^2.6.10", - "@types/react": "^18.3.3", + "@types/react": "^18.3.12", "@types/react-beautiful-dnd": "^13.1.8", "@types/react-bootstrap": "^0.32.37", "@types/react-chartjs-2": "^2.5.7", @@ -5602,9 +5602,9 @@ "integrity": "sha512-hCZTSvwbzWGvhqxp/RqVqwU999pBf2vp7hzIjiYOsl8wqOmUxkQ6ddw1cV3l8811+kdUFus/q4d1Y3E3SyEifA==" }, "node_modules/@types/react": { - "version": "18.3.3", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", - "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", + "version": "18.3.12", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.12.tgz", + "integrity": "sha512-D2wOSq/d6Agt28q7rSI3jhU7G6aiuzljDGZ2hTZHIkrTLUI+AF3WMeKkEZ9nN2fkBAlcktT6vcZjDFiIhMYEQw==", "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" diff --git a/package.json b/package.json index e1eba54ff0..4560ea5d0e 100644 --- a/package.json +++ b/package.json @@ -119,7 +119,7 @@ "@types/js-cookie": "^3.0.6", "@types/node": "^22.5.4", "@types/node-fetch": "^2.6.10", - "@types/react": "^18.3.3", + "@types/react": "^18.3.12", "@types/react-beautiful-dnd": "^13.1.8", "@types/react-chartjs-2": "^2.5.7", "@types/react-bootstrap": "^0.32.37", From fb913e1882410386564f4c6f2540fe66e2471ae5 Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:32:40 -0800 Subject: [PATCH 09/15] Update pull-request.yml --- .github/workflows/pull-request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index aaeebc8345..0cb1b76ee4 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -259,7 +259,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check if the target branch is develop - if: github.event.pull_request.base.ref != 'develop' + if: github.event.pull_request.base.ref != 'develop-postgres' run: | - echo "Error: Pull request target branch must be 'develop'. Please refer PR_GUIDELINES.md" + echo "Error: Pull request target branch must be 'develop-postgres'. Please refer PR_GUIDELINES.md" exit 1 From d16b95ee179900e8e32a2296f14e948e6caea05b Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Sat, 16 Nov 2024 15:04:35 -0800 Subject: [PATCH 10/15] Update dependabot.yaml --- .github/dependabot.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 9a3e9a54e9..81d68df4bd 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -12,7 +12,7 @@ updates: labels: - "dependencies" # Specify the target branch for PRs - target-branch: "develop" + target-branch: "develop-postgres" # Customize commit message prefix commit-message: prefix: "chore(deps):" From 15513f5fa62217bd2ee9f0c6f8e9c822116d8b81 Mon Sep 17 00:00:00 2001 From: Vanshika Sabharwal <143436704+VanshikaSabharwal@users.noreply.github.com> Date: Mon, 18 Nov 2024 00:02:22 +0530 Subject: [PATCH 11/15] added docker check to workflow (#2414) * added docker check to workflow * made recommended changes to docker check in workflow * added changes to docker check inn workflow as recommended * added changes * updated indentation in pull-request.yml file * updated indentation in pull-request.yml file * added Dockerfile and Docker-compose.yml file * added Dockerfile and Docker-compose.yml file * updated .docker-ignore file * added recommended changes by code rabbit * added recommended changes by code rabbit * added recommended changes by code rabbit * added recommended changes by code rabbit * added recommended changes by code rabbit * added recommended changes by code rabbit * properly formatted code * trying to make docker check pass * trying to make docker check pass * updated INSTALLATION.md * updated INSTALLATION.md * added recommended changes to INSTALLATION.md * added recommended changes to INSTALLATION.md * added recommended changes to INSTALLATION.md * updated docker workflow * updated INSTALLATION.md --- .dockerignore | 25 +++++++++ .github/workflows/pull-request.yml | 90 ++++++++++++++++++++++++------ Dockerfile | 15 +++++ INSTALLATION.md | 89 +++++++++++++++++++++-------- config/vite.config.ts | 5 +- 5 files changed, 183 insertions(+), 41 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..0ef78f43dc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +node_modules +npm-debug.log +Dockerfile +.git +.gitignore +.env +.env.* +dist +coverage +.nyc_output +*.md +.github +tests +__tests__ +*.test.* +*.spec.* +# Development files +*.log +*.lock +.DS_Store +.idea +.vscode +# Build artifacts +build +out \ No newline at end of file diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 0cb1b76ee4..7eb62357c1 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -46,7 +46,7 @@ jobs: - name: Check formatting if: steps.changed-files.outputs.only_changed != 'true' run: npm run format:check - + - name: Run formatting if check fails if: failure() run: npm run format @@ -57,10 +57,10 @@ jobs: - name: Check for linting errors in modified files if: steps.changed-files.outputs.only_changed != 'true' - env: + env: CHANGED_FILES: ${{ steps.changed_files.outputs.all_changed_files }} run: npx eslint ${CHANGED_FILES} && python .github/workflows/eslint_disable_check.py - + - name: Check for TSDoc comments run: npm run check-tsdoc # Run the TSDoc check script @@ -89,7 +89,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Get Changed Unauthorized files id: changed-unauth-files uses: tj-actions/changed-files@v40 @@ -123,10 +123,10 @@ jobs: ISSUE_GUIDELINES.md PR_GUIDELINES.md README.md - + - name: List all changed unauthorized files if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' - env: + env: CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} run: | for file in ${CHANGED_UNAUTH_FILES}; do @@ -147,14 +147,14 @@ jobs: uses: tj-actions/changed-files@v40 - name: Echo number of changed files - env: + env: CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} run: | echo "Number of files changed: $CHANGED_FILES_COUNT" - name: Check if the number of changed files is less than 100 if: steps.changed-files.outputs.all_changed_files_count > 100 - env: + env: CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} run: | echo "Error: Too many files (greater than 100) changed in the pull request." @@ -194,15 +194,15 @@ jobs: - name: Install Dependencies run: npm install - + - name: Get changed TypeScript files id: changed-files uses: tj-actions/changed-files@v40 - + - name: Run tests if: steps.changed-files.outputs.only_changed != 'true' - run: npm run test -- --watchAll=false --coverage - + run: npm run test -- --watchAll=false --coverage + - name: TypeScript compilation for changed files run: | for file in ${{ steps.changed-files.outputs.all_files }}; do @@ -210,7 +210,7 @@ jobs: npx tsc --noEmit "$file" fi done - + - name: Present and Upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}} uses: codecov/codecov-action@v4 with: @@ -222,7 +222,7 @@ jobs: - name: Test acceptable level of code coverage uses: VeryGoodOpenSource/very_good_coverage@v2 with: - path: "./coverage/lcov.info" + path: './coverage/lcov.info' min_coverage: 95.0 Graphql-Inspector: @@ -240,19 +240,75 @@ jobs: - name: resolve dependency run: npm install -g @graphql-inspector/cli - + - name: Clone API Repository run: | # Retrieve the complete branch name directly from the GitHub context FULL_BRANCH_NAME=${{ github.base_ref }} echo "FULL_Branch_NAME: $FULL_BRANCH_NAME" - + # Clone the specified repository using the extracted branch name - git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a + git clone --branch $FULL_BRANCH_NAME https://github.com/PalisadoesFoundation/talawa-api && ls -a - name: Validate Documents run: graphql-inspector validate './src/GraphQl/**/*.ts' './talawa-api/schema.graphql' + Docker-Start-Check: + name: Check if Talawa Admin app starts in Docker + runs-on: ubuntu-latest + needs: [Code-Quality-Checks, Test-Application] + if: github.actor != 'dependabot' + steps: + - name: Checkout the Repository + uses: actions/checkout@v4 + + - name: Set up Docker + uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + image=moby/buildkit:latest + + - name: Build Docker image + run: | + set -e + echo "Building Docker image..." + docker build -t talawa-admin-app . + echo "Docker image built successfully" + + - name: Run Docker Container + run: | + set -e + echo "Started Docker container..." + docker run -d --name talawa-admin-app-container -p 4321:4321 talawa-admin-app + echo "Docker container started successfully" + + - name: Check if Talawa Admin App is running + run: | + timeout="${HEALTH_CHECK_TIMEOUT:-120}" + echo "Starting health check with ${timeout}s timeout" + while ! nc -z localhost 4321 && [ $timeout -gt 0 ]; do + sleep 1 + + timeout=$((timeout-1)) + if [ $((timeout % 10)) -eq 0 ]; then + echo "Still waiting for app to start... ${timeout}s remaining" + fi + done + + if [ $timeout -eq 0 ]; then + echo "Timeout waiting for application to start" + echo "Container logs:" + docker logs talawa-admin-app-container + exit 1 + fi + echo "Port check passed, verifying health endpoint..." + + - name: Stop Docker Container + if: always() + run: | + docker stop talawa-admin-app-container + docker rm talawa-admin-app-container + Check-Target-Branch: if: ${{ github.actor != 'dependabot[bot]' }} name: Check Target Branch diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..6b13a712b7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:20.10.0 AS build + +WORKDIR /usr/src/app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +RUN npm run build + +EXPOSE 4321 + +CMD ["npm", "run", "serve"] \ No newline at end of file diff --git a/INSTALLATION.md b/INSTALLATION.md index 5813b7d1cb..3c09f69e33 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -13,25 +13,9 @@ This document provides instructions on how to set up and start a running instanc - [Install node.js](#install-nodejs) - [Install TypeScript](#install-typescript) - [Install Required Packages](#install-required-packages) -- [Configuration](#configuration) - - [Creating .env file](#creating-env-file) - - [Setting up PORT in .env file](#setting-up-port-in-env-file) - - [Setting up REACT_APP_TALAWA_URL in .env file](#setting-up-react_app_talawa_url-in-env-file) - - [Setting up REACT_APP_BACKEND_WEBSOCKET_URL in .env file](#setting-up-react_app_backend_websocket_url-in-env-file) - - [Setting up REACT_APP_RECAPTCHA_SITE_KEY in .env file](#setting-up-react_app_recaptcha_site_key-in-env-file) - - [Setting up Compiletime and Runtime logs](#setting-up-compiletime-and-runtime-logs) -- [Post Configuration Steps](#post-configuration-steps) - - [Running Talawa-Admin](#running-talawa-admin) - - [Accessing Talawa-Admin](#accessing-talawa-admin) - - [Talawa-Admin Registration](#talawa-admin-registration) - - [Talawa-Admin Login](#talawa-admin-login) -- [Testing](#testing) - - [Running tests](#running-tests) - - [Debugging tests](#debugging-tests) - - [Linting code files](#linting-code-files) - - [Husky for Git Hooks](#husky-for-git-hooks) - - [pre-commit hook](#pre-commit-hook) - - [post-merge hook](#post-merge-hook) +- [Installation using Docker](#installation-using-docker) + - [Prerequisites](#prerequisites-1) + - [Development Setup](#development-setup) @@ -145,15 +129,47 @@ npm install The prerequisites are now installed. The next step will be to get the app up and running. +# Installation using Docker + +## Prerequisites + +1. Install Docker on your system: + - [Docker Desktop for Windows/Mac](https://www.docker.com/products/docker-desktop) + - [Docker Engine for Linux](https://docs.docker.com/engine/install/) + +### Development Setup + +If you prefer to use Docker, you can install the app using the following command: + +1. Create a `.env` file as described in the Configuration section + +2. Build the Docker Image: + +Run the following command to build the Docker image: + +````bash +docker build -t talawa-admin . +```bash + +3. Run the Docker container: + +After the build is complete, run the Docker container using this command: + +```bash +docker run -p 4321:4321 talawa-admin +```bash + +The application will be accessible at `http://localhost:4321` + # Configuration It's important to configure Talawa-Admin. Here's how to do it. You can use our interactive setup script for the configuration. Use the following command for the same. -``` +```bash npm run setup -``` +```bash All the options in "setup" can be done manually as well and here's how to do it. - [Creating .env file](#creating-env-file) @@ -161,8 +177,10 @@ All the options in "setup" can be done manually as well and here's how to do it. A file named .env is required in the root directory of talawa-admin for storing environment variables used at runtime. It is not a part of the repo and you will have to create it. For a sample of `.env` file there is a file named `.env.example` in the root directory. Create a new `.env` file by copying the contents of the `.env.example` into `.env` file. Use this command: -``` +```` + cp .env.example .env + ``` This `.env` file must be populated with the following environment variables for `talawa-admin` to work: @@ -186,19 +204,25 @@ Add a custom port number for Talawa-Admin development purposes to the variable n Add the endpoint for accessing talawa-api graphql service to the variable named `REACT_APP_TALAWA_URL` in the `.env` file. ``` + REACT_APP_TALAWA_URL="http://API-IP-ADRESS:4000/graphql/" + ``` If you are a software developer working on your local system, then the URL would be: ``` + REACT_APP_TALAWA_URL="http://localhost:4000/graphql/" + ``` If you are trying to access Talawa Admin from a remote host with the API URL containing "localhost", You will have to change the API URL to ``` + REACT_APP_TALAWA_URL="http://YOUR-REMOTE-ADDRESS:4000/graphql/" + ``` ## Setting up REACT_APP_BACKEND_WEBSOCKET_URL in .env file @@ -206,19 +230,25 @@ REACT_APP_TALAWA_URL="http://YOUR-REMOTE-ADDRESS:4000/graphql/" The endpoint for accessing talawa-api WebSocket graphql service for handling subscriptions is automatically added to the variable named `REACT_APP_BACKEND_WEBSOCKET_URL` in the `.env` file. ``` + REACT_APP_BACKEND_WEBSOCKET_URL="ws://API-IP-ADRESS:4000/graphql/" + ``` If you are a software developer working on your local system, then the URL would be: ``` + REACT_APP_BACKEND_WEBSOCKET_URL="ws://localhost:4000/graphql/" + ``` If you are trying to access Talawa Admin from a remote host with the API URL containing "localhost", You will have to change the API URL to ``` + REACT_APP_BACKEND_WEBSOCKET_URL="ws://YOUR-REMOTE-ADDRESS:4000/graphql/" + ``` For additional details, please refer the `How to Access the Talawa-API URL` section in the INSTALLATION.md file found in the [Talawa-API repo](https://github.com/PalisadoesFoundation/talawa-api). @@ -238,7 +268,9 @@ If you want to setup Google reCAPTCHA now, you may refer to the `RECAPTCHA` sect Copy/paste this `reCAPTCHA site key` to the variable named `REACT_APP_RECAPTCHA_SITE_KEY` in `.env` file. ``` + REACT_APP_RECAPTCHA_SITE_KEY="this_is_the_recaptcha_key" + ``` ## Setting up Compiletime and Runtime logs @@ -254,7 +286,9 @@ It's now time to start Talawa-Admin and get it running Run the following command to start `talawa-admin` development server: ``` + npm run serve + ``` ## Accessing Talawa-Admin @@ -262,13 +296,17 @@ npm run serve By default `talawa-admin` runs on port `4321` on your system's localhost. It is available on the following endpoint: ``` + http://localhost:4321/ + ``` If you have specified a custom port number in your `.env` file, Talawa-Admin will run on the following endpoint: ``` + http://localhost:${{customPort}}/ + ``` Replace `${{customPort}}` with the actual custom port number you have configured in your `.env` file. @@ -290,7 +328,9 @@ It is important to test our code. If you are a contributor, please follow these You can run the tests for `talawa-admin` using this command: ``` + npm run test + ``` ## Debugging tests @@ -298,8 +338,10 @@ npm run test You can see the output of failing tests in broswer by running `jest-preview` package before running your tests ``` + npm run jest-preview npm run test + ``` You don't need to re-run the `npm run jest-preview` command each time, simply run the `npm run test` command if the Jest Preview server is already running in the background, it'll automatically detect any failing tests and show the preview at `http://localhost:3336` as shown in this screenshot - @@ -311,7 +353,9 @@ You don't need to re-run the `npm run jest-preview` command each time, simply ru You can lint your code files using this command: ``` + npm run lint:fix + ``` ## Husky for Git Hooks @@ -335,3 +379,4 @@ If you don't want this hook to run, you can manually opt out of this using the ` git pull --no-verify
+``` diff --git a/config/vite.config.ts b/config/vite.config.ts index 71ce6c6f47..28cd47ae5a 100644 --- a/config/vite.config.ts +++ b/config/vite.config.ts @@ -23,8 +23,9 @@ export default defineConfig({ ], server: { // this ensures that the browser opens upon server start - open: true, - // this sets a default port to 3000 + open: false, + host: '0.0.0.0', + // this sets a default port to 4321 port: 4321, }, }); From 3ea2919770eaa2ad912c4a012a3c87b4d1ec4cd4 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani <135210710+prayanshchh@users.noreply.github.com> Date: Mon, 18 Nov 2024 00:43:39 +0530 Subject: [PATCH 12/15] eslint-rule-no_unused_vars (#2428) --- .eslintrc.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.json b/.eslintrc.json index 26470f7aab..b3704d9aa1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -55,6 +55,7 @@ "import/no-duplicates": "error", "tsdoc/syntax": "error", "@typescript-eslint/ban-ts-comment": "error", + "@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-explicit-any": "error", "@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-non-null-asserted-optional-chain": "error", From 084ac7e92dede9766b77e75cf296f40165965140 Mon Sep 17 00:00:00 2001 From: Dhiraj Udhani Date: Wed, 20 Nov 2024 11:53:23 +0530 Subject: [PATCH 13/15] Updated pr template with checklist (#2454) * Updated pr template with checklist * Additional changes for the PR template * Changed the url for the PR template --- .github/pull_request_template.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 9e3081d0ee..a1e203bfdf 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,6 +9,7 @@ We employ the following branching strategy to simplify the development process a NOTE!!! ONLY SUBMIT PRS AGAINST OUR `DEVELOP` BRANCH. THE DEFAULT IS `MAIN`, SO YOU WILL HAVE TO MODIFY THIS BEFORE SUBMITTING YOUR PR FOR REVIEW. PRS MADE AGAINST `MAIN` WILL BE CLOSED. + --> -**Did you add tests for your changes?** - - - **Snapshots/Videos:** @@ -44,10 +41,23 @@ Fixes # +## Checklist + +### CodeRabbit AI Review +- [ ] I have reviewed and addressed all critical issues flagged by CodeRabbit AI +- [ ] I have implemented or provided justification for each non-critical suggestion +- [ ] I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented + +### Test Coverage +- [ ] I have written tests for all new changes/features +- [ ] I have verified that test coverage meets or exceeds 95% +- [ ] I have run the test suite locally and all tests pass + + **Other information** **Have you read the [contributing guide](https://github.com/PalisadoesFoundation/talawa-admin/blob/master/CONTRIBUTING.md)?** - + \ No newline at end of file From a63e0d40deace26eb54261248803dcde2b5c4225 Mon Sep 17 00:00:00 2001 From: Shekhar Patel <90516956+duplixx@users.noreply.github.com> Date: Sun, 1 Dec 2024 16:26:23 +0530 Subject: [PATCH 14/15] refactored addOnStore --- package-lock.json | 69 ++++--------------- .../AddOn/core/AddOnStore/AddOnStore.tsx | 26 ++++--- 2 files changed, 28 insertions(+), 67 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32c439b869..2404c03835 100644 --- a/package-lock.json +++ b/package-lock.json @@ -101,6 +101,7 @@ "@vitest/coverage-istanbul": "^2.1.5", "babel-jest": "^29.7.0", "cross-env": "^7.0.3", + "eslint": "^8.49.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jest": "^28.8.0", @@ -130,7 +131,6 @@ "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", "dev": true, - "peer": true, "engines": { "node": ">=0.10.0" } @@ -2963,7 +2963,6 @@ "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -2988,7 +2987,6 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -3005,8 +3003,7 @@ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true, - "license": "Python-2.0", - "peer": true + "license": "Python-2.0" }, "node_modules/@eslint/eslintrc/node_modules/globals": { "version": "13.24.0", @@ -3014,7 +3011,6 @@ "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "type-fest": "^0.20.2" }, @@ -3031,7 +3027,6 @@ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "argparse": "^2.0.1" }, @@ -3044,8 +3039,7 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@eslint/eslintrc/node_modules/type-fest": { "version": "0.20.2", @@ -3053,7 +3047,6 @@ "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, "license": "(MIT OR CC0-1.0)", - "peer": true, "engines": { "node": ">=10" }, @@ -3067,7 +3060,6 @@ "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -3135,7 +3127,6 @@ "deprecated": "Use @eslint/config-array instead", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "@humanwhocodes/object-schema": "^2.0.2", "debug": "^4.3.1", @@ -3150,7 +3141,6 @@ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, - "peer": true, "engines": { "node": ">=12.22" }, @@ -3165,8 +3155,7 @@ "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "deprecated": "Use @eslint/object-schema instead", "dev": true, - "license": "BSD-3-Clause", - "peer": true + "license": "BSD-3-Clause" }, "node_modules/@isaacs/cliui": { "version": "8.0.2", @@ -6584,7 +6573,6 @@ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "license": "MIT", - "peer": true, "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } @@ -8816,8 +8804,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true, - "peer": true + "dev": true }, "node_modules/deepmerge": { "version": "4.3.1", @@ -9002,7 +8989,6 @@ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, - "peer": true, "dependencies": { "esutils": "^2.0.2" }, @@ -9554,7 +9540,6 @@ "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -9889,7 +9874,6 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -9905,15 +9889,13 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "peer": true + "dev": true }, "node_modules/eslint/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "peer": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -9931,7 +9913,6 @@ "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -9949,7 +9930,6 @@ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "engines": { "node": ">=4.0" } @@ -9959,7 +9939,6 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, - "peer": true, "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -9976,7 +9955,6 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, - "peer": true, "dependencies": { "is-glob": "^4.0.3" }, @@ -9989,7 +9967,6 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", "dev": true, - "peer": true, "dependencies": { "type-fest": "^0.20.2" }, @@ -10005,7 +9982,6 @@ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "dev": true, - "peer": true, "dependencies": { "argparse": "^2.0.1" }, @@ -10017,15 +9993,13 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "peer": true + "dev": true }, "node_modules/eslint/node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, - "peer": true, "dependencies": { "p-locate": "^5.0.0" }, @@ -10041,7 +10015,6 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, - "peer": true, "dependencies": { "yocto-queue": "^0.1.0" }, @@ -10057,7 +10030,6 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, - "peer": true, "dependencies": { "p-limit": "^3.0.2" }, @@ -10073,7 +10045,6 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, - "peer": true, "engines": { "node": ">=10" }, @@ -10087,7 +10058,6 @@ "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "license": "BSD-2-Clause", - "peer": true, "dependencies": { "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", @@ -10117,7 +10087,6 @@ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, - "peer": true, "dependencies": { "estraverse": "^5.1.0" }, @@ -10130,7 +10099,6 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, - "peer": true, "engines": { "node": ">=4.0" } @@ -10140,7 +10108,6 @@ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, - "peer": true, "dependencies": { "estraverse": "^5.2.0" }, @@ -10153,7 +10120,6 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, - "peer": true, "engines": { "node": ">=4.0" } @@ -10386,8 +10352,7 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true, - "peer": true + "dev": true }, "node_modules/fast-xml-parser": { "version": "4.4.1", @@ -10455,7 +10420,6 @@ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, - "peer": true, "dependencies": { "flat-cache": "^3.0.4" }, @@ -10560,7 +10524,6 @@ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", "dev": true, - "peer": true, "dependencies": { "flatted": "^3.1.0", "rimraf": "^3.0.2" @@ -10573,8 +10536,7 @@ "version": "3.2.7", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true, - "peer": true + "dev": true }, "node_modules/fontkit": { "version": "2.0.2", @@ -13968,8 +13930,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true, - "peer": true + "dev": true }, "node_modules/json5": { "version": "2.2.3", @@ -14075,7 +14036,6 @@ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, - "peer": true, "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -14521,8 +14481,7 @@ "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true, - "peer": true + "dev": true }, "node_modules/lodash.template": { "version": "4.5.0", @@ -15663,7 +15622,6 @@ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", "dev": true, - "peer": true, "dependencies": { "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", @@ -16242,7 +16200,6 @@ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, - "peer": true, "engines": { "node": ">= 0.8.0" } @@ -18375,8 +18332,7 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "peer": true + "dev": true }, "node_modules/throat": { "version": "6.0.2", @@ -19114,7 +19070,6 @@ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, - "peer": true, "dependencies": { "prelude-ls": "^1.2.1" }, diff --git a/src/components/AddOn/core/AddOnStore/AddOnStore.tsx b/src/components/AddOn/core/AddOnStore/AddOnStore.tsx index 9656222405..90a32d9bb3 100644 --- a/src/components/AddOn/core/AddOnStore/AddOnStore.tsx +++ b/src/components/AddOn/core/AddOnStore/AddOnStore.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import React, { useState } from 'react'; import styles from './AddOnStore.module.css'; import AddOnEntry from '../AddOnEntry/AddOnEntry'; @@ -79,10 +78,10 @@ function addOnStore(): JSX.Element { * * @param tab - The key of the selected tab (either 'available' or 'installed'). */ - const updateSelectedTab = (tab: any): void => { + const updateSelectedTab = (tab: string): void => { setIsStore(tab === 'available'); /* istanbul ignore next */ - if (isStore) { + if (tab === 'available') { getStorePlugins(); } else { getInstalledPlugins(); @@ -94,11 +93,10 @@ function addOnStore(): JSX.Element { * * @param ev - The event object from the filter change. */ - const filterChange = - /* istanbul ignore next */ - (ev: any): void => { - setShowEnabled(ev.target.value === 'enabled'); - }; + const filterChange = (ev: React.ChangeEvent): void => { + setShowEnabled(ev.target.value === 'enabled'); + }; + const filterPlugins = ( plugins: InterfacePluginHelper[], searchTerm: string, @@ -111,6 +109,7 @@ function addOnStore(): JSX.Element { plugin.pluginName?.toLowerCase().includes(searchTerm.toLowerCase()), ); }; + // Show a loader while the data is being fetched /* istanbul ignore next */ if (loading) { @@ -160,7 +159,10 @@ function addOnStore(): JSX.Element { filterChange(e ? e : '') + (e) => + filterChange( + e as unknown as React.ChangeEvent, + ) } > { + if (eventKey) { + updateSelectedTab(eventKey); + } + }} > Date: Sun, 1 Dec 2024 16:33:31 +0530 Subject: [PATCH 15/15] refactored addOnEntry v1 --- src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx b/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx index a7d19ac79a..12805568f6 100644 --- a/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx +++ b/src/components/AddOn/core/AddOnEntry/AddOnEntry.tsx @@ -17,7 +17,7 @@ interface InterfaceAddOnEntryProps { description?: string; // Optional props createdBy: string; component?: string; // Optional props - modified?: any; // Optional props + modified?: boolean; // Optional props uninstalledOrgs: string[]; getInstalledPlugins: () => void; }