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

TW-830: Collectibles Manage dropdown #925

Merged
merged 27 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
af8ba2b
TW-826: Collectibles re-design
alex-tsx Jun 23, 2023
8bc0474
TW-828: Collectibles grid layout
alex-tsx Jun 24, 2023
3430d15
TW-828: Collectibles grid layout. + Scroll tabsbar into view
alex-tsx Jun 26, 2023
65183c2
TW-828: Collectibles grid layout. ++ Images
alex-tsx Jun 26, 2023
079102d
TW-864: Collectibles hover effect
alex-tsx Jun 26, 2023
8898d8d
TW-828: Collectibles grid layout. Refactor
alex-tsx Jun 26, 2023
a7e1dca
Merge branch 'development' into TW-828-collectibles-grid
alex-tsx Jun 26, 2023
91b219a
TW-828: Collectibles grid layout. Refactor
alex-tsx Jun 29, 2023
fd976af
TW-830: Collectibles Manage dropdown. + Detailed grid
alex-tsx Jun 29, 2023
b47a127
TW-830: Collectibles Manage dropdown. + Detailes toggle
alex-tsx Jul 3, 2023
6672f10
TW-830: Collectibles Manage dropdown. + Floor prices
alex-tsx Jul 3, 2023
531ab18
Merge branch 'development' into TW-830-collectibles-manage-dropdown
alex-tsx Jul 4, 2023
c19133b
Merge branch 'development' into TW-828-collectibles-grid
alex-tsx Jul 4, 2023
1583a18
TW-828: Collectibles grid layout. Fix after QA
alex-tsx Jul 4, 2023
3c5b1e4
Merge branch 'TW-828-collectibles-grid' into TW-830-collectibles-mana…
alex-tsx Jul 4, 2023
0757ded
TW-830: Collectibles Manage dropdown. Fix floor price currency
alex-tsx Jul 4, 2023
76f3d2f
TW-830: Collectibles Manage dropdown. Refactor
alex-tsx Jul 5, 2023
e14d147
TW-830: Collectibles Manage dropdown. Refactor
alex-tsx Jul 5, 2023
ea9ab54
TW-830: Collectibles Manage dropdown. Refactor
alex-tsx Jul 5, 2023
b4b43fb
Merge branch 'development' into TW-830-collectibles-manage-dropdown
alex-tsx Jul 5, 2023
5d6a994
TW-830: Collectibles Manage dropdown. Fix QA. Loading details by slugs
alex-tsx Jul 6, 2023
be31160
TW-830: Collectibles Manage dropdown. Fix QA. By design
alex-tsx Jul 6, 2023
de83dd4
TW-830: Collectibles Manage dropdown. Fix QA. Scroll to the tabs bar
alex-tsx Jul 6, 2023
119bff1
TW-830: Collectibles Manage dropdown. Fix QA. Refactor
alex-tsx Jul 6, 2023
4b72ec6
Merge branch 'development' into TW-830-collectibles-manage-dropdown
alex-tsx Jul 10, 2023
9c7b2f7
TW-830: Collectibles Manage dropdown. Fix QA. 2 decimals for unletter…
alex-tsx Jul 10, 2023
5c0f445
TW-830: Collectibles Manage dropdown. Refactor
alex-tsx Jul 10, 2023
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
6 changes: 6 additions & 0 deletions public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2358,6 +2358,9 @@
"message": "less",
"description": "Show less"
},
"showInfo": {
"message": "Show info"
},
"recentDestinations": {
"message": "Recent destinations"
},
Expand Down Expand Up @@ -3049,5 +3052,8 @@
},
"creditCard": {
"message": "credit card"
},
"notListed": {
"message": "Not listed"
}
}
3 changes: 3 additions & 0 deletions public/_locales/uk/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1855,5 +1855,8 @@
"content": "$1"
}
}
},
"showInfo": {
"message": "Деталі"
}
}
2 changes: 2 additions & 0 deletions src/app/WithDataLoading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { FC, useEffect } from 'react';
import { useDispatch } from 'react-redux';

import { useAdvertisingLoading } from 'app/hooks/use-advertising.hook';
import { useCollectiblesDetailsLoading } from 'app/hooks/use-collectibles-details-loading';
import { useLongRefreshLoading } from 'app/hooks/use-long-refresh-loading.hook';
import { useMetadataLoading } from 'app/hooks/use-metadata-loading';
import { useTokensLoading } from 'app/hooks/use-tokens-loading';
Expand All @@ -15,6 +16,7 @@ export const WithDataLoading: FC<PropsWithChildren> = ({ children }) => {
useMetadataLoading();
useTokensLoading();
useBalancesLoading();
useCollectiblesDetailsLoading();

useLongRefreshLoading();
useAdvertisingLoading();
Expand Down
13 changes: 0 additions & 13 deletions src/app/atoms/ActivitySpinner.tsx

This file was deleted.

27 changes: 14 additions & 13 deletions src/app/atoms/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ import { ReactComponent as OkIcon } from 'app/icons/ok.svg';
import { TestIDProps, setTestID, useAnalytics, AnalyticsEventCategory } from 'lib/analytics';
import { blurHandler, checkedHandler, focusHandler } from 'lib/ui/inputHandlers';

export type CheckboxProps = TestIDProps &
Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'checked' | 'className' | 'onFocus' | 'onBlur' | 'onClick'> & {
containerClassName?: string;
errored?: boolean;
onChange?: (checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
};
export interface CheckboxProps
extends TestIDProps,
Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'checked' | 'className' | 'onFocus' | 'onBlur' | 'onClick'> {
overrideClassNames?: string;
errored?: boolean;
onChange?: (checked: boolean, event: React.ChangeEvent<HTMLInputElement>) => void;
}

const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
(
{
containerClassName,
overrideClassNames,
errored = false,
className,
checked,
Expand Down Expand Up @@ -64,8 +65,8 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
const classNameMemo = useMemo(
() =>
classNames(
'flex justify-center items-center h-6 w-6 flex-shrink-0',
'text-white border rounded-md overflow-hidden',
'flex justify-center items-center flex-shrink-0',
'text-white border overflow-hidden',
'transition ease-in-out duration-200 disable-outline-for-click',
localChecked ? 'bg-primary-orange' : 'bg-black-40',
localFocused && 'shadow-outline',
Expand All @@ -81,9 +82,9 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
return 'border-gray-400';
}
})(),
containerClassName
overrideClassNames || 'h-6 w-6 rounded-md'
),
[localChecked, localFocused, errored, containerClassName]
[localChecked, localFocused, errored]
);

return (
Expand All @@ -101,8 +102,8 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(
/>

<OkIcon
className={classNames(localChecked ? 'block' : 'hidden', 'h-4 w-4 pointer-events-none stroke-current')}
style={{ strokeWidth: 2 }}
className={classNames(localChecked ? 'block' : 'hidden', 'pointer-events-none stroke-current')}
style={{ strokeWidth: 2, height: '67%', width: '67%' }}
/>
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions src/app/atoms/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { FC } from 'react';

import clsx from 'clsx';
keshan3262 marked this conversation as resolved.
Show resolved Hide resolved

interface DividerProps {
style?: React.CSSProperties;
className?: string;
Expand All @@ -8,12 +10,10 @@ interface DividerProps {
const Divider: FC<DividerProps> = ({ style, className }) => (
<div
style={{
width: '100%',
height: '1px',
backgroundColor: '#E2E8F0',
...style
}}
className={className}
className={clsx('w-full bg-gray-300', className)}
/>
);

Expand Down
4 changes: 2 additions & 2 deletions src/app/atoms/FormCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import classNames from 'clsx';
import Checkbox, { CheckboxProps } from 'app/atoms/Checkbox';
import { AnalyticsEventCategory, setTestID, useAnalytics } from 'lib/analytics';

export type FormCheckboxProps = CheckboxProps & {
export interface FormCheckboxProps extends CheckboxProps {
label?: ReactNode;
labelDescription?: ReactNode;
errorCaption?: ReactNode;
containerClassName?: string;
labelClassName?: string;
};
}

export const FormCheckbox = forwardRef<HTMLInputElement, FormCheckboxProps>(
(
Expand Down
9 changes: 3 additions & 6 deletions src/app/atoms/ImportTabSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@ const ImportTabSwitcher: React.FC<ImportTabSwitcherProps> = ({ className, tabs,
<Link key={slug} to={`${urlPrefix}/${slug}`} replace>
<div
className={classNames(
'text-center cursor-pointer pb-1 pt-2 px-4',
'text-gray-500',
'border-b-2',
active ? 'border-primary-orange' : 'border-transparent',
active ? 'text-primary-orange' : 'hover:text-primary-orange',
'text-center cursor-pointer pb-1 pt-2 px-4 border-b-2',
'text-gray-500 truncate',
'transition ease-in-out duration-300',
'truncate'
active ? 'border-primary-orange text-primary-orange' : 'border-transparent hover:text-primary-orange'
)}
>
<T id={i18nKey} />
Expand Down
5 changes: 4 additions & 1 deletion src/app/atoms/Spinner/Spinner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from 'clsx';
import styles from './Spinner.module.css';

type SpinnerProps = HTMLAttributes<HTMLDivElement> & {
theme?: 'primary' | 'white' | 'gray';
theme?: 'primary' | 'white' | 'gray' | 'dark-gray';
};

const Spinner = memo<SpinnerProps>(({ theme = 'primary', className, ...rest }) => (
Expand All @@ -24,6 +24,9 @@ const Spinner = memo<SpinnerProps>(({ theme = 'primary', className, ...rest }) =
case 'white':
return 'bg-white shadow-sm';

case 'dark-gray':
return 'bg-gray-600';

case 'gray':
default:
return 'bg-gray-400';
Expand Down
15 changes: 15 additions & 0 deletions src/app/atoms/SyncSpinner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as React from 'react';

import clsx from 'clsx';

import Spinner from './Spinner/Spinner';

interface Props {
className?: string;
}

export const SyncSpinner: React.FC<Props> = ({ className }) => (
<div className={clsx('w-full', className)}>
<Spinner theme="gray" className="w-16 m-auto" />
</div>
);
2 changes: 1 addition & 1 deletion src/app/atoms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export { FormSecondaryButton } from './FormSecondaryButton';
export type { FormCheckboxProps } from './FormCheckbox';
export { FormCheckbox } from './FormCheckbox';

export { ActivitySpinner } from './ActivitySpinner';
export { SyncSpinner } from './SyncSpinner';

export { NoSpaceField } from './NoSpaceField';

Expand Down
2 changes: 2 additions & 0 deletions src/app/atoms/useTabSlug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { useLocation } from 'lib/woozie';

export const useTabSlug = () => {
const { search } = useLocation();

const tabSlug = useMemo(() => {
const usp = new URLSearchParams(search);
return usp.get('tab');
}, [search]);

return useMemo(() => tabSlug, [tabSlug]);
};
17 changes: 17 additions & 0 deletions src/app/hooks/use-collectibles-details-loading.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useDispatch } from 'react-redux';

import { loadCollectiblesDetailsActions } from 'app/store/collectibles/actions';
import { COLLECTIBLES_DETAILS_SYNC_INTERVAL } from 'lib/fixed-times';
import { useAccount } from 'lib/temple/front';
import { useInterval } from 'lib/ui/hooks';

export const useCollectiblesDetailsLoading = () => {
const { publicKeyHash } = useAccount();
const dispatch = useDispatch();

useInterval(
() => void dispatch(loadCollectiblesDetailsActions.submit(publicKeyHash)),
COLLECTIBLES_DETAILS_SYNC_INTERVAL,
[publicKeyHash, dispatch]
);
};
13 changes: 13 additions & 0 deletions src/app/icons/broken-image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/app/icons/editing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/app/icons/manage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 20 additions & 3 deletions src/app/layouts/PageLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import React, { ComponentProps, FC, ReactNode, Suspense, useEffect, useLayoutEffect, useRef, useState } from 'react';
import React, {
ComponentProps,
FC,
ReactNode,
Suspense,
useCallback,
useEffect,
useLayoutEffect,
useRef,
useState
} from 'react';

import classNames from 'clsx';

Expand Down Expand Up @@ -96,6 +106,8 @@ type ToolbarProps = {
attention?: boolean;
};

export let ToolbarElement: HTMLDivElement | null = null;

const Toolbar: FC<ToolbarProps> = ({
pageTitle,
hasBackAction = true,
Expand Down Expand Up @@ -137,7 +149,7 @@ const Toolbar: FC<ToolbarProps> = ({

const [sticked, setSticked] = useState(false);

const rootRef = useRef<HTMLDivElement>(null);
const rootRef = useRef<HTMLDivElement | null>();

useEffect(() => {
const toolbarEl = rootRef.current;
Expand All @@ -157,9 +169,14 @@ const Toolbar: FC<ToolbarProps> = ({
return undefined;
}, [setSticked]);

const updateRootRef = useCallback((elem: HTMLDivElement | null) => {
rootRef.current = elem;
ToolbarElement = elem;
}, []);

return (
<div
ref={rootRef}
ref={updateRootRef}
className={classNames(
'sticky z-20 flex items-center py-2 px-4',
fullPage && !sticked && 'rounded-t',
Expand Down
5 changes: 3 additions & 2 deletions src/app/layouts/TabsPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ export const TabsPageLayout: FC<Props> = ({ tabs, icon, title, description }) =>
'flex1 w-full text-center cursor-pointer pb-2',
'border-b-2 text-gray-700 text-lg truncate',
tabs.length === 1 && 'mx-20',
active ? 'border-primary-orange' : 'border-transparent',
active ? 'text-primary-orange' : 'hover:text-primary-orange',
active
? 'border-primary-orange text-primary-orange'
: 'border-transparent hover:text-primary-orange',
'transition ease-in-out duration-300'
)}
testID={tab.testID}
Expand Down
Loading
Loading