Skip to content

A local-first personal finance app

:bug: (darkmode) fix transaction list hover effects (#1531)

Matiss Janis Aboltins0228072c6ff5
diff --git a/packages/desktop-client/src/components/budget/misc.js b/packages/desktop-client/src/components/budget/misc.js
index 376ac186fd..aa625f2421 100644
--- a/packages/desktop-client/src/components/budget/misc.js
+++ b/packages/desktop-client/src/components/budget/misc.js
@@ -783,10 +783,10 @@ function ExpenseGroup({
return (
<Row
collapsed={true}
- backgroundColor={colors.n11}
style={{
fontWeight: 600,
opacity: group.hidden ? 0.33 : undefined,
+ backgroundColor: colors.n11,
}}
>
{dragState && !dragState.preview && dragState.type === 'group' && (
@@ -937,8 +937,7 @@ function IncomeGroup({
return (
<Row
collapsed={true}
- backgroundColor={colors.n11}
- style={{ fontWeight: 600 }}
+ style={{ fontWeight: 600, backgroundColor: colors.n11 }}
>
<SidebarGroup
group={group}
@@ -986,7 +985,7 @@ function IncomeCategory({
});
return (
- <Row innerRef={dropRef} collapsed={true} backgroundColor="transparent">
+ <Row innerRef={dropRef} collapsed={true}>
<DropHighlight pos={dropPos} offset={{ top: 1 }} />
<SidebarCategory
diff --git a/packages/desktop-client/src/components/budget/report/components.tsx b/packages/desktop-client/src/components/budget/report/components.tsx
index 0f6523c525..3c66b7802c 100644
--- a/packages/desktop-client/src/components/budget/report/components.tsx
+++ b/packages/desktop-client/src/components/budget/report/components.tsx
@@ -89,7 +89,6 @@ type GroupMonthProps = {
group: { id: string; is_income: boolean };
};
export const GroupMonth = memo(function GroupMonth({ group }: GroupMonthProps) {
- let borderColor = colors.border;
let { id } = group;
return (
@@ -97,7 +96,6 @@ export const GroupMonth = memo(function GroupMonth({ group }: GroupMonthProps) {
<SheetCell
name="budgeted"
width="flex"
- borderColor={borderColor}
textAlign="right"
style={[{ fontWeight: 600 }, styles.tnum]}
valueProps={{
@@ -109,7 +107,6 @@ export const GroupMonth = memo(function GroupMonth({ group }: GroupMonthProps) {
name="spent"
width="flex"
textAlign="right"
- borderColor={borderColor}
style={[{ fontWeight: 600 }, styles.tnum]}
valueProps={{
binding: reportBudget.groupSumAmount(id),
@@ -120,7 +117,6 @@ export const GroupMonth = memo(function GroupMonth({ group }: GroupMonthProps) {
<SheetCell
name="balance"
width="flex"
- borderColor={borderColor}
textAlign="right"
style={[
{ fontWeight: 600, paddingRight: MONTH_RIGHT_PADDING },
@@ -199,7 +195,6 @@ export const CategoryMonth = memo(function CategoryMonth({
onBudgetAction,
onShowActivity,
}: CategoryMonthProps) {
- let borderColor = colors.border;
let balanceTooltip = useTooltip();
const [menuOpen, setMenuOpen] = useState(false);
const [hover, setHover] = useState(false);
@@ -223,10 +218,6 @@ export const CategoryMonth = memo(function CategoryMonth({
style={{
flex: 1,
flexDirection: 'row',
- borderTopWidth: 1,
- borderBottomWidth: 1,
- borderColor,
- backgroundColor: 'white',
}}
onMouseOverCapture={() => setHover(true)}
onMouseLeave={() => {
@@ -303,7 +294,6 @@ export const CategoryMonth = memo(function CategoryMonth({
exposed={editing}
focused={editing}
width="flex"
- borderColor="white"
onExpose={() => onEdit(category.id, monthIndex)}
style={[editing && { zIndex: 100 }, styles.tnum]}
textAlign="right"
@@ -336,6 +326,9 @@ export const CategoryMonth = memo(function CategoryMonth({
onBlur: () => {
onEdit(null);
},
+ style: {
+ backgroundColor: 'white',
+ },
}}
onSave={amount => {
onBudgetAction(monthIndex, 'budget-amount', {
@@ -345,12 +338,7 @@ export const CategoryMonth = memo(function CategoryMonth({
}}
/>
</View>
- <Field
- name="spent"
- width="flex"
- borderColor={borderColor}
- style={{ textAlign: 'right' }}
- >
+ <Field name="spent" width="flex" style={{ textAlign: 'right' }}>
<span
data-testid="category-month-spent"
onClick={() => onShowActivity(category.name, category.id, monthIndex)}
@@ -373,7 +361,6 @@ export const CategoryMonth = memo(function CategoryMonth({
<Field
name="balance"
width="flex"
- borderColor={borderColor}
style={{ paddingRight: MONTH_RIGHT_PADDING, textAlign: 'right' }}
>
<span {...(category.is_income ? {} : balanceTooltip.getOpenEvents())}>
diff --git a/packages/desktop-client/src/components/budget/rollover/rollover-components.tsx b/packages/desktop-client/src/components/budget/rollover/rollover-components.tsx
index 9ce5023720..e079554261 100644
--- a/packages/desktop-client/src/components/budget/rollover/rollover-components.tsx
+++ b/packages/desktop-client/src/components/budget/rollover/rollover-components.tsx
@@ -251,7 +251,6 @@ type ExpenseGroupMonthProps = {
export const ExpenseGroupMonth = memo(function ExpenseGroupMonth({
group,
}: ExpenseGroupMonthProps) {
- let borderColor = colors.border;
let { id } = group;
return (
@@ -259,7 +258,6 @@ export const ExpenseGroupMonth = memo(function ExpenseGroupMonth({
<SheetCell
name="budgeted"
width="flex"
- borderColor={borderColor}
textAlign="right"
style={[{ fontWeight: 600 }, styles.tnum]}
valueProps={{
@@ -271,7 +269,6 @@ export const ExpenseGroupMonth = memo(function ExpenseGroupMonth({
name="spent"
width="flex"
textAlign="right"
- borderColor={borderColor}
style={[{ fontWeight: 600 }, styles.tnum]}
valueProps={{
binding: rolloverBudget.groupSumAmount(id),
@@ -281,7 +278,6 @@ export const ExpenseGroupMonth = memo(function ExpenseGroupMonth({
<SheetCell
name="balance"
width="flex"
- borderColor={borderColor}
textAlign="right"
style={[
{ fontWeight: 600, paddingRight: MONTH_RIGHT_PADDING },
@@ -317,7 +313,6 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
onBudgetAction,
onShowActivity,
}: ExpenseCategoryMonthProps) {
- let borderColor = colors.border;
let balanceTooltip = useTooltip();
const [menuOpen, setMenuOpen] = useState(false);
const [hover, setHover] = useState(false);
@@ -341,10 +336,6 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
style={{
flex: 1,
flexDirection: 'row',
- borderTopWidth: 1,
- borderBottomWidth: 1,
- borderColor,
- backgroundColor: 'white',
}}
onMouseOverCapture={() => setHover(true)}
onMouseLeave={() => {
@@ -421,7 +412,6 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
exposed={editing}
focused={editing}
width="flex"
- borderColor="white"
onExpose={() => onEdit(category.id, monthIndex)}
style={[editing && { zIndex: 100 }, styles.tnum]}
textAlign="right"
@@ -454,6 +444,9 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
onBlur: () => {
onEdit(null);
},
+ style: {
+ backgroundColor: 'white',
+ },
}}
onSave={amount => {
onBudgetAction(monthIndex, 'budget-amount', {
@@ -463,12 +456,7 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
}}
/>
</View>
- <Field
- name="spent"
- width="flex"
- borderColor={borderColor}
- style={{ textAlign: 'right' }}
- >
+ <Field name="spent" width="flex" style={{ textAlign: 'right' }}>
<span
data-testid="category-month-spent"
onClick={() => onShowActivity(category.name, category.id, monthIndex)}
@@ -487,7 +475,6 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
<Field
name="balance"
width="flex"
- borderColor={borderColor}
style={{ paddingRight: MONTH_RIGHT_PADDING, textAlign: 'right' }}
>
<span {...balanceTooltip.getOpenEvents()}>
@@ -515,7 +502,6 @@ export function IncomeGroupMonth() {
<SheetCell
name="received"
width="flex"
- borderColor={colors.border}
textAlign="right"
style={[
{ fontWeight: 600, paddingRight: MONTH_RIGHT_PADDING },
@@ -552,7 +538,6 @@ export function IncomeCategoryMonth({
<Field
name="received"
width="flex"
- borderColor={colors.border}
style={[
{ paddingRight: MONTH_RIGHT_PADDING, textAlign: 'right' },
isLast && { borderBottomWidth: 0 },
diff --git a/packages/desktop-client/src/components/payees/index.js b/packages/desktop-client/src/components/payees/index.js
index ba8e1ec5ff..e790a809c5 100644
--- a/packages/desktop-client/src/components/payees/index.js
+++ b/packages/desktop-client/src/components/payees/index.js
@@ -90,9 +90,7 @@ let Payee = memo(
style,
payee,
ruleCount,
- categoryGroups,
selected,
- highlighted,
hovered,
editing,
focusedField,
@@ -101,7 +99,6 @@ let Payee = memo(
onHover,
onEdit,
onUpdate,
- ruleActions,
}) => {
let { id } = payee;
let dispatchSelected = useSelectedDispatch();
@@ -110,16 +107,18 @@ let Payee = memo(
return (
<Row
- borderColor={borderColor}
- backgroundColor={
- selected ? colors.b9 : backgroundFocus ? colors.hover : 'white'
- }
- highlighted={highlighted}
style={[
{ alignItems: 'stretch' },
style,
{
- backgroundColor: hovered ? colors.hover : null,
+ borderColor,
+ backgroundColor: hovered
+ ? colors.hover
+ : selected
+ ? colors.b9
+ : backgroundFocus
+ ? colors.hover
+ : 'white',
},
selected && {
backgroundColor: colors.b9,
@@ -230,8 +229,8 @@ function PayeeTableHeader() {
return (
<View>
<TableHeader
- borderColor={borderColor}
style={{
+ borderColor,
backgroundColor: 'white',
color: colors.n4,
zIndex: 200,
diff --git a/packages/desktop-client/src/components/schedules/DiscoverSchedules.js b/packages/desktop-client/src/components/schedules/DiscoverSchedules.js
index aab542ceae..56ffebe9aa 100644
--- a/packages/desktop-client/src/components/schedules/DiscoverSchedules.js
+++ b/packages/desktop-client/src/components/schedules/DiscoverSchedules.js
@@ -36,13 +36,12 @@ function DiscoverSchedulesTable({ schedules, loading }) {
<Row
height={ROW_HEIGHT}
inset={15}
- backgroundColor="transparent"
onClick={e => {
dispatchSelected({ type: 'select', id: item.id, event: e });
}}
- borderColor={selected ? colors.b8 : colors.border}
style={{
cursor: 'pointer',
+ borderColor: selected ? colors.b8 : colors.border,
backgroundColor: selected ? colors.selected : 'white',
':hover': {
backgroundColor: selected ? colors.selected : colors.hover,
diff --git a/packages/desktop-client/src/components/schedules/SchedulesTable.js b/packages/desktop-client/src/components/schedules/SchedulesTable.js
index 2a154d25df..29e736f836 100644
--- a/packages/desktop-client/src/components/schedules/SchedulesTable.js
+++ b/packages/desktop-client/src/components/schedules/SchedulesTable.js
@@ -249,7 +249,6 @@ export function SchedulesTable({
<Row
height={ROW_HEIGHT}
inset={15}
- backgroundColor="transparent"
style={{
cursor: 'pointer',
backgroundColor: 'white',
diff --git a/packages/desktop-client/src/components/table.tsx b/packages/desktop-client/src/components/table.tsx
index 13dc2cae4a..55f83f0b4f 100644
--- a/packages/desktop-client/src/components/table.tsx
+++ b/packages/desktop-client/src/components/table.tsx
@@ -1,5 +1,4 @@
import React, {
- createContext,
forwardRef,
useState,
useCallback,
@@ -7,7 +6,6 @@ import React, {
useEffect,
useLayoutEffect,
useImperativeHandle,
- useContext,
useMemo,
type ComponentProps,
type ReactNode,
@@ -61,36 +59,9 @@ function fireBlur(onBlur, e) {
}
}
-const CellContext = createContext({
- backgroundColor: theme.tableBackground,
- borderColor: theme.tableBorder,
-});
-
-type CellProviderProps = {
- backgroundColor: string;
- borderColor: string;
- children: ReactNode;
-};
-function CellProvider({
- backgroundColor,
- borderColor,
- children,
-}: CellProviderProps) {
- let value = useMemo(
- () => ({
- backgroundColor,
- borderColor,
- }),
- [backgroundColor, borderColor],
- );
-
- return <CellContext.Provider value={value}>{children}</CellContext.Provider>;
-}
-
type FieldProps = ComponentProps<typeof View> & {
width: number | 'flex';
name?: string;
- borderColor?: string;
truncate?: boolean;
contentStyle?: CSSProperties;
};
@@ -98,7 +69,6 @@ export const Field = forwardRef<HTMLDivElement, FieldProps>(function Field(
{ width, name, truncate = true, children, style, contentStyle, ...props },
ref,
) {
- let { backgroundColor, borderColor } = useContext(CellContext);
return (
<View
innerRef={ref}
@@ -106,11 +76,9 @@ export const Field = forwardRef<HTMLDivElement, FieldProps>(function Field(
style={[
width === 'flex' ? { flex: 1, flexBasis: 0 } : { width },
{
- position: 'relative',
- borderTopWidth: borderColor ? 1 : 0,
- borderBottomWidth: borderColor ? 1 : 0,
- borderColor,
- backgroundColor,
+ borderTopWidth: 1,
+ borderBottomWidth: 1,
+ borderColor: theme.tableBorder,
},
styles.smallText,
style,
@@ -171,7 +139,6 @@ type CellProps = Omit<ComponentProps<typeof View>, 'children' | 'value'> & {
focused?: boolean;
textAlign?: string;
alignItems?: string;
- borderColor?: string;
plain?: boolean;
exposed?: boolean;
children?: ReactNode | (() => ReactNode);
@@ -191,7 +158,6 @@ export function Cell({
textAlign,
alignItems,
onExpose,
- borderColor: oldBorderColor,
children,
plain,
style,
@@ -203,27 +169,16 @@ export function Cell({
let mouseCoords = useRef(null);
let viewRef = useRef(null);
- let { backgroundColor, borderColor } = useContext(CellContext);
-
useProperFocus(viewRef, focused !== undefined ? focused : exposed);
- // TODO: Get rid of this. Go through and remove all the places where
- // the border color is manually passed in.
- if (oldBorderColor) {
- borderColor = oldBorderColor;
- } else {
- borderColor = theme.tableBorder;
- }
-
const widthStyle = width === 'flex' ? { flex: 1, flexBasis: 0 } : { width };
const cellStyle = {
position: 'relative',
textAlign: textAlign || 'left',
justifyContent: 'center',
- borderTopWidth: borderColor ? 1 : 0,
- borderBottomWidth: borderColor ? 1 : 0,
- borderColor,
- backgroundColor,
+ borderTopWidth: 1,
+ borderBottomWidth: 1,
+ borderColor: theme.tableBorder,
alignItems: alignItems,
};
@@ -305,7 +260,6 @@ export function Cell({
<View
innerRef={viewRef}
style={[widthStyle, cellStyle, style]}
- className="animated-cell"
{...viewProps}
data-testid={name}
>
@@ -315,82 +269,36 @@ export function Cell({
}
type RowProps = ComponentProps<typeof View> & {
- backgroundColor?: string;
- borderColor?: string;
inset?: number;
collapsed?: boolean;
- focused?: boolean;
- highlighted?: boolean;
};
export function Row({
- backgroundColor = theme.tableBackground,
- borderColor = theme.tableBorder,
inset = 0,
collapsed,
- focused,
- highlighted,
children,
height,
style,
...nativeProps
}: RowProps) {
- let [shouldHighlight, setShouldHighlight] = useState(false);
- let prevHighlighted = useRef(false);
- let rowRef = useRef(null);
- let timer = useRef(null);
-
- useEffect(() => {
- if (highlighted && !prevHighlighted.current && rowRef.current) {
- rowRef.current.classList.add('animated');
- setShouldHighlight(true);
-
- clearTimeout(timer.current);
- timer.current = setTimeout(() => {
- setShouldHighlight(false);
-
- timer.current = setTimeout(() => {
- if (rowRef.current) {
- rowRef.current.classList.remove('animated');
- }
- }, 500);
- }, 500);
- }
- }, [highlighted]);
-
- useEffect(() => {
- prevHighlighted.current = highlighted;
- });
-
return (
- <CellProvider
- backgroundColor={
- shouldHighlight ? theme.tableRowBackgroundHighlight : backgroundColor
- }
- borderColor={shouldHighlight ? theme.tableBorderSelected : borderColor}
+ <View
+ style={[
+ {
+ flexDirection: 'row',
+ height: height || ROW_HEIGHT,
+ flex: '0 0 ' + (height || ROW_HEIGHT) + 'px',
+ userSelect: 'text',
+ },
+ collapsed && { marginTop: -1 },
+ style,
+ ]}
+ data-testid="row"
+ {...nativeProps}
>
- <View
- innerRef={rowRef}
- style={[
- {
- flexDirection: 'row',
- height: height || ROW_HEIGHT,
- flex: '0 0 ' + (height || ROW_HEIGHT) + 'px',
- userSelect: 'text',
- '&.animated .animated-cell': {
- transition: '.7s background-color',
- },
- },
- collapsed && { marginTop: -1 },
- style,
- ]}
- data-testid="row"
- {...nativeProps}
- >
- {inset !== 0 && <Field width={inset} />}
- {children}
- {inset !== 0 && <Field width={inset} />}
- </View>
- </CellProvider>
+ {inset !== 0 && <Field width={inset} />}
+ {children}
+ {inset !== 0 && <Field width={inset} />}
+ </View>
);
}
@@ -817,8 +725,8 @@ export function SheetCell({
onUpdate={value => {
onSave(unformatExpr ? unformatExpr(value) : value);
}}
- style={{ textAlign }}
{...inputProps}
+ style={{ textAlign, ...(inputProps?.style || {}) }}
/>
);
}}
@@ -968,7 +876,6 @@ type TableProps = {
listRef;
onScroll: () => void;
version?: string;
- animated?: boolean;
allowPopupsEscape?: boolean;
isSelected?: (id: TableItem['id']) => boolean;
saveScrollWidth: (parent, child) => void;
@@ -993,7 +900,6 @@ export const Table = forwardRef<TableHandleRef, TableProps>(
listRef,
onScroll,
version = 'v1',
- animated,
allowPopupsEscape,
isSelected,
saveScrollWidth,
@@ -1109,7 +1015,6 @@ export const Table = forwardRef<TableHandleRef, TableProps>(
return (
<View
key={key}
- className="animated-row"
style={[
rowStyle,
{
@@ -1188,7 +1093,6 @@ export const Table = forwardRef<TableHandleRef, TableProps>(
{
flex: 1,
outline: 'none',
- '& .animated .animated-row': { transition: '.25s transform' },
},
style,
]}
@@ -1238,7 +1142,6 @@ export const Table = forwardRef<TableHandleRef, TableProps>(
? getScrollOffset(height, initialScrollTo.current)
: 0
}
- animated={animated}
overscanCount={5}
onItemsRendered={onItemsRendered}
onScroll={onScroll}
diff --git a/packages/desktop-client/src/components/transactions/TransactionList.js b/packages/desktop-client/src/components/transactions/TransactionList.js
index c3eba6d142..ae871e3d08 100644
--- a/packages/desktop-client/src/components/transactions/TransactionList.js
+++ b/packages/desktop-client/src/components/transactions/TransactionList.js
@@ -69,7 +69,6 @@ export default function TransactionList({
showCleared,
showAccount,
headerContent,
- animated,
isAdding,
isNew,
isMatched,
@@ -178,7 +177,6 @@ export default function TransactionList({
showCleared={showCleared}
showAccount={showAccount}
showCategory={true}
- animated={animated}
currentAccountId={account && account.id}
currentCategoryId={category && category.id}
isAdding={isAdding}
diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.js b/packages/desktop-client/src/components/transactions/TransactionsTable.js
index 10214e326c..c068ab9fb1 100644
--- a/packages/desktop-client/src/components/transactions/TransactionsTable.js
+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.js
@@ -813,7 +813,6 @@ const Transaction = memo(function Transaction(props) {
return (
<Row
- highlighted={highlighted}
style={[
{
backgroundColor: selected
@@ -825,7 +824,6 @@ const Transaction = memo(function Transaction(props) {
{
':hover': {
backgroundColor: theme.tableRowBackgroundHover,
- color: theme.tableRowBackgroundHighlightText,
},
},
highlighted || selected
diff --git a/packages/desktop-client/src/style/themes/light.ts b/packages/desktop-client/src/style/themes/light.ts
index 2c635c4442..19a8662673 100644
--- a/packages/desktop-client/src/style/themes/light.ts
+++ b/packages/desktop-client/src/style/themes/light.ts
@@ -31,7 +31,7 @@ export const tableTextEditing = colorPalette.navy50;
export const tableTextEditingBackground = colorPalette.blue500;
export const tableTextInactive = colorPalette.navy200;
export const tableHeaderText = colorPalette.navy600;
-export const tableHeaderBackground = colorPalette.navy50;
+export const tableHeaderBackground = colorPalette.white;
export const tableBorder = colorPalette.navy100;
export const tableBorderSelected = colorPalette.purple500;
export const tableBorderHover = colorPalette.purple400;
diff --git a/upcoming-release-notes/1531.md b/upcoming-release-notes/1531.md
new file mode 100644
index 0000000000..2a8aa942c4
--- /dev/null
+++ b/upcoming-release-notes/1531.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [MatissJanis]
+---
+
+Fix transaction table hover effects