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

✨ polishing report responsitivity #3636

Merged
merged 4 commits into from
Oct 12, 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions packages/desktop-client/src/components/common/SpaceBetween.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React, { type ReactNode } from 'react';

import { type CSSProperties } from '../../style';

import { View } from './View';

type SpaceBetweenProps = {
direction?: 'horizontal' | 'vertical';
gap?: number;
style?: CSSProperties;
children: ReactNode;
};

export const SpaceBetween = ({
direction = 'horizontal',
gap = 15,
style,
children,
}: SpaceBetweenProps) => {
return (
<View
style={{
flexWrap: 'wrap',
flexDirection: direction === 'horizontal' ? 'row' : 'column',
alignItems: 'center',
gap,
...style,
}}
>
{children}
</View>
);
};
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/common/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const Tooltip = ({

return (
<View
style={{ minHeight: 'auto' }}
style={{ minHeight: 'auto', flexShrink: 0 }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-10-11 at 19 47 09

fix for the tiny icons

ref={triggerRef}
onMouseEnter={handlePointerEnter}
onMouseLeave={handlePointerLeave}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import { Button } from '../common/Button2';

export function CompactFiltersButton({ onPress }: { onPress: () => void }) {
return (
<Button variant="bare" onPress={onPress}>
<SvgFilter width={15} height={15} />
<Button variant="bare" onPress={onPress} style={{ minWidth: 20 }}>
<SvgFilter
width={15}
height={15}
style={{ width: 15, height: 15, flexShrink: 0 }}
/>
</Button>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,21 @@ export function FilterExpression<T extends RuleConditionEntity>({
variant="bare"
isDisabled={customName != null}
onPress={() => setEditing(true)}
style={{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-10-11 at 19 49 20

fix for filters expanding out-of-bounds

maxWidth: 'calc(100% - 26px)',
whiteSpace: 'nowrap',
display: 'block',
}}
>
<div style={{ paddingBlock: 1, paddingLeft: 5, paddingRight: 2 }}>
<div
style={{
paddingBlock: 1,
paddingLeft: 5,
paddingRight: 2,
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{customName ? (
<Text style={{ color: theme.pageTextPositive }}>{customName}</Text>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { Button } from '../common/Button2';
export function FiltersButton({ onPress }: { onPress: () => void }) {
return (
<Button variant="bare" onPress={onPress}>
<SvgFilter style={{ width: 12, height: 12, marginRight: 5 }} /> Filter
<SvgFilter
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the the icon in "Filters" button becoming small when resizing browser

style={{ width: 12, height: 12, marginRight: 5, flexShrink: 0 }}
/>{' '}
Filter
</Button>
);
}
124 changes: 56 additions & 68 deletions packages/desktop-client/src/components/reports/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useFeatureFlag } from '../../hooks/useFeatureFlag';
import { useResponsive } from '../../ResponsiveProvider';
import { Button } from '../common/Button2';
import { Select } from '../common/Select';
import { SpaceBetween } from '../common/SpaceBetween';
import { View } from '../common/View';
import { AppliedFilters } from '../filters/AppliedFilters';
import { FilterButton } from '../filters/FiltersMenu';
Expand Down Expand Up @@ -66,82 +67,69 @@ export function Header({
<View
style={{
padding: 20,
paddingTop: 0,
paddingTop: 15,
flexShrink: 0,
}}
>
<View
<SpaceBetween
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Various small re-alignments in cashflow & networth pages on small devices (i.e. mobile). To make the filters look slightly better on small resolutions.

direction={isNarrowWidth ? 'vertical' : 'horizontal'}
style={{
flexDirection: isNarrowWidth ? 'column' : 'row',
alignItems: isNarrowWidth ? 'flex-start' : 'center',
marginTop: 15,
gap: 15,
}}
>
{isDashboardsFeatureEnabled && mode && (
<Button
variant={mode === 'static' ? 'normal' : 'primary'}
onPress={() => {
const newMode = mode === 'static' ? 'sliding-window' : 'static';
const [newStart, newEnd] = calculateTimeRange({
start,
end,
mode: newMode,
});
<SpaceBetween gap={isNarrowWidth ? 5 : undefined}>
{isDashboardsFeatureEnabled && mode && (
<Button
variant={mode === 'static' ? 'normal' : 'primary'}
onPress={() => {
const newMode = mode === 'static' ? 'sliding-window' : 'static';
const [newStart, newEnd] = calculateTimeRange({
start,
end,
mode: newMode,
});

onChangeDates(newStart, newEnd, newMode);
}}
>
{mode === 'static' ? 'Static' : 'Live'}
</Button>
)}
onChangeDates(newStart, newEnd, newMode);
}}
>
{mode === 'static' ? 'Static' : 'Live'}
</Button>
)}

<View
style={{
flexDirection: 'row',
alignItems: 'center',
gap: 5,
}}
>
<Select
onChange={newValue =>
onChangeDates(
...validateStart(
allMonths[allMonths.length - 1].name,
newValue,
end,
),
)
}
value={start}
defaultLabel={monthUtils.format(start, 'MMMM, yyyy')}
options={allMonths.map(({ name, pretty }) => [name, pretty])}
/>
<View>to</View>
<Select
onChange={newValue =>
onChangeDates(
...validateEnd(
allMonths[allMonths.length - 1].name,
start,
newValue,
),
)
}
value={end}
options={allMonths.map(({ name, pretty }) => [name, pretty])}
style={{ marginRight: 10 }}
/>
</View>
<SpaceBetween gap={5}>
<Select
onChange={newValue =>
onChangeDates(
...validateStart(
allMonths[allMonths.length - 1].name,
newValue,
end,
),
)
}
value={start}
defaultLabel={monthUtils.format(start, 'MMMM, yyyy')}
options={allMonths.map(({ name, pretty }) => [name, pretty])}
/>
<View>to</View>
<Select
onChange={newValue =>
onChangeDates(
...validateEnd(
allMonths[allMonths.length - 1].name,
start,
newValue,
),
)
}
value={end}
options={allMonths.map(({ name, pretty }) => [name, pretty])}
style={{ marginRight: 10 }}
/>
</SpaceBetween>
</SpaceBetween>

<View
style={{
flexDirection: 'row',
alignItems: 'center',
gap: 15,
flexWrap: 'wrap',
}}
>
<SpaceBetween>
{show1Month && (
<Button
variant="bare"
Expand Down Expand Up @@ -187,7 +175,7 @@ export function Header({
exclude={undefined}
/>
)}
</View>
</SpaceBetween>

{children ? (
<View
Expand All @@ -202,7 +190,7 @@ export function Header({
) : (
<View style={{ flex: 1 }} />
)}
</View>
</SpaceBetween>

{filters && filters.length > 0 && (
<View style={{ marginTop: 5 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export function ModeButton({
css({
padding: '5px 10px',
backgroundColor: theme.menuBackground,
marginRight: 5,
fontSize: 'inherit',
...style,
...(selected && {
Expand Down
19 changes: 8 additions & 11 deletions packages/desktop-client/src/components/reports/ReportSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Button } from '../common/Button2';
import { Menu } from '../common/Menu';
import { Popover } from '../common/Popover';
import { Select, type SelectOption } from '../common/Select';
import { SpaceBetween } from '../common/SpaceBetween';
import { Text } from '../common/Text';
import { Tooltip } from '../common/Tooltip';
import { View } from '../common/View';
Expand Down Expand Up @@ -177,16 +178,13 @@ export function ReportSidebar({
<strong>Display</strong>
</Text>
</View>
<View
<SpaceBetween
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No user-facing update here. Just a small code improvement.

gap={5}
style={{
flexDirection: 'row',
padding: 5,
alignItems: 'center',
}}
>
<Text style={{ width: 50, textAlign: 'right', marginRight: 5 }}>
Mode:
</Text>
<Text style={{ width: 50, textAlign: 'right' }}>Mode:</Text>
<ModeButton
selected={customReportItems.mode === 'total'}
onSelect={() => onChangeMode('total')}
Expand All @@ -199,7 +197,7 @@ export function ReportSidebar({
>
Time
</ModeButton>
</View>
</SpaceBetween>
<View
style={{
flexDirection: 'row',
Expand Down Expand Up @@ -394,12 +392,11 @@ export function ReportSidebar({
flexShrink: 0,
}}
/>
<View
<SpaceBetween
gap={5}
style={{
flexDirection: 'row',
marginTop: 10,
marginBottom: 5,
alignItems: 'center',
}}
>
<Text>
Expand Down Expand Up @@ -430,7 +427,7 @@ export function ReportSidebar({
>
Static
</ModeButton>
</View>
</SpaceBetween>
{!customReportItems.isDateStatic ? (
<View
style={{
Expand Down
Loading