Skip to content

Commit

Permalink
enhancement(frontend): updated helper links and added conditional for…
Browse files Browse the repository at this point in the history
… the is_demo flag
  • Loading branch information
bekossy committed Dec 6, 2024
1 parent 283cb56 commit d7eff81
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
4 changes: 3 additions & 1 deletion agenta-web/src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {CaretDown, Gear, SignOut} from "@phosphor-icons/react"
import AlertPopup from "../AlertPopup/AlertPopup"
import {dynamicContext} from "@/lib/helpers/dynamic"
import Avatar from "@/components/Avatar/Avatar"
import {useProjectData} from "@/contexts/project.context"

const {Sider} = Layout
const {Text} = Typography
Expand Down Expand Up @@ -285,6 +286,7 @@ const Sidebar: React.FC = () => {
const menu = useSidebarConfig()
const {user} = useProfileData()
const {logout} = useSession()
const {project} = useProjectData()
const [useOrgData, setUseOrgData] = useState<Function>(() => () => "")
const {selectedOrg, orgs, changeSelectedOrg} = useOrgData()

Expand Down Expand Up @@ -366,7 +368,7 @@ const Sidebar: React.FC = () => {
),
})),
{type: "divider"},
{
!project?.is_demo && {
key: "settings",
label: (
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,20 @@ const HelpAndSupportSection = () => {
</Space>

<div className="flex items-center w-full gap-4">
<Link className={classes.helperCard} href="https://docs.agenta.ai/" target="_blank">
<BookOpen size={24} />
<Text>Check out docs</Text>
<ArrowRight size={18} />
</Link>
<Link
href="https://docs.agenta.ai/prompt-management/quick-start"
href="https://github.com/Agenta-AI/agenta/discussions"
target="_blank"
className={classes.helperCard}
>
<Code size={24} />
<Text>Learn how to manage prompts</Text>
<Text>Create a discussion in Github</Text>
<ArrowRight size={18} />
</Link>
<Link className={classes.helperCard} href="https://docs.agenta.ai/" target="_blank">
<BookOpen size={24} />
<Text>Check out docs</Text>
<ArrowRight size={18} />
</Link>

<Link
href="https://join.slack.com/t/agenta-hq/shared_invite/zt-1zsafop5i-Y7~ZySbhRZvKVPV5DO_7IA"
target="_blank"
Expand Down
4 changes: 3 additions & 1 deletion agenta-web/src/components/pages/app-management/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ 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 ObservabilityDashboardSection: any = dynamicComponent(
"pages/app-management/components/ObservabilityDashboardSection",
Expand Down Expand Up @@ -78,6 +79,7 @@ const AppManagement: React.FC = () => {
appId: undefined,
})

const {project} = useProjectData()
const [useOrgData, setUseOrgData] = useState<Function>(() => () => "")
const {selectedOrg} = useOrgData()

Expand Down Expand Up @@ -210,7 +212,7 @@ const AppManagement: React.FC = () => {
setSearchTerm={setSearchTerm}
/>

<DemoApplicationsSection />
{!project?.is_demo && <DemoApplicationsSection />}

<HelpAndSupportSection />
</>
Expand Down
11 changes: 11 additions & 0 deletions agenta-web/src/pages/settings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import Secrets from "@/components/pages/settings/Secrets/Secrets"
import ProtectedRoute from "@/components/ProtectedRoute/ProtectedRoute"
import {useProjectData} from "@/contexts/project.context"
import {useQueryParam} from "@/hooks/useQuery"
import {dynamicComponent} from "@/lib/helpers/dynamic"
import {isDemo} from "@/lib/helpers/utils"
import {ApartmentOutlined, KeyOutlined, LockOutlined} from "@ant-design/icons"
import {Space, Tabs, Typography} from "antd"
import {useRouter} from "next/router"
import {useEffect} from "react"
import {createUseStyles} from "react-jss"

const useStyles = createUseStyles({
Expand All @@ -28,6 +31,14 @@ const useStyles = createUseStyles({
const Settings: React.FC = () => {
const [tab, setTab] = useQueryParam("tab", isDemo() ? "workspace" : "secrets")
const classes = useStyles()
const router = useRouter()
const {project} = useProjectData()

useEffect(() => {
if (project?.is_demo) {
router.push("/apps")
}
}, [project, router])

//dynamic components for demo
const WorkspaceManage = dynamicComponent(`pages/settings/WorkspaceManage/WorkspaceManage`)
Expand Down

0 comments on commit d7eff81

Please sign in to comment.