Skip to content

Commit

Permalink
enhancement(frontend): dynamically imported modals
Browse files Browse the repository at this point in the history
  • Loading branch information
bekossy committed Dec 7, 2024
1 parent bf27b5c commit 750e26b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import {createUseStyles} from "react-jss"
import usePagination from "@/hooks/usePagination"
import EmptyAppView from "./EmptyAppView"
import NoResultsFound from "@/components/NoResultsFound/NoResultsFound"
import DeleteAppModal from "../modals/DeleteAppModal"
import EditAppModal from "../modals/EditAppModal"
import {dynamicComponent} from "@/lib/helpers/dynamic"

const DeleteAppModal: any = dynamicComponent("pages/app-management/modals/DeleteAppModal")
const EditAppModal: any = dynamicComponent("pages/app-management/modals/EditAppModal")

interface ApplicationManagementSectionProps {
selectedOrg: any
Expand Down
17 changes: 11 additions & 6 deletions agenta-web/src/components/pages/app-management/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import {Template, GenericObject, StyleProps, JSSTheme} from "@/lib/Types"
import {isDemo, redirectIfNoLLMKeys} from "@/lib/helpers/utils"
import {createAndStartTemplate, fetchAllTemplates, deleteApp} from "@/services/app-selector/api"
import {waitForAppToStart} from "@/services/api"
import AddAppFromTemplatedModal from "./modals/AddAppFromTemplateModal"
import MaxAppModal from "./modals/MaxAppModal"
import WriteOwnAppModal from "./modals/WriteOwnAppModal"
import {createUseStyles} from "react-jss"
import {useAppsData} from "@/contexts/app.context"
import {useProfileData} from "@/contexts/profile.context"
import CreateAppStatusModal from "./modals/CreateAppStatusModal"
import {usePostHogAg} from "@/hooks/usePostHogAg"
import {LlmProvider, getAllProviderLlmKeys} from "@/lib/helpers/llmProviders"
import {dynamicComponent, dynamicContext} from "@/lib/helpers/dynamic"
Expand All @@ -19,10 +15,19 @@ import {useAppTheme} from "@/components/Layout/ThemeContextProvider"
import HelpAndSupportSection from "./components/HelpAndSupportSection"
import GetStartedSection from "./components/GetStartedSection"
import ApplicationManagementSection from "./components/ApplicationManagementSection"
import SetupTracingModal from "./modals/SetupTracingModal"
import ResultComponent from "@/components/ResultComponent/ResultComponent"
import {useProjectData} from "@/contexts/project.context"

const CreateAppStatusModal: any = dynamicComponent(
"pages/app-management/modals/CreateAppStatusModal",
)
const AddAppFromTemplatedModal: any = dynamicComponent(
"pages/app-management/modals/AddAppFromTemplatedModal",
)
const MaxAppModal: any = dynamicComponent("pages/app-management/modals/MaxAppModal")
const WriteOwnAppModal: any = dynamicComponent("pages/app-management/modals/WriteOwnAppModal")
const SetupTracingModal: any = dynamicComponent("pages/app-management/modals/SetupTracingModal")

const ObservabilityDashboardSection: any = dynamicComponent(
"pages/app-management/components/ObservabilityDashboardSection",
)
Expand Down Expand Up @@ -238,7 +243,7 @@ const AppManagement: React.FC = () => {
templateId={templateId}
appNameExist={appNameExist}
setNewApp={setNewApp}
onCardClick={(template) => {
onCardClick={(template: Template) => {
setTemplateId(template.id)
}}
handleTemplateCardClick={handleTemplateCardClick}
Expand Down
4 changes: 2 additions & 2 deletions agenta-web/src/pages/apps/[app_id]/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import {Button, Dropdown, Space, Typography} from "antd"
import {useRouter} from "next/router"
import {useCallback, useEffect, useState} from "react"
import {createUseStyles} from "react-jss"
import DeleteAppModal from "@/components/pages/app-management/modals/DeleteAppModal"
import EditAppModal from "@/components/pages/app-management/modals/EditAppModal"

const ObservabilityOverview: any = dynamicComponent(
"pages/overview/observability/ObservabilityOverview",
)
const DeleteAppModal: any = dynamicComponent("pages/app-management/modals/DeleteAppModal")
const EditAppModal: any = dynamicComponent("pages/app-management/modals/EditAppModal")

const {Title} = Typography

Expand Down

0 comments on commit 750e26b

Please sign in to comment.