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

feat: horizontal section and label for Clear Signing #7529

Merged
merged 15 commits into from
Aug 21, 2024

Conversation

RamyEB
Copy link
Contributor

@RamyEB RamyEB commented Aug 6, 2024

βœ… Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • ...

πŸ“ Description

Add clearsigning label to items in Web3Hub
Add horizontal section "Clear Signing"

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@RamyEB RamyEB requested a review from a team as a code owner August 6, 2024 14:59
Copy link

vercel bot commented Aug 6, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview Aug 21, 2024 10:44am
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Aug 21, 2024 10:44am
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Aug 21, 2024 10:44am
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Aug 21, 2024 10:44am
web-tools ⬜️ Ignored (Inspect) Visit Preview Aug 21, 2024 10:44am

@live-github-bot live-github-bot bot added mobile Has changes in LLM translations Translation files have been touched labels Aug 6, 2024
Copy link
Contributor

@Justkant Justkant left a comment

Choose a reason for hiding this comment

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

Please configure prettier to run correctly in your IDE to avoid this kind of issues
Screenshot 2024-08-07 at 10 14 03

Comment on lines 6807 to 6861
"label": {
"clearSigning": "Clear signing"
}
Copy link
Contributor

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)
Copy link
Contributor

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

@RamyEB RamyEB changed the title feat: add label feat: horizontal section and label for Clear Signing Aug 12, 2024
@RamyEB RamyEB force-pushed the feat/LIVE-12743-add-clearsigning-label branch from ebf63e8 to c81d8c1 Compare August 13, 2024 14:26
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}>
Copy link
Contributor

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

Copy link
Contributor Author

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

Comment on lines 14 to 28
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>
);
Copy link
Contributor

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

Suggested change
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();
Copy link
Contributor

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

Suggested change
const identityFn = (item: AppManifest) => item.id.toString();
const identityFn = (item: AppManifest) => item.id;

<Text mt={2} mb={5} numberOfLines={1} variant="h5" mx={5} accessibilityRole="header">
{title}
</Text>
<View style={{ height: "auto", marginBottom: 2 }}>
Copy link
Contributor

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

Suggested change
<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

Suggested change
<View style={{ height: "auto", marginBottom: 2 }}>
<Box mb={2}>


return data && data.length > 0 ? (
<>
<Disclaimer disclaimer={disclaimer} />
Copy link
Contributor

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

Copy link
Contributor

@Justkant Justkant left a 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

Comment on lines 33 to 38
const disabled = item.branch === "soon";
const handlePress = () => {
if (!disabled) {
extraData(item);
}
};
Copy link
Contributor

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} />;
Copy link
Contributor

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

Suggested change
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) => {
Copy link
Contributor

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}
Copy link
Contributor

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;
Copy link
Contributor

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

Suggested change
extraData: (manifest: AppManifest) => void;
onPressItem: (manifest: AppManifest) => void;

@RamyEB RamyEB force-pushed the feat/LIVE-12743-add-clearsigning-label branch from a80e43c to 2200451 Compare August 19, 2024 09:58
Justkant
Justkant previously approved these changes Aug 20, 2024
@RamyEB RamyEB force-pushed the feat/LIVE-12743-add-clearsigning-label branch from 2200451 to 0e2da57 Compare August 20, 2024 15:17
@RamyEB RamyEB merged commit a409ecc into develop Aug 21, 2024
35 of 37 checks passed
@RamyEB RamyEB deleted the feat/LIVE-12743-add-clearsigning-label branch August 21, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Has changes in LLM translations Translation files have been touched
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants