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(staking): stake pools add sort & filter LW-9250 #867

Merged
merged 42 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2fc1ed5
feat(staking): initial component implementation
mchappell Jan 24, 2024
bf52517
feat(staking): sort and filter stake pools
tommayeliog Jan 30, 2024
7c3e79b
feat(staking): stake pools sort&filters add debouce and sort desc icon
tommayeliog Jan 31, 2024
74dd909
feat(staking): pools sort&filter Storybook
tommayeliog Jan 31, 2024
c9d16df
feat(staking): fix form when only 1 option
tommayeliog Jan 31, 2024
46e0f96
feat(staking): sort&filter storybook
tommayeliog Feb 1, 2024
a4b1e1a
fix(core): fix radio button with Icon gaps and alignment
tommayeliog Feb 5, 2024
e426c7c
feat(staking): sort and filtering css changes
tommayeliog Feb 5, 2024
72c73f8
Merge branch 'main' into feature/LW-9250-Stake-pools-sort-filter
tommayeliog Feb 5, 2024
5aa7906
feat(staking): soft and filter fix sorting and translations
tommayeliog Feb 7, 2024
c782fce
Merge branch 'main' into feature/LW-9250-Stake-pools-sort-filter
tommayeliog Feb 7, 2024
f6064aa
feat(staking): using StakePoolSortOptions for SortAndFilter
tommayeliog Feb 7, 2024
50244c1
Merge branch 'feature/LW-9250-Stake-pools-sort-filter' of github.com:…
tommayeliog Feb 7, 2024
4ef77fd
feat(staking): prevent sorting on unsupported columns
tommayeliog Feb 8, 2024
4201f96
Merge branch 'main' into feature/LW-9250-Stake-pools-sort-filter
tommayeliog Feb 8, 2024
a97f0cc
feat(staking): sort&filter translations
tommayeliog Feb 8, 2024
20f2889
fix(ui): make outline inset to avoid overlapping sibling TextBox inputs
przemyslaw-wlodek Feb 8, 2024
f613f5a
refactor(staking): style -> sx and remove redundant node
przemyslaw-wlodek Feb 8, 2024
f2da17f
feat(staking): sort and filter fix border
tommayeliog Feb 8, 2024
16581b4
feat(staking): add storybook action console.log
tommayeliog Feb 9, 2024
4bf00f0
fix(core): undo radiobutton storybook changes
tommayeliog Feb 9, 2024
0ad4482
refactor(ui): radio-button (code review)
przemyslaw-wlodek Feb 12, 2024
4989916
refactor(staking): sortAndFilter (code review)
przemyslaw-wlodek Feb 12, 2024
3d63690
refactor(ui): fix spacing in ToggleButtonGroup without children
przemyslaw-wlodek Feb 12, 2024
c05cb83
Merge remote-tracking branch 'origin/main' into feature/LW-9250-Stake…
przemyslaw-wlodek Feb 14, 2024
ed7286b
refactor(ui): post-merge fixes
przemyslaw-wlodek Feb 14, 2024
da17645
fix(staking): sortAndFilter translations, colors and other QA changes
przemyslaw-wlodek Feb 15, 2024
c331d13
chore(staking): fix storybook after recent changes in main
przemyslaw-wlodek Feb 15, 2024
9a62dde
Merge remote-tracking branch 'origin/main' into feature/LW-9250-Stake…
przemyslaw-wlodek Feb 16, 2024
51f67b6
Merge remote-tracking branch 'origin/main' into feature/LW-9250-Stake…
przemyslaw-wlodek Feb 19, 2024
92d6212
chore(staking): mock @lace/cardano for storybook in Staking
przemyslaw-wlodek Feb 19, 2024
32489b8
Revert "chore(staking): mock @lace/cardano for storybook in Staking"
przemyslaw-wlodek Feb 20, 2024
dc1d8a2
Merge remote-tracking branch 'origin/main' into feature/LW-9250-Stake…
przemyslaw-wlodek Feb 20, 2024
f8b47e8
feat(extension): adding sort and filter to browser extension
tommayeliog Feb 20, 2024
e3c5172
Revert "feat(extension): adding sort and filter to browser extension"
przemyslaw-wlodek Feb 21, 2024
870b4d1
Merge remote-tracking branch 'origin/main' into feature/LW-9250-Stake…
przemyslaw-wlodek Feb 21, 2024
6b8d5a8
chore(staking): remove unused dependencies
przemyslaw-wlodek Feb 21, 2024
bf4ab3b
Merge remote-tracking branch 'origin/main' into feature/LW-9250-Stake…
przemyslaw-wlodek Feb 21, 2024
c370040
fix(ui): allow stretching width of items in radio-button-group
przemyslaw-wlodek Feb 21, 2024
1de5c09
fix(staking): filter label font size
przemyslaw-wlodek Feb 21, 2024
f4a13cf
chore: update staking dependencies
mchappell Feb 21, 2024
bdcb7f8
chore: update staking storybook build cli script
mchappell Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/icons/raw/sort-direction-asc.component.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/raw/sort-direction-desc.component.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/staking/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const wrapWith =

const preview: Preview = {
parameters: {
chromatic: { pauseAnimationAtEnd: true },
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
Expand Down
12 changes: 6 additions & 6 deletions packages/staking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"scripts": {
"build": "tsc && tsup",
"build:storybook": "NODE_OPTIONS=--openssl-legacy-provider; storybook build",
"build-storybook": "NODE_OPTIONS=--openssl-legacy-provider; storybook build",
"cleanup": "yarn exec rm -rf dist node_modules && yarn exec rm -rf ../../.cache/eslintcache",
"dev": "NODE_OPTIONS=--openssl-legacy-provider; storybook dev -p 6006",
"eslint:check": "yarn run -T eslint --cache --cache-location ../../.cache/eslintcache --cache-strategy metadata --ignore-path '../../.eslintignore' '**/*.{cjs,mjs,js,ts,tsx}'",
Expand All @@ -50,6 +50,11 @@
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@lace/cardano": "^0.1.0",
"@lace/common": "^0.1.0",
"@lace/core": "0.1.0",
"@lace/icons": "0.1.0",
"@lace/ui": "^0.1.0",
"@radix-ui/react-slider": "^1.1.2",
"@vanilla-extract/css": "^1.11.1",
"classnames": "^2.3.2",
Expand All @@ -71,11 +76,6 @@
"@cardano-sdk/input-selection": "0.12.20",
"@cardano-sdk/tx-construction": "0.17.10",
"@cardano-sdk/util": "0.15.0",
"@lace/cardano": "^0.1.0",
"@lace/common": "^0.1.0",
"@lace/core": "0.1.0",
"@lace/icons": "0.1.0",
"@lace/ui": "^0.1.0",
"@storybook/addon-actions": "^7.6.7",
"@storybook/addon-essentials": "^7.6.7",
"@storybook/addon-interactions": "^7.6.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { style, sx } from '@lace/ui';
import { theme } from 'features/theme';

export const textBoxLeft = style({
borderBottomRightRadius: 0,
borderRightColor: theme.colors.$browsePoolsFilterInputRightBorderColor,
borderRightStyle: 'solid',
borderRightWidth: 2,
borderTopRightRadius: 0,
});

export const textBoxRight = style({
borderBottomLeftRadius: 0,
borderTopLeftRadius: 0,
});

export const radioGroup = sx({
width: '$fill',
});

export const selectGroup = sx({
width: '$fill',
});

export const card = sx({
width: '$342',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { Box, Cell, Flex, Grid, LocalThemeProvider, Section, ThemeColorScheme, Variants } from '@lace/ui';
import { action } from '@storybook/addon-actions';
import { SortDirection, SortField, StakePoolSortOptions } from 'features/BrowsePools';
import { useCallback, useState } from 'react';
import type { Meta } from '@storybook/react';

import { SortAndFilter } from './SortAndFilter';
import { FilterValues, PoolsFilter, SortAndFilterTab } from './types';

export default {
title: 'Cards/Stake Pool Sorting & Filter',
} as Meta;

const Wrapper = ({ defaultTab }: { defaultTab: SortAndFilterTab }) => {
const [activeTab, setActiveTab] = useState(defaultTab);
const [sort, setSort] = useState<StakePoolSortOptions>({
field: SortField.saturation,
order: SortDirection.asc,
});
const [filter, setFilter] = useState<FilterValues>({
[PoolsFilter.Saturation]: ['', ''],
[PoolsFilter.ProfitMargin]: ['', ''],
[PoolsFilter.Performance]: ['', ''],
[PoolsFilter.Ros]: ['lastepoch'],
});

const handleSortChange = useCallback(
(options: StakePoolSortOptions) => {
action('SortChange')(options);
setSort(options);
},
[setSort]
);

const handleFilterChange = useCallback(
(options: FilterValues) => {
action('FilterChange')(options);
setFilter(options);
},
[setFilter]
);

return (
<SortAndFilter
activeTab={activeTab}
sort={sort}
filter={filter}
onTabChange={setActiveTab}
onSortChange={handleSortChange}
onFilterChange={handleFilterChange}
/>
);
};

const CardsGroup = () => (
<Flex
style={{
flexWrap: 'wrap',
rowGap: 10,
}}
gap="$20"
>
<Box w="$342">
<Wrapper defaultTab={SortAndFilterTab.sort} />
</Box>
<Box w="$342">
<Wrapper defaultTab={SortAndFilterTab.filter} />
</Box>
</Flex>
);

export const Overview = (): JSX.Element => (
<>
<Grid columns="$2">
<Cell w="$fill" style={{ display: 'inline-flex', justifyContent: 'center' }}>
<Wrapper defaultTab={SortAndFilterTab.sort} />
</Cell>
<Cell style={{ display: 'inline-flex', justifyContent: 'center' }}>
<Wrapper defaultTab={SortAndFilterTab.filter} />
</Cell>
</Grid>

<Section title="Main component">
<Grid columns="$1">
<Cell>
<Variants.Table headers={['Default']}>
<Variants.Row>
<Variants.Cell>
<CardsGroup />
</Variants.Cell>
</Variants.Row>
</Variants.Table>
</Cell>
<Cell>
<LocalThemeProvider colorScheme={ThemeColorScheme.Dark}>
<Variants.Table headers={['Dark Mode']}>
<Variants.Row>
<Variants.Cell>
<CardsGroup />
</Variants.Cell>
</Variants.Row>
</Variants.Table>
</LocalThemeProvider>
</Cell>
</Grid>
</Section>
</>
);
Loading
Loading