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

add favorites to portfolio #3853

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 15 additions & 2 deletions packages/web/components/table/asset-balances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ import { useLocalStorage } from "react-use";

import { AssetCell } from "~/components/table/cells/asset";
import { SpriteIconId } from "~/config";
import { MultiLanguageT } from "~/hooks";
import {
Breakpoint,
MultiLanguageT,
useFeatureFlags,
useTranslation,
useUserWatchlist,
useWalletSelect,
useWindowSize,
} from "~/hooks";
Expand Down Expand Up @@ -169,6 +170,8 @@ export const AssetBalancesTable: FunctionComponent<{

const noSearchResults = Boolean(searchQuery) && !filteredAssetsData.length;

const { watchListDenoms, toggleWatchAssetDenom } = useUserWatchlist();

// Define columns
const columns = useMemo(() => {
const columnHelper = createColumnHelper<AssetRow>();
Expand All @@ -180,6 +183,8 @@ export const AssetBalancesTable: FunctionComponent<{
<AssetCell
{...asset}
warnUnverified={showUnverifiedAssets && !asset.isVerified}
isInUserWatchlist={watchListDenoms.includes(asset.coinDenom)}
onClickWatchlist={() => toggleWatchAssetDenom(asset.coinDenom)}
/>
),
}),
Expand Down Expand Up @@ -225,7 +230,15 @@ export const AssetBalancesTable: FunctionComponent<{
),
}),
];
}, [sortKey, sortDirection, showUnverifiedAssets, setSortKey, t]);
}, [
sortKey,
sortDirection,
showUnverifiedAssets,
setSortKey,
t,
watchListDenoms,
toggleWatchAssetDenom,
]);

/** Columns collapsed for screen size responsiveness. */
const collapsedColumns = useMemo(() => {
Expand Down
3 changes: 1 addition & 2 deletions packages/web/components/table/cells/asset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ export const AssetCell: FunctionComponent<
onClick={(e) => {
e.stopPropagation();
e.preventDefault();

onClickWatchlist();
}}
className={classNames(
"cursor-pointer transition-colors duration-150 ease-out hover:text-wosmongton-300",
isInUserWatchlist ? "text-wosmongton-400" : "text-osmoverse-600"
)}
id="star"
id={isInUserWatchlist ? "star" : "star-outlined"}
/>
</div>
)}
Expand Down
6 changes: 2 additions & 4 deletions packages/web/public/icons/sprite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading