'use client' import type { FC } from 'react' import React, { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import ExploreContext from '@/context/explore-context' import Sidebar from '@/app/components/explore/sidebar' import { useAppContext } from '@/context/app-context' import { fetchMembers } from '@/service/common' import type { InstalledApp } from '@/models/explore' export type IExploreProps = { children: React.ReactNode } const Explore: FC = ({ children, }) => { const { t } = useTranslation() const [controlUpdateInstalledApps, setControlUpdateInstalledApps] = useState(0) const { userProfile } = useAppContext() const [hasEditPermission, setHasEditPermission] = useState(false) const [installedApps, setInstalledApps] = useState([]) useEffect(() => { document.title = `${t('explore.title')} - Dify`; (async () => { const { accounts } = await fetchMembers({ url: '/workspaces/current/members', params: {} }) if (!accounts) return const currUser = accounts.find(account => account.id === userProfile.id) setHasEditPermission(currUser?.role !== 'normal') })() }, []) return (
{children}
) } export default React.memo(Explore)