Skip to content

Commit

Permalink
fix: restored basket tab in sidebar (#2824)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnthecat authored Dec 10, 2024
1 parent a7ef598 commit d0d38ff
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 120 deletions.
2 changes: 2 additions & 0 deletions src/renderer/app/modelInit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { walletModel } from '@/entities/wallet';
import { multisigsModel } from '@/processes/multisigs';
import { assetsSettingsModel } from '@/features/assets';
import { assetsNavigationFeature } from '@/features/assets-navigation';
import { basketNavigationFeature } from '@/features/basket-navigation';
import { contactsNavigationFeature } from '@/features/contacts-navigation';
import { fellowshipNavigationFeature } from '@/features/fellowship-navigation';
import { governanceNavigationFeature } from '@/features/governance-navigation';
Expand All @@ -27,6 +28,7 @@ export const initModel = () => {
contactsNavigationFeature.start();
notificationsNavigationFeature.start();
settingsNavigationFeature.start();
basketNavigationFeature.start();

walletsSelectFeature.start();

Expand Down
36 changes: 36 additions & 0 deletions src/renderer/features/basket-navigation/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { useUnit } from 'effector-react';

import { $features } from '@/shared/config/features';
import { createFeature } from '@/shared/effector';
import { Paths } from '@/shared/routes';
import { BodyText } from '@/shared/ui';
import { basketModel } from '@/entities/basket';
import { walletModel } from '@/entities/wallet';
import { navigationBottomLinksPipeline } from '@/features/app-shell';
import { basketUtils } from '@/features/operations/OperationsConfirm';

export const basketNavigationFeature = createFeature({
name: 'basket/navigation',
enable: $features.map(({ basket }) => basket),
});

basketNavigationFeature.inject(navigationBottomLinksPipeline, (items) => {
const wallet = useUnit(walletModel.$activeWallet);
const basket = useUnit(basketModel.$basket);

if (!wallet || !basketUtils.isBasketAvailable(wallet)) {
return items;
}

return items.concat({
order: 0,
icon: 'operations',
title: 'navigation.basketLabel',
link: Paths.BASKET,
badge: (
<BodyText className="ml-auto text-text-tertiary">
{basket.filter((tx) => tx.initiatorWallet === wallet?.id).length || ''}
</BodyText>
),
});
});
1 change: 0 additions & 1 deletion src/renderer/features/navigation/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { Navigation } from './ui/Navigation';
export { navigationModel } from './model/navigation-model';
40 changes: 0 additions & 40 deletions src/renderer/features/navigation/ui/NavItem.tsx

This file was deleted.

77 changes: 0 additions & 77 deletions src/renderer/features/navigation/ui/Navigation.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/renderer/features/notifications-navigation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const notificationsNavigationFeature = createFeature({

notificationsNavigationFeature.inject(navigationBottomLinksPipeline, (items) => {
return items.concat({
order: 0,
order: 1,
icon: 'notification',
title: 'navigation.notificationsLabel',
link: Paths.NOTIFICATIONS,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/features/settings-navigation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const settingsNavigationFeature = createFeature({

settingsNavigationFeature.inject(navigationBottomLinksPipeline, (items) => {
return items.concat({
order: 1,
order: 2,
icon: 'settings',
title: 'navigation.settingsLabel',
link: Paths.SETTINGS,
Expand Down
1 change: 1 addition & 0 deletions src/renderer/shared/config/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const $features = createStore({
// TODO: Dev only
fellowship: isDev(),
operations: true,
basket: true,
contacts: true,
notifications: true,
settings: true,
Expand Down

0 comments on commit d0d38ff

Please sign in to comment.