1- import { createContext , useContext , useMemo , useState , type PropsWithChildren } from 'react'
2- import { useTimeout } from 'react-use'
3- import { Typography } from '@mui/material'
1+ import { Trans } from '@lingui/react/macro'
42import { useActivatedPluginsSiteAdaptor , type IdentityResolved } from '@masknet/plugin-infra/content-script'
53import {
6- useCurrentPersonaConnectStatus ,
7- SelectProviderModal ,
84 PersonaContext ,
5+ SelectProviderModal ,
6+ useCurrentPersonaConnectStatus ,
97 type PersonaPerSiteConnectStatus ,
108} from '@masknet/shared'
11- import { Boundary , getMaskColor , makeStyles } from '@masknet/theme'
129import {
1310 currentPersonaIdentifier ,
14- EnhanceableSite ,
1511 EMPTY_LIST ,
12+ EnhanceableSite ,
1613 type DashboardRoutes ,
1714 type NetworkPluginID ,
1815 type PersonaInformation ,
1916} from '@masknet/shared-base'
2017import { useValueRef } from '@masknet/shared-base-ui'
18+ import { Boundary , getMaskColor , makeStyles } from '@masknet/theme'
2119import { useChainContext , useNetworkContext } from '@masknet/web3-hooks-base'
20+ import { Typography } from '@mui/material'
21+ import { createContext , useContext , useMemo , useState , type PropsWithChildren } from 'react'
22+ import { useTimeout } from 'react-use'
2223import { ApplicationRecommendArea } from './ApplicationRecommendArea.js'
2324import { useUnlistedEntries , type Application } from './ApplicationSettingPluginList.js'
24- import { Trans } from '@lingui/react/macro'
2525
26- const useStyles = makeStyles < {
27- shouldScroll : boolean
28- isCarouselReady : boolean
29- } > ( ) ( ( theme , props ) => {
26+ const useStyles = makeStyles ( ) ( ( theme ) => {
3027 const smallQuery = `@media (max-width: ${ theme . breakpoints . values . sm } px)`
3128 return {
3229 applicationWrapper : {
3330 padding : theme . spacing ( 0 , navigator . userAgent . includes ( 'Firefox' ) ? 1.5 : 0.25 , 1 , 3 ) ,
34- transform : props . isCarouselReady ? 'translateX(-8px)' : 'translateX(-8px)' ,
31+ transform : 'translateX(-8px)' ,
3532 display : 'grid' ,
3633 gridTemplateColumns : 'repeat(4, 1fr)' ,
3734 overflowY : 'auto' ,
3835 overflowX : 'hidden' ,
3936 gridTemplateRows : '100px' ,
4037 gridGap : 10 ,
4138 justifyContent : 'space-between' ,
42- maxHeight : 386 ,
43- width : props . shouldScroll && ! navigator . userAgent . includes ( 'Firefox' ) ? 583 : 570 ,
39+ minHeight : 0 ,
40+ boxSizing : 'border-box' ,
4441 scrollbarColor : `${ theme . palette . maskColor . secondaryLine } ${ theme . palette . maskColor . secondaryLine } ` ,
4542 scrollbarWidth : 'thin' ,
4643 '::-webkit-scrollbar' : {
@@ -79,7 +76,7 @@ const useStyles = makeStyles<{
7976 }
8077} )
8178
82- interface ApplicationBoardContentProps extends withClasses < 'applicationWrapper' | 'recommendFeatureAppListWrapper' > {
79+ interface ApplicationBoardContentProps {
8380 openDashboard ?: ( route : DashboardRoutes , search ?: string ) => void
8481 queryOwnedPersonaInformation ?: ( initializedOnly : boolean ) => Promise < PersonaInformation [ ] >
8582 currentSite ?: EnhanceableSite
@@ -97,7 +94,6 @@ export function ApplicationBoardContent({
9794 allPersonas,
9895 applicationCurrentStatus,
9996 personaPerSiteConnectStatusLoading,
100- classes,
10197} : ApplicationBoardContentProps ) {
10298 return (
10399 < PersonaContext initialState = { { queryOwnedPersonaInformation } } >
@@ -107,20 +103,13 @@ export function ApplicationBoardContent({
107103 allPersonas = { allPersonas }
108104 applicationCurrentStatus = { applicationCurrentStatus }
109105 personaPerSiteConnectStatusLoading = { personaPerSiteConnectStatusLoading } >
110- < ApplicationBoardPluginsList
111- currentSite = { currentSite }
112- classes = { {
113- applicationWrapper : classes ?. applicationWrapper ,
114- recommendFeatureAppListWrapper : classes ?. recommendFeatureAppListWrapper ,
115- } }
116- />
106+ < ApplicationBoardPluginsList currentSite = { currentSite } />
117107 </ ApplicationEntryStatusProvider >
118108 </ PersonaContext >
119109 )
120110}
121111
122- interface ApplicationBoardPluginsListProps
123- extends withClasses < 'applicationWrapper' | 'recommendFeatureAppListWrapper' > {
112+ interface ApplicationBoardPluginsListProps {
124113 currentSite ?: EnhanceableSite
125114}
126115
@@ -165,26 +154,19 @@ function ApplicationBoardPluginsList(props: ApplicationBoardPluginsListProps) {
165154 const [ isCarouselReady ] = useTimeout ( 300 )
166155 const [ isHoveringCarousel , setIsHoveringCarousel ] = useState ( false )
167156 // #endregion
168- const { classes, cx } = useStyles (
169- {
170- shouldScroll : listedAppList . length > 12 ,
171- isCarouselReady : ! ! isCarouselReady ( ) ,
172- } ,
173- { props } ,
174- )
157+ const { classes, cx } = useStyles ( )
175158
176159 return (
177160 < >
178- < ApplicationRecommendArea
179- classes = { {
180- recommendFeatureAppListWrapper : classes . recommendFeatureAppListWrapper ,
181- } }
182- recommendFeatureAppList = { recommendFeatureAppList }
183- isCarouselReady = { isCarouselReady }
184- RenderEntryComponent = { RenderEntryComponent }
185- isHoveringCarousel = { isHoveringCarousel }
186- setIsHoveringCarousel = { setIsHoveringCarousel }
187- />
161+ { recommendFeatureAppList . length > 0 ?
162+ < ApplicationRecommendArea
163+ recommendFeatureAppList = { recommendFeatureAppList }
164+ isCarouselReady = { isCarouselReady }
165+ RenderEntryComponent = { RenderEntryComponent }
166+ isHoveringCarousel = { isHoveringCarousel }
167+ setIsHoveringCarousel = { setIsHoveringCarousel }
168+ />
169+ : null }
188170
189171 { listedAppList . length > 0 ?
190172 < Boundary >
0 commit comments