Skip to content

Commit

Permalink
feat(plugins/settings/pages/Plugins): add "no results" view
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmDevs committed Dec 4, 2024
1 parent 94dc837 commit 73abe1a
Showing 1 changed file with 41 additions and 21 deletions.
62 changes: 41 additions & 21 deletions src/plugins/settings/pages/Plugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,36 +235,47 @@ export default function PluginsSettingsPage() {
? corePluginsData.length + externalPluginsData.length
: externalPluginsData.length)

// TODO: Maybe create 2 separate data lists for non-filtered and filtered plugins
const pluginListNoResults = pluginListEmpty && query

return (
<PageWrapper>
<PluginSettingsPageContext.Provider
value={{ setQuery, showCorePlugins, sortMode, ContextMenuComponent: MemoizedContextMenu }}
>
{pluginListEmpty ? (
{pluginListEmpty && !pluginListNoResults ? (
<PluginsSettingsPageEmptyView />
) : (
<>
<PluginsSettingsPageSearch />
<ScrollView fadingEdgeLength={32} keyboardShouldPersistTaps="handled" style={styles.resizable}>
<PluginsSettingsPageMasonaryFlashList data={externalPluginsData} />
{showCorePluginsInformationAlert && (
<PluginsSettingsPageMasonaryFlashList
header={
<View style={styles.headerContainer}>
{/* TableRowGroupTitle probably has some margin, setting it to flex-end causes it to be in the center, lucky. */}
<TableRowGroupTitle title="Core Plugins" />
<IconButton
icon={getAssetIndexByName('CircleQuestionIcon-primary')!}
size="sm"
variant="tertiary"
onPress={showCorePluginsInformationAlert}
/>
</View>
}
data={corePluginsData}
/>
)}
</ScrollView>
{pluginListNoResults ? (
<PluginsSettingsPageNoResultsView />
) : (
<ScrollView
fadingEdgeLength={32}
keyboardShouldPersistTaps="handled"
style={styles.resizable}
>
<PluginsSettingsPageMasonaryFlashList data={externalPluginsData} />
{showCorePluginsInformationAlert && (
<PluginsSettingsPageMasonaryFlashList
header={
<View style={styles.headerContainer}>
{/* TableRowGroupTitle probably has some margin, setting it to flex-end causes it to be in the center, lucky. */}
<TableRowGroupTitle title="Core Plugins" />
<IconButton
icon={getAssetIndexByName('CircleQuestionIcon-primary')!}
size="sm"
variant="tertiary"
onPress={showCorePluginsInformationAlert}
/>
</View>
}
data={corePluginsData}
/>
)}
</ScrollView>
)}
</>
)}
</PluginSettingsPageContext.Provider>
Expand Down Expand Up @@ -303,6 +314,15 @@ function PluginsSettingsPageEmptyView() {
)
}

function PluginsSettingsPageNoResultsView() {
return (
<Stack spacing={24} style={[styles.growable, styles.centerChildren]}>
<Image source={getAssetIndexByName('empty_quick_switcher')} style={styles.emptyImage} />
<Text variant="heading-lg/semibold">No results...</Text>
</Stack>
)
}

type PluginsSettingsPageMasonaryFlashListData = Omit<PluginCardProps, 'horizontalGaps'>[]

function PluginsSettingsPageMasonaryFlashList({
Expand Down

0 comments on commit 73abe1a

Please sign in to comment.