Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix buy sell list #4765

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 43 additions & 32 deletions src/components/scenes/GuiPluginListScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ import { filterGuiPluginJson } from '../../util/GuiPluginTools'
import { fetchInfo } from '../../util/network'
import { bestOfPlugins } from '../../util/ReferralHelpers'
import { base58ToUuid } from '../../util/utils'
import { SceneWrapper } from '../common/SceneWrapper'
import { InsetStyle, SceneWrapper } from '../common/SceneWrapper'
import { CountryListModal } from '../modals/CountryListModal'
import { TextInputModal } from '../modals/TextInputModal'
import { Airship, showError } from '../services/AirshipInstance'
import { cacheStyles, Theme, ThemeProps, useTheme } from '../services/ThemeContext'
import { DividerLine } from '../themed/DividerLine'
import { EdgeText } from '../themed/EdgeText'
import { SceneHeader } from '../themed/SceneHeader'
import { CardUi4 } from '../ui4/CardUi4'
import { RowUi4 } from '../ui4/RowUi4'
import { SectionHeaderUi4 } from '../ui4/SectionHeaderUi4'
import { SectionView } from '../ui4/SectionView'

const buyRaw = buyPluginJsonOverrideRaw.length > 0 ? buyPluginJsonOverrideRaw : buyPluginJsonRaw
const sellRaw = sellPluginJsonOverrideRaw.length > 0 ? sellPluginJsonOverrideRaw : sellPluginJsonRaw
Expand Down Expand Up @@ -89,6 +89,7 @@ interface StateProps {
developerModeOn: boolean
deviceId: string
disablePlugins: NestedDisableMap
insetStyle: InsetStyle
handleScroll: SceneScrollHandler
}

Expand Down Expand Up @@ -346,20 +347,22 @@ class GuiPluginList extends React.PureComponent<Props, State> {
}
onPress={async () => await this.openPlugin(item).catch(showError)}
onLongPress={async () => await this.openPlugin(item, true).catch(showError)}
paddingRem={[1, 0.5, 1, 0.5]}
>
<SectionView dividerMarginRem={[0.2, 0]} marginRem={0.5}>
<>
<EdgeText style={styles.titleText}>{item.title}</EdgeText>
{item.description === '' ? null : <EdgeText style={styles.subtitleText}>{item.description}</EdgeText>}
</>
<View style={styles.rowContainer}>
<EdgeText style={styles.titleText}>{item.title}</EdgeText>
{item.description === '' ? null : <EdgeText style={styles.subtitleText}>{item.description}</EdgeText>}
{poweredBy != null && item.partnerIconPath != null ? (
<View style={styles.pluginRowPoweredByRow}>
<EdgeText style={styles.footerText}>{lstrings.plugin_powered_by_space}</EdgeText>
<Image style={styles.partnerIconImage} source={pluginPartnerLogo} />
<EdgeText style={styles.footerText}>{' ' + poweredBy}</EdgeText>
</View>
<>
<DividerLine marginRem={[0.25, 1, 0.25, 0]} />
<View style={styles.pluginRowPoweredByRow}>
<EdgeText style={styles.footerText}>{lstrings.plugin_powered_by_space}</EdgeText>
<Image style={styles.partnerIconImage} source={pluginPartnerLogo} />
<EdgeText style={styles.footerText}>{' ' + poweredBy}</EdgeText>
</View>
</>
) : null}
</SectionView>
</View>
</CardUi4>
)
}
Expand Down Expand Up @@ -397,7 +400,7 @@ class GuiPluginList extends React.PureComponent<Props, State> {
}

render() {
const { accountPlugins, accountReferral, countryCode, developerModeOn, disablePlugins, theme } = this.props
const { accountPlugins, accountReferral, countryCode, developerModeOn, disablePlugins, theme, insetStyle } = this.props
const direction = this.getSceneDirection()
const { buy = [], sell = [] } = this.state.buySellPlugins
const styles = getStyles(theme)
Expand Down Expand Up @@ -433,7 +436,8 @@ class GuiPluginList extends React.PureComponent<Props, State> {
ListHeaderComponent={this.renderTop}
renderItem={this.renderPlugin}
keyExtractor={(item: GuiPluginRow) => item.pluginId + item.title}
style={styles.listStyle}
// XXX: Hack. paddingBottom from insetStyle is not sufficient.
contentContainerStyle={{ ...insetStyle, paddingBottom: theme.rem(6) }}
Comment on lines +439 to +440
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it not sufficient? What's causing this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know but I'm NOT touching common code in the SceneWrapper this late in the game.

/>
)}
</View>
Expand All @@ -446,8 +450,8 @@ const getStyles = cacheStyles((theme: Theme) => ({
marginLeft: -theme.rem(0.5),
width: '100%'
},
listStyle: {
overflow: 'visible'
rowContainer: {
flexDirection: 'column'
},
sceneContainer: {
flex: 1
Expand Down Expand Up @@ -528,21 +532,28 @@ export const GuiPluginListScene = React.memo((props: OwnProps) => {

return (
<SceneWrapper hasTabs hasNotifications padding={theme.rem(0.5)}>
<GuiPluginList
handleScroll={handleScroll}
navigation={navigation}
route={route}
deviceId={deviceId}
account={account}
accountPlugins={accountPlugins}
accountReferral={accountReferral}
coreDisklet={coreDisklet}
countryCode={countryCode}
developerModeOn={developerModeOn}
disablePlugins={disablePlugins}
updateCountryCode={updateCountryCode}
theme={theme}
/>
{({ insetStyle, undoInsetStyle }) => {
return (
<View style={undoInsetStyle}>
<GuiPluginList
handleScroll={handleScroll}
navigation={navigation}
route={route}
deviceId={deviceId}
account={account}
accountPlugins={accountPlugins}
accountReferral={accountReferral}
coreDisklet={coreDisklet}
countryCode={countryCode}
developerModeOn={developerModeOn}
disablePlugins={disablePlugins}
updateCountryCode={updateCountryCode}
theme={theme}
insetStyle={insetStyle}
/>
</View>
)
}}
</SceneWrapper>
)
})
Loading