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

Create status bar #47181

Merged
merged 35 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b666cdd
create buildCannedSearchQuery
luacmartins Aug 9, 2024
22aa4c8
rm const
luacmartins Aug 9, 2024
d19b0c4
rename components
luacmartins Aug 9, 2024
cb6a815
update header
luacmartins Aug 9, 2024
350d2c1
create SearchStatusBar
luacmartins Aug 9, 2024
980b470
add StatusBar to search page
luacmartins Aug 9, 2024
4d6f6db
use tab item
luacmartins Aug 9, 2024
897f062
fix styles
luacmartins Aug 9, 2024
45b8069
update illustrations
luacmartins Aug 12, 2024
4510a30
style tabs
luacmartins Aug 12, 2024
54b2062
use buttons
luacmartins Aug 12, 2024
336c7fc
fix data types
luacmartins Aug 12, 2024
78548b4
add all statuses
luacmartins Aug 12, 2024
d5b6d40
update translation
luacmartins Aug 12, 2024
d9845a0
add scroll
luacmartins Aug 12, 2024
d1bda7c
rm transaction/report types
luacmartins Aug 12, 2024
91378bd
fix ts
luacmartins Aug 12, 2024
be58af1
add scrollview
luacmartins Aug 12, 2024
aa7bdf2
resolve conflicts
luacmartins Aug 12, 2024
5460855
resolve conflicts
luacmartins Aug 12, 2024
8fb2322
fix lint
luacmartins Aug 12, 2024
1eda581
fix lint
luacmartins Aug 12, 2024
20d9737
resolve conflicts
luacmartins Aug 13, 2024
695775b
update hover style, fix crash
luacmartins Aug 13, 2024
5b4130a
use transaction as default type
luacmartins Aug 13, 2024
c609b19
fix lint
luacmartins Aug 13, 2024
e0d88c3
rm finished and shared status
luacmartins Aug 13, 2024
298ea3f
fix styles
luacmartins Aug 14, 2024
f9e6f5f
add key to list el
luacmartins Aug 14, 2024
50a0632
update button
luacmartins Aug 14, 2024
797e883
rm unused imports
luacmartins Aug 14, 2024
13175e9
resolve conflicts
luacmartins Aug 15, 2024
13e77b6
fix loading
luacmartins Aug 15, 2024
542ed1a
workaround for race condition
luacmartins Aug 15, 2024
a66c2db
allow overflow
luacmartins Aug 16, 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 3 additions & 12 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5243,8 +5243,6 @@ const CONST = {
SEARCH: {
RESULTS_PAGE_SIZE: 50,
DATA_TYPES: {
TRANSACTION: 'transaction',
REPORT: 'report',
EXPENSE: 'expense',
INVOICE: 'invoice',
TRIP: 'trip',
Expand Down Expand Up @@ -5273,9 +5271,10 @@ const CONST = {
STATUS: {
EXPENSE: {
ALL: 'all',
SHARED: 'shared',
DRAFTS: 'drafts',
FINISHED: 'finished',
OUTSTANDING: 'outstanding',
APPROVED: 'approved',
PAID: 'paid',
},
INVOICE: {
ALL: 'all',
Expand All @@ -5290,14 +5289,6 @@ const CONST = {
PAID: 'paid',
},
},
TAB: {
EXPENSE: {
ALL: 'type:expense status:all',
SHARED: 'type:expense status:shared',
DRAFTS: 'type:expense status:drafts',
FINISHED: 'type:expense status:finished',
},
},
TABLE_COLUMNS: {
RECEIPT: 'receipt',
DATE: 'date',
Expand Down
20 changes: 17 additions & 3 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type ButtonProps = Partial<ChildrenProps> & {
/** The fill color to pass into the icon. */
iconFill?: string;

/** The fill color to pass into the icon when the button is hovered. */
iconHoverFill?: string;

/** Any additional styles to pass to the left icon container. */
iconStyles?: StyleProp<ViewStyle>;

Expand Down Expand Up @@ -80,9 +83,15 @@ type ButtonProps = Partial<ChildrenProps> & {
/** Additional text styles */
textStyles?: StyleProp<TextStyle>;

/** Additional text styles when the button is hovered */
textHoverStyles?: StyleProp<TextStyle>;

/** Whether we should use the default hover style */
shouldUseDefaultHover?: boolean;

/** Additional hover styles */
hoverStyles?: StyleProp<ViewStyle>;

/** Whether we should use the success theme color */
success?: boolean;

Expand Down Expand Up @@ -170,6 +179,7 @@ function Button(

iconRight = Expensicons.ArrowRight,
iconFill,
iconHoverFill,
icon = null,
iconStyles = [],
iconRightStyles = [],
Expand All @@ -194,8 +204,10 @@ function Button(
style = [],
innerStyles = [],
textStyles = [],
textHoverStyles = [],

shouldUseDefaultHover = true,
hoverStyles = undefined,
success = false,
danger = false,

Expand Down Expand Up @@ -238,6 +250,7 @@ function Button(
danger && styles.buttonDangerText,
!!icon && styles.textAlignLeft,
textStyles,
isHovered && textHoverStyles,
link && styles.link,
link && isHovered && StyleUtils.getColorStyle(theme.linkHover),
link && styles.fontWeightNormal,
Expand All @@ -259,7 +272,7 @@ function Button(
<Icon
src={icon}
hasText={!!text}
fill={iconFill ?? (success || danger ? theme.textLight : theme.icon)}
fill={isHovered ? iconHoverFill : iconFill ?? (success || danger ? theme.textLight : theme.icon)}
small={small}
medium={medium}
large={large}
Expand All @@ -273,14 +286,14 @@ function Button(
{!isSplitButton ? (
<Icon
src={iconRight}
fill={iconFill ?? (success || danger ? theme.textLight : theme.icon)}
fill={isHovered ? iconHoverFill : iconFill ?? (success || danger ? theme.textLight : theme.icon)}
small={medium}
medium={large}
/>
) : (
<Icon
src={iconRight}
fill={iconFill ?? (success || danger ? theme.textLight : theme.icon)}
fill={isHovered ? iconHoverFill : iconFill ?? (success || danger ? theme.textLight : theme.icon)}
small={small}
medium={medium}
large={large}
Expand Down Expand Up @@ -358,6 +371,7 @@ function Button(
shouldUseDefaultHover && !isDisabled ? styles.buttonDefaultHovered : undefined,
success && !isDisabled ? styles.buttonSuccessHovered : undefined,
danger && !isDisabled ? styles.buttonDangerHovered : undefined,
hoverStyles,
]}
id={id}
accessibilityLabel={accessibilityLabel}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Illustrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import CreditCardsNew from '@assets/images/simple-illustrations/simple-illustrat
import CreditCardEyes from '@assets/images/simple-illustrations/simple-illustration__creditcardeyes.svg';
import EmailAddress from '@assets/images/simple-illustrations/simple-illustration__email-address.svg';
import EmptyState from '@assets/images/simple-illustrations/simple-illustration__empty-state.svg';
import EnvelopeReceipt from '@assets/images/simple-illustrations/simple-illustration__envelopereceipt.svg';
import Filters from '@assets/images/simple-illustrations/simple-illustration__filters.svg';
import FolderOpen from '@assets/images/simple-illustrations/simple-illustration__folder-open.svg';
import Gears from '@assets/images/simple-illustrations/simple-illustration__gears.svg';
Expand Down Expand Up @@ -121,6 +122,7 @@ export {
EmailAddress,
EmptyCardState,
EmptyStateExpenses,
EnvelopeReceipt,
FolderOpen,
HandCard,
HotDogStand,
Expand Down
30 changes: 20 additions & 10 deletions src/components/Search/SearchPageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type {SearchReport} from '@src/types/onyx/SearchResults';
import type {SearchDataTypes, SearchReport} from '@src/types/onyx/SearchResults';
import type DeepValueOf from '@src/types/utils/DeepValueOf';
import type IconAsset from '@src/types/utils/IconAsset';
import {useSearchContext} from './SearchContext';
import type {SearchQueryJSON, SearchStatus} from './types';
import type {SearchQueryJSON} from './types';

type HeaderWrapperProps = Pick<HeaderWithBackButtonProps, 'title' | 'subtitle' | 'icon' | 'children'> & {
subtitleStyles?: StyleProp<TextStyle>;
Expand Down Expand Up @@ -100,13 +100,23 @@ type SearchPageHeaderProps = {

type SearchHeaderOptionValue = DeepValueOf<typeof CONST.SEARCH.BULK_ACTION_TYPES> | undefined;

const headerContent: {[key in SearchStatus]: {icon: IconAsset; titleText: TranslationPaths}} = {
all: {icon: Illustrations.MoneyReceipts, titleText: 'common.expenses'},
shared: {icon: Illustrations.SendMoney, titleText: 'common.shared'},
drafts: {icon: Illustrations.Pencil, titleText: 'common.drafts'},
finished: {icon: Illustrations.CheckmarkCircle, titleText: 'common.finished'},
type HeaderContent = {
icon: IconAsset;
titleText: TranslationPaths;
};

function getHeaderContent(type: SearchDataTypes): HeaderContent {
switch (type) {
case CONST.SEARCH.DATA_TYPES.INVOICE:
return {icon: Illustrations.EnvelopeReceipt, titleText: 'workspace.common.invoices'};
case CONST.SEARCH.DATA_TYPES.TRIP:
return {icon: Illustrations.Luggage, titleText: 'travel.trips'};
case CONST.SEARCH.DATA_TYPES.EXPENSE:
default:
return {icon: Illustrations.MoneyReceipts, titleText: 'common.expenses'};
}
}

function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModalOpen, setDownloadErrorModalOpen, isCustomQuery, data}: SearchPageHeaderProps) {
const {translate} = useLocalize();
const theme = useTheme();
Expand All @@ -131,10 +141,10 @@ function SearchPageHeader({queryJSON, hash, onSelectDeleteOption, setOfflineModa
.map((item) => item.reportID),
[data, selectedTransactions],
);
const {status} = queryJSON;
const headerSubtitle = isCustomQuery ? SearchUtils.getSearchHeaderTitle(queryJSON) : translate(headerContent[status]?.titleText);
const {status, type} = queryJSON;
const headerSubtitle = isCustomQuery ? SearchUtils.getSearchHeaderTitle(queryJSON) : translate(getHeaderContent(type).titleText);
const headerTitle = isCustomQuery ? translate('search.filtersHeader') : '';
const headerIcon = isCustomQuery ? Illustrations.Filters : headerContent[status]?.icon;
const headerIcon = isCustomQuery ? Illustrations.Filters : getHeaderContent(type).icon;

const subtitleStyles = isCustomQuery ? {} : styles.textHeadlineH2;

Expand Down
Loading
Loading