Skip to content

Commit 998a0f7

Browse files
New and improved Product Hub (#3810)
* simplify hub page and add redirect * replace nls with pseudo tabs * new filtering * basic filters support * store filters in querystring * load initial filters from querystring * remove promo cards * fix icon on multiselect * add categories component * filtering categories * format fix * tags component * filter by tags * format fix * group generic select * featured for navigation only * featured row * featured steakhouse * featured steakhouse on hp * automations in db * generic select search * help button * remove yield loop filtering * separator * sticky row * help links * refinance stuff * bluechip assets * mobile ver * format fix * automations in the table * ajna weekly rewards * min liquiditiy * ajna rewards rate * yield loop filtering * tags tooltips * button border fix * tags refinements * remove liquidity from earn * landing page adjustments * empty list * clear search * update name of steakhouse positions * fix limiting rows on homepage * remove memes from borrow * fix oracless pool rewards * lp only tag * automations control * mixpanel events * fix tag hover * extend featured filtering * fixed featured rows * fix table row height * fix typing on landing page * database query for marketing pages * update faq * remove incorrect product hub usage in refinance * format fix * fix the thing * post review fixes --------- Co-authored-by: Marcin Ciarka <marcin@oazoapps.com>
1 parent 99bf5db commit 998a0f7

File tree

156 files changed

+3589
-3539
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+3589
-3539
lines changed

.eslintrc.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
"@typescript-eslint/no-use-before-define": "off",
4747
"@typescript-eslint/no-useless-constructor": "error",
4848
"@typescript-eslint/no-non-null-assertion": "warn",
49-
"@typescript-eslint/no-shadow": ["warn", { "builtinGlobals": true, "hoist": "all" }],
49+
"@typescript-eslint/no-shadow": [
50+
"warn",
51+
{ "allow": ["Image", "Text", "Request"], "builtinGlobals": true, "hoist": "all" }
52+
],
5053
"no-unused-vars": "off",
5154
"@typescript-eslint/no-unused-vars": ["error"],
5255
"@typescript-eslint/consistent-type-imports": [

analytics/events-types/migrations-types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { MixpanelCommonAnalyticsSections, MixpanelPages } from 'analytics/types'
2-
import type { ProductHubProductType } from 'features/productHub/types'
2+
import type { OmniProductType } from 'features/omni-kit/types'
33
import type { LendingProtocol } from 'lendingProtocols'
44

55
export enum MixpanelMigrationsEventIds {
@@ -20,7 +20,7 @@ export type MixpanelMigrationsButtonClickParams =
2020
positionId: string
2121
alreadyHadDpm: boolean
2222
protocol: LendingProtocol
23-
positionType: ProductHubProductType.Borrow | ProductHubProductType.Earn
23+
positionType: OmniProductType.Borrow | OmniProductType.Earn
2424
tokenOrPair: string
2525
stopLoss?: {
2626
level: string

analytics/trackingEvents.ts

+9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { TrackingProductType } from './TrackingProductType'
1717
import type {
1818
MixpanelAutomationEventIds,
1919
MixpanelAutomationEventsAdditionalParams,
20+
MixpanelProductHubChangeFilter,
2021
MixpanelSwapWidgetEvents,
2122
MixpanelTopBannerEvents,
2223
} from './types'
@@ -964,6 +965,14 @@ export const trackingEvents = {
964965
!mixpanel.has_opted_out_tracking() &&
965966
mixpanelInternalAPI(MixpanelEventTypes.TxStatus, eventBody)
966967
},
968+
productHub: {
969+
filterChange: (filter: MixpanelProductHubChangeFilter, value: string) => {
970+
mixpanelInternalAPI(MixpanelEventTypes.ProductHubChange, {
971+
filter,
972+
value,
973+
})
974+
},
975+
},
967976
}
968977

969978
export type Tracker = typeof trackingEvents

analytics/types.ts

+13
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,17 @@ export enum MixpanelEventTypes {
121121
TxStatus = 'tx-status',
122122
SwapWidgetEvent = 'swap-widget-event',
123123
TopBannerEvent = 'top-banner-event',
124+
ProductHubChange = 'product-hub-change',
125+
}
126+
127+
export enum MixpanelProductHubChangeFilter {
128+
Category = 'Category',
129+
CollateralToken = 'CollateralToken',
130+
DebtToken = 'DebtToken',
131+
DepositToken = 'DepositToken',
132+
MinLiquidity = 'MinLiquidity',
133+
Network = 'Network',
134+
ProductType = 'ProductType',
135+
Protocol = 'Protocol',
136+
Tag = 'MinLiquidity',
124137
}

components/AutomationIcon.tsx

+18-36
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,41 @@
11
import { Icon } from 'components/Icon'
2+
import type { IconProps } from 'components/Icon.types'
23
import { StatefulTooltip } from 'components/Tooltip'
34
import type { PortfolioPosition } from 'handlers/portfolio/types'
45
import { useTranslation } from 'next-i18next'
56
import React from 'react'
67
import { auto_buy, auto_sell, constant_multiple, stop_loss, take_profit } from 'theme/icons'
78

8-
const automationIconMap: Record<keyof PortfolioPosition['automations'], typeof stop_loss> = {
9+
interface AutomationIconProps {
10+
enabled: boolean
11+
iconNotActiveBg?: string
12+
type: keyof PortfolioPosition['automations']
13+
}
14+
15+
const automationIconMap: Record<keyof PortfolioPosition['automations'], IconProps['icon']> = {
916
autoBuy: auto_buy,
1017
autoSell: auto_sell,
11-
takeProfit: take_profit,
12-
stopLoss: stop_loss,
1318
constantMultiple: constant_multiple,
19+
stopLoss: stop_loss,
20+
takeProfit: take_profit,
1421
}
1522

16-
export const AutomationIcon = ({
17-
enabled,
18-
type,
19-
iconNotActiveBg,
20-
}: {
21-
enabled: boolean
22-
type: keyof PortfolioPosition['automations']
23-
iconNotActiveBg?: string
24-
}) => {
23+
export const AutomationIcon = ({ enabled, iconNotActiveBg, type }: AutomationIconProps) => {
2524
const { t: tPortfolio } = useTranslation('portfolio')
25+
2626
return (
2727
<StatefulTooltip
2828
tooltip={tPortfolio(`automation-details.${type}`)}
2929
containerSx={{
3030
position: 'relative',
31-
backgroundColor: enabled ? 'success100' : iconNotActiveBg || 'secondary60',
31+
p: '6px',
32+
backgroundColor: enabled ? 'success10' : iconNotActiveBg ?? 'secondary60',
3233
borderRadius: 'ellipse',
33-
transition: 'background-color 200ms, color 200ms',
34-
...(enabled && {
35-
'&:hover': {
36-
backgroundColor: 'success10',
37-
'& path': {
38-
color: 'success100',
39-
},
40-
},
41-
}),
34+
color: enabled ? 'success100' : 'primary60',
4235
}}
4336
tooltipSx={{
44-
bottom: '100%',
45-
mb: 1,
37+
top: '100%',
38+
mt: 1,
4639
fontSize: 1,
4740
textAlign: 'left',
4841
border: 'none',
@@ -51,18 +44,7 @@ export const AutomationIcon = ({
5144
whiteSpace: 'nowrap',
5245
}}
5346
>
54-
<Icon
55-
icon={automationIconMap[type]}
56-
size="34px"
57-
sx={{
58-
display: 'block',
59-
p: 2,
60-
'& path': {
61-
transition: 'color 200ms',
62-
color: enabled ? 'white' : 'primary60',
63-
},
64-
}}
65-
/>
47+
<Icon icon={automationIconMap[type]} size="24px" sx={{ display: 'block' }} />
6648
</StatefulTooltip>
6749
)
6850
}

components/BrandTag.tsx

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import {
2+
getGradientColor,
3+
summerBrandGradient,
4+
summerFadedBrandGradient,
5+
} from 'helpers/getGradientColor'
6+
import type { FC } from 'react'
7+
import React from 'react'
8+
import type { ThemeUIStyleObject } from 'theme-ui'
9+
import { Box, Text } from 'theme-ui'
10+
11+
interface BrandTagProsp {
12+
sx?: ThemeUIStyleObject
13+
}
14+
15+
export const BrandTag: FC<BrandTagProsp> = ({ children, sx }) => (
16+
<Box
17+
as="span"
18+
sx={{
19+
position: 'relative',
20+
display: 'inline-flex',
21+
alignItems: 'center',
22+
height: '28px',
23+
px: '12px',
24+
background: summerFadedBrandGradient,
25+
borderRadius: 'roundish',
26+
verticalAlign: 'bottom',
27+
...sx,
28+
'*&::before': {
29+
content: '""',
30+
position: 'absolute',
31+
top: '1px',
32+
left: '1px',
33+
bottom: '1px',
34+
right: '1px',
35+
background: 'neutral10',
36+
borderRadius: 'roundish',
37+
},
38+
}}
39+
>
40+
<Text
41+
variant="paragraph4"
42+
sx={{ position: 'relative', ...getGradientColor(summerBrandGradient) }}
43+
>
44+
{children}
45+
</Text>
46+
</Box>
47+
)

0 commit comments

Comments
 (0)