Skip to content

Commit

Permalink
fix: 🐛 fix post merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideSegullo committed May 21, 2024
1 parent fa04613 commit 4fce552
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
17 changes: 13 additions & 4 deletions src/components/DropdownMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { Fragment, type Ref } from 'react';

import { Content, Item, Portal, Root, Separator, Trigger, type DropdownMenuProps as RadixDropdownMenuProps } from '@radix-ui/react-dropdown-menu';
import styled, { type AnyStyledComponent } from 'styled-components';
import {
Content,
Item,
Portal,
Root,
Separator,
Trigger,
type DropdownMenuProps as RadixDropdownMenuProps,
} from '@radix-ui/react-dropdown-menu';
import styled from 'styled-components';

import { popoverMixins } from '@/styles/popoverMixins';

Expand Down Expand Up @@ -48,8 +56,8 @@ export const DropdownMenu = forwardRefFn(
ref: Ref<HTMLButtonElement>
) => {
return (
<Root ref={ref} className={className} {...rest}>
<Styled.Trigger ref={ref} className={className}>
<Root {...rest}>
<$Trigger ref={ref} className={className}>
{children}
<$DropdownIcon aria-hidden="true">
<Icon iconName={IconName.Triangle} aria-hidden="true" />
Expand Down Expand Up @@ -77,6 +85,7 @@ export const DropdownMenu = forwardRefFn(
);
}
);

const $Separator = styled(Separator)`
border-bottom: solid var(--border-width) var(--color-border);
margin: 0.25rem 1rem;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/portfolio/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const History = () => {
const $ExportButton = styled(ExportHistoryDropdown)`
margin-left: auto;
`;

const $NavigationMenu = styled(NavigationMenu)`
--header-horizontal-padding: 1rem;
Expand Down
41 changes: 23 additions & 18 deletions src/views/ExportHistoryDropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
import { useCallback, useMemo, useState } from 'react';

import { OrderSide } from '@dydxprotocol/v4-client-js';
import { shallowEqual, useSelector } from 'react-redux';
import styled, { AnyStyledComponent } from 'styled-components';

import { AnalyticsEvent } from '@/constants/analytics';
import { ButtonAction, ButtonSize } from '@/constants/buttons';
import { STRING_KEYS } from '@/constants/localization';

import { useLocaleSeparators, useStringGetter } from '@/hooks';

import { Button } from '@/components/Button';
import { Checkbox } from '@/components/Checkbox';
import { DropdownMenu } from '@/components/DropdownMenu';
import { Icon, IconName } from '@/components/Icon';
import { STRING_KEYS } from '@/constants/localization';
import { OutputType, formatNumber, formatTimestamp } from '@/components/Output';

import { shallowEqual, useSelector } from 'react-redux';
import { getSubaccountFills, getSubaccountTransfers } from '@/state/accountSelectors';
import { useCallback, useMemo, useState } from 'react';
import { OutputType, formatNumber, formatTimestamp } from '@/components/Output';
import { MustBigNumber } from '@/lib/numbers';
import { OrderSide } from '@dydxprotocol/v4-client-js';
import { getSelectedLocale } from '@/state/localizationSelectors';
import { exportCSV } from '@/lib/csv';
import { useLocaleSeparators, useStringGetter } from '@/hooks';
import { ButtonAction, ButtonSize } from '@/constants/buttons';
import { DropdownMenu, DropdownMenuProps } from '@/components/DropdownMenu';
import { Checkbox } from '@/components/Checkbox';
import styled, { AnyStyledComponent } from 'styled-components';

import { track } from '@/lib/analytics';
import { AnalyticsEvent } from '@/constants/analytics';
import { exportCSV } from '@/lib/csv';
import { MustBigNumber } from '@/lib/numbers';

export const ExportHistoryDropdown = (props: DropdownMenuProps<string>) => {
const { items = [], ...rest } = props;
export const ExportHistoryDropdown = () => {
const selectedLocale = useSelector(getSelectedLocale);
const stringGetter = useStringGetter();
const allTransfers = useSelector(getSubaccountTransfers, shallowEqual) ?? [];
Expand Down Expand Up @@ -187,19 +191,20 @@ export const ExportHistoryDropdown = (props: DropdownMenuProps<string>) => {
exportTransfers();
}

track(AnalyticsEvent.ExportDownloadClick, { trades: checkedTrades, transfers: checkedTransfers })
track(AnalyticsEvent.ExportDownloadClick, {
trades: checkedTrades,
transfers: checkedTransfers,
});
}, [checkedTrades, checkedTransfers, exportTrades, exportTransfers]);

return (
<DropdownMenu
{...rest}
onOpenChange={(open) => {
if (open) {
track(AnalyticsEvent.ExportButtonClick);
}
}}
items={[
...items,
{
label: (
<Checkbox
Expand Down

0 comments on commit 4fce552

Please sign in to comment.