feat: partner badge in marketplace (#14258)

This commit is contained in:
Wu Tianwei
2025-02-25 12:09:37 +08:00
committed by GitHub
parent 28add22f20
commit 42b13bd312
31 changed files with 2288 additions and 31 deletions

View File

@@ -8,15 +8,12 @@ import { fetchAppList } from '@/service/apps'
import Loading from '@/app/components/base/loading'
import { fetchCurrentWorkspace, fetchLanggeniusVersion, fetchUserProfile, getSystemFeatures } from '@/service/common'
import type { App } from '@/types/app'
import { Theme } from '@/types/app'
import type { ICurrentWorkspace, LangGeniusVersionResponse, UserProfileResponse } from '@/models/common'
import MaintenanceNotice from '@/app/components/header/maintenance-notice'
import type { SystemFeatures } from '@/types/feature'
import { defaultSystemFeatures } from '@/types/feature'
export type AppContextValue = {
theme: Theme
setTheme: (theme: Theme) => void
apps: App[]
systemFeatures: SystemFeatures
mutateApps: VoidFunction
@@ -56,9 +53,7 @@ const initialWorkspaceInfo: ICurrentWorkspace = {
}
const AppContext = createContext<AppContextValue>({
theme: Theme.light,
systemFeatures: defaultSystemFeatures,
setTheme: () => { },
apps: [],
mutateApps: () => { },
userProfile: {
@@ -128,24 +123,11 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
setCurrentWorkspace(currentWorkspaceResponse)
}, [currentWorkspaceResponse])
const [theme, setTheme] = useState<Theme>(Theme.light)
const handleSetTheme = useCallback((theme: Theme) => {
setTheme(theme)
globalThis.document.documentElement.setAttribute('data-theme', theme)
}, [])
useEffect(() => {
globalThis.document.documentElement.setAttribute('data-theme', theme)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
if (!appList || !userProfile)
return <Loading type='app' />
return (
<AppContext.Provider value={{
theme,
setTheme: handleSetTheme,
apps: appList.data,
systemFeatures: { ...defaultSystemFeatures, ...systemFeatures },
mutateApps,