Skip to content

Commit

Permalink
feat(llm): remove hardcoded recover card and add content card compone…
Browse files Browse the repository at this point in the history
…nt to my ledger page
  • Loading branch information
LucasWerey committed Apr 2, 2024
1 parent 99879eb commit b3ddbc9
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 198 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-beds-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Remove hard coded recover card on my ledger page. Add CC component to my ledger page (deleted in previous PR).
1 change: 0 additions & 1 deletion apps/ledger-live-mobile/src/actions/protect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ export const updateProtectData = createAction<ProtectDataPayload>(ProtectActionT
export const updateProtectStatus = createAction<ProtectStatusPayload>(
ProtectActionTypes.UPDATE_PROTECT_STATUS,
);
export const resetProtectState = createAction(ProtectActionTypes.RESET_STATE);
104 changes: 56 additions & 48 deletions apps/ledger-live-mobile/src/components/SelectDevice2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { useResetOnNavigationFocusState } from "~/helpers/useResetOnNavigationFo
import { useDebouncedRequireBluetooth } from "../RequiresBLE/hooks/useRequireBluetooth";
import RequiresBluetoothDrawer from "../RequiresBLE/RequiresBluetoothDrawer";
import QueuedDrawer from "../QueuedDrawer";
import ServicesWidget from "../ServicesWidget";
import { DeviceList } from "./DeviceList";

export type { SetHeaderOptionsRequest };
Expand Down Expand Up @@ -58,17 +57,18 @@ type Props = {
isChoiceDrawerDisplayedOnAddDevice?: boolean;
withMyLedgerTracking?: boolean;
filterByDeviceModelId?: DeviceModelId;
children?: React.ReactNode;
};

export default function SelectDevice({
onSelect,
stopBleScanning,
displayServicesWidget,
requestToSetHeaderOptions,
isChoiceDrawerDisplayedOnAddDevice = true,
hasPostOnboardingEntryPointCard,
withMyLedgerTracking,
filterByDeviceModelId,
children,
}: Props) {
const [USBDevice, setUSBDevice] = useState<Device | undefined>();
const [ProxyDevice, setProxyDevice] = useState<Device | undefined>();
Expand Down Expand Up @@ -316,7 +316,6 @@ export default function SelectDevice({
retryRequestOnIssue={retryRequestOnIssue}
cannotRetryRequest={cannotRetryRequest}
/>

{isPairingDevices ? (
<BleDevicePairingFlow
onPairingSuccess={handleOnSelect}
Expand All @@ -332,7 +331,13 @@ export default function SelectDevice({
<PostOnboardingEntryPointCard />
</Box>
)}
<Flex flexDirection="row" justifyContent="space-between" alignItems="center" mb={1}>
<Flex
flexDirection="row"
justifyContent="space-between"
alignItems="center"
mb={1}
px={16}
>
<Text variant="h5" fontWeight="semiBold">
<Trans i18nKey="manager.selectDevice.title" />
</Text>
Expand Down Expand Up @@ -363,57 +368,60 @@ export default function SelectDevice({
}}
>
<Flex>
{deviceList.length > 0 ? (
<DeviceList deviceList={deviceList} handleOnSelect={handleOnSelect} />
) : (
<Touchable
touchableTestID="connect-with-bluetooth"
onPress={isChoiceDrawerDisplayedOnAddDevice ? onAddNewPress : openBlePairingFlow}
{...addNewButtonEventProps}
>
<Flex
p={5}
mb={4}
borderRadius={5}
flexDirection="row"
alignItems="center"
borderColor="neutral.c40"
borderStyle="dashed"
borderWidth="1px"
>
<IconsLegacy.PlusMedium color="neutral.c90" size={20} />
<Text variant="large" fontWeight="semiBold" ml={5}>
{t(
`manager.selectDevice.${
Platform.OS === "android" ? "addWithBluetooth" : "addALedger"
}`,
)}
</Text>
</Flex>
</Touchable>
)}
{Platform.OS === "android" &&
USBDevice === undefined &&
ProxyDevice === undefined && (
<Text
color="neutral.c100"
variant="large"
fontWeight="semiBold"
fontSize={4}
lineHeight="21px"
mt={3}
<Flex px={16}>
{deviceList.length > 0 ? (
<DeviceList deviceList={deviceList} handleOnSelect={handleOnSelect} />
) : (
<Touchable
touchableTestID="connect-with-bluetooth"
onPress={
isChoiceDrawerDisplayedOnAddDevice ? onAddNewPress : openBlePairingFlow
}
{...addNewButtonEventProps}
>
<Trans i18nKey="manager.selectDevice.otgBanner" />
</Text>
<Flex
p={5}
mb={4}
borderRadius={5}
flexDirection="row"
alignItems="center"
borderColor="neutral.c40"
borderStyle="dashed"
borderWidth="1px"
>
<IconsLegacy.PlusMedium color="neutral.c90" size={20} />
<Text variant="large" fontWeight="semiBold" ml={5}>
{t(
`manager.selectDevice.${
Platform.OS === "android" ? "addWithBluetooth" : "addALedger"
}`,
)}
</Text>
</Flex>
</Touchable>
)}
{displayServicesWidget && <ServicesWidget />}
{Platform.OS === "android" &&
USBDevice === undefined &&
ProxyDevice === undefined && (
<Text
color="neutral.c100"
variant="large"
fontWeight="semiBold"
fontSize={4}
lineHeight="21px"
mt={3}
mb={3}
>
<Trans i18nKey="manager.selectDevice.otgBanner" />
</Text>
)}
</Flex>
{children}
</Flex>

<Flex alignItems="center" mt={10} mb={8}>
<BuyDeviceCTA />
</Flex>
</ScrollContainer>

<QueuedDrawer
isRequestingToBeOpened={isAddNewDrawerOpen}
onClose={() => setIsAddNewDrawerOpen(false)}
Expand Down

This file was deleted.

84 changes: 0 additions & 84 deletions apps/ledger-live-mobile/src/components/ServicesWidget/index.tsx

This file was deleted.

8 changes: 1 addition & 7 deletions apps/ledger-live-mobile/src/reducers/protect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
ProtectDataPayload,
ProtectStatusPayload,
} from "../actions/types";
import type { ProtectState, State } from "./types";
import type { ProtectState } from "./types";
import { ProtectStateNumberEnum } from "../components/ServicesWidget/types";

export const INITIAL_STATE: ProtectState = {
Expand Down Expand Up @@ -42,10 +42,4 @@ const handlers: ReducerMap<ProtectState, ProtectPayload> = {
[ProtectActionTypes.RESET_STATE]: () => INITIAL_STATE,
};

// Selectors

export const protectSelector = (s: State): ProtectState => {
return s.protect;
};

export default handleActions<ProtectState, ProtectPayload>(handlers, INITIAL_STATE);
9 changes: 6 additions & 3 deletions apps/ledger-live-mobile/src/screens/Manager/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ import {
StackNavigatorProps,
} from "~/components/RootNavigator/types/helpers";
import { ManagerNavigatorStackParamList } from "~/components/RootNavigator/types/ManagerNavigator";

import { useManagerDeviceAction } from "~/hooks/deviceActions";
import ContentCardsLocation from "~/dynamicContent/ContentCardsLocation";
import { ContentCardLocation } from "~/dynamicContent/types";

type NavigationProps = BaseComposite<
StackNavigatorProps<ManagerNavigatorStackParamList, ScreenName.Manager>
Expand Down Expand Up @@ -119,15 +120,17 @@ const ChooseDevice: React.FC<ChooseDeviceProps> = ({ isFocused }) => {
</Text>
</Flex>
) : null}
<Flex flex={1} px={16}>
<Flex flex={1}>
<SelectDevice2
onSelect={onSelectDevice}
stopBleScanning={!!device}
displayServicesWidget
requestToSetHeaderOptions={requestToSetHeaderOptions}
withMyLedgerTracking
hasPostOnboardingEntryPointCard
/>
>
<ContentCardsLocation locationId={ContentCardLocation.MyLedger} />
</SelectDevice2>
</Flex>
<DeviceActionModal
onClose={() => onSelectDevice()}
Expand Down

0 comments on commit b3ddbc9

Please sign in to comment.