-
Notifications
You must be signed in to change notification settings - Fork 318
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
feat: horizontal section and label for Clear Signing #7529
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ 5 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"label": { | ||
"clearSigning": "Clear signing" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't really make sense to have it in manifestList
IMO
</Text> | ||
)} | ||
}), | ||
getItemStyle(manifest.branch, colors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would you call that again while we already call that in a memo above ?
I'd prefer to not confuse and merge a style based on the branch with a base style not based on it at all for another not related badge
apps/ledger-live-mobile/src/newArch/features/Web3Hub/components/Disclaimer/index.tsx
Outdated
Show resolved
Hide resolved
...ger-live-mobile/src/newArch/features/Web3Hub/components/ManifestsList/ManifestItem/index.tsx
Outdated
Show resolved
Hide resolved
...ger-live-mobile/src/newArch/features/Web3Hub/components/ManifestsList/ManifestItem/index.tsx
Outdated
Show resolved
Hide resolved
ebf63e8
to
c81d8c1
Compare
...live-mobile/src/newArch/features/Web3Hub/components/ManifestsList/LoadingIndicator/index.tsx
Outdated
Show resolved
Hide resolved
return ( | ||
<TouchableOpacity disabled={isDisabled} onPress={handlePress}> | ||
<Flex flexDirection="row" alignItems="center" height={72} paddingX={4} paddingY={2}> | ||
<AppIcon isDisabled={isDisabled} size={48} name={manifest.name} icon={icon} /> | ||
<Flex marginX={16} height="100%" flexGrow={1} flexShrink={1} justifyContent={"center"}> | ||
<Flex flexDirection="row" alignItems={"center"} mb={2}> | ||
<Flex flexDirection="row" alignItems={"center"} mb={2} columnGap={4}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we'll go with columnGap while we use margins for everything else, and we'll probably remove or update the other because I don't think an experimental badge followed by a clear-signing one would probably take a lot of space on the line
Also columnGap below wouldn't add some margin left before the first badge so you instead have to add a columnGap above while it would not be needed with simpler margins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the fact that margins are used for everything else is the main argument, then okay
Otherwise, I think gap is a better practice since we're using flex, and it's cleaner for managing spacing in this context. As we deal with flexbox and want to add spacing between items, it's better to avoid affecting the first or last element
return ( | ||
<TouchableOpacity disabled={item.branch === "soon"} onPress={onPress}> | ||
<Flex rowGap={6} marginRight={3} width={70} alignItems={"center"}> | ||
<AppIcon isDisabled={item.branch === "soon"} size={48} name={item.name} icon={item.icon} /> | ||
<Text numberOfLines={1}>{item.name}</Text> | ||
</Flex> | ||
</TouchableOpacity> | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small detail but we can probably create a const for disabled props
return ( | |
<TouchableOpacity disabled={item.branch === "soon"} onPress={onPress}> | |
<Flex rowGap={6} marginRight={3} width={70} alignItems={"center"}> | |
<AppIcon isDisabled={item.branch === "soon"} size={48} name={item.name} icon={item.icon} /> | |
<Text numberOfLines={1}>{item.name}</Text> | |
</Flex> | |
</TouchableOpacity> | |
); | |
const disabled = item.branch === "soon"; | |
return ( | |
<TouchableOpacity disabled={disabled} onPress={onPress}> | |
<Flex rowGap={6} marginRight={3} width={70} alignItems={"center"}> | |
<AppIcon isDisabled={disabled} size={48} name={item.name} icon={item.icon} /> | |
<Text numberOfLines={1}>{item.name}</Text> | |
</Flex> | |
</TouchableOpacity> | |
); |
extraData?: { onPress: (manifest: AppManifest) => void }; | ||
}; | ||
|
||
const identityFn = (item: AppManifest) => item.id.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should already be a string
const identityFn = (item: AppManifest) => item.id.toString(); | |
const identityFn = (item: AppManifest) => item.id; |
...-mobile/src/newArch/features/Web3Hub/screens/Web3HubMain/components/HorizontalList/index.tsx
Outdated
Show resolved
Hide resolved
...-mobile/src/newArch/features/Web3Hub/screens/Web3HubMain/components/HorizontalList/index.tsx
Outdated
Show resolved
Hide resolved
...-mobile/src/newArch/features/Web3Hub/screens/Web3HubMain/components/HorizontalList/index.tsx
Outdated
Show resolved
Hide resolved
<Text mt={2} mb={5} numberOfLines={1} variant="h5" mx={5} accessibilityRole="header"> | ||
{title} | ||
</Text> | ||
<View style={{ height: "auto", marginBottom: 2 }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
height: "auto"
should already be the default
<View style={{ height: "auto", marginBottom: 2 }}> | |
<View style={{ marginBottom: 2 }}> |
We should then use the Box
component to use the proper spacings of our design system
<View style={{ height: "auto", marginBottom: 2 }}> | |
<Box mb={2}> |
|
||
return data && data.length > 0 ? ( | ||
<> | ||
<Disclaimer disclaimer={disclaimer} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll probably do a quick refactor of the disclaimer in web3hub after this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said previously you should take as an example the ManifestItem
code for your item logic around props and item press
const disabled = item.branch === "soon"; | ||
const handlePress = () => { | ||
if (!disabled) { | ||
extraData(item); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic should be in the component itself with a useCallback
for the function too
} | ||
}; | ||
|
||
return <MinimalAppCard key={item.id} disabled={disabled} item={item} onPress={handlePress} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key
prop is not needed with flashlist
return <MinimalAppCard key={item.id} disabled={disabled} item={item} onPress={handlePress} />; | |
return <MinimalAppCard disabled={disabled} item={item} onPress={handlePress} />; |
@@ -34,12 +29,23 @@ export default function HorizontalList({ | |||
extraData, | |||
testID, | |||
}: Props) { | |||
const renderItem = useCallback(({ item, extraData = () => {} }: PropRenderItem) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move this outside the component
@@ -34,7 +34,7 @@ const ManifestsCategoryList = ({ title, categoryId, navigation }: Props) => { | |||
<HorizontalList | |||
title={title} | |||
data={data} | |||
extraData={{ onPress: disclaimer.onPressItem }} | |||
extraData={disclaimer.onPressItem} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prop should probably be called onPressItem
as we don't really want to say that we expose extraData
especially because nothing else than a function would work here
import MinimalAppCard from "./MinimalAppCard"; | ||
|
||
type Props = { | ||
title: string; | ||
isLoading: boolean; | ||
data: AppManifest[]; | ||
onEndReached?: () => void; | ||
extraData: { onPress: (manifest: AppManifest) => void }; | ||
extraData: (manifest: AppManifest) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to the other comment on this
extraData: (manifest: AppManifest) => void; | |
onPressItem: (manifest: AppManifest) => void; |
a80e43c
to
2200451
Compare
2200451
to
0e2da57
Compare
β Checklist
npx changeset
was attached.π Description
Add clearsigning label to items in Web3Hub
Add horizontal section "Clear Signing"
β Context
π§ Checklist for the PR Reviewers