Skip to content

Commit

Permalink
fix: changing name with context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
UnderKoen committed Dec 17, 2024
1 parent 9a21ace commit 568cd77
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { NON_DRAGGABLE_AREA_CLASS_NAME } from './constants';

type ReportCardProps = {
isEditing?: boolean;
disableClick?: boolean;
to?: string;
children: ReactNode;
menuItems?: ComponentProps<typeof Menu>['items'];
Expand All @@ -29,6 +30,7 @@ type ReportCardProps = {

export function ReportCard({
isEditing,
disableClick,
to,
menuItems,
onMenuSelect,
Expand Down Expand Up @@ -95,7 +97,7 @@ export function ReportCard({
<Layout {...layoutProps}>
<View
role="button"
onClick={isEditing ? undefined : () => navigate(to)}
onClick={isEditing || disableClick ? undefined : () => navigate(to)}
style={{
height: '100%',
width: '100%',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export function CashFlowCard({
return (
<ReportCard
isEditing={isEditing}
disableClick={nameMenuOpen}
to={`/reports/cash-flow/${widgetId}`}
menuItems={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ function CustomReportListCardsInner({
return (
<ReportCard
isEditing={isEditing}
disableClick={nameMenuOpen}
to={`/reports/custom/${report.id}`}
menuItems={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function MarkdownCard({
return (
<ReportCard
isEditing={isEditing}
disableClick={isVisibleTextArea}
menuItems={[
{
type: Menu.label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export function NetWorthCard({
return (
<ReportCard
isEditing={isEditing}
disableClick={nameMenuOpen}
to={`/reports/net-worth/${widgetId}`}
menuItems={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export function SpendingCard({
return (
<ReportCard
isEditing={isEditing}
disableClick={nameMenuOpen}
to={`/reports/spending/${widgetId}`}
menuItems={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export function SummaryCard({
return (
<ReportCard
isEditing={isEditing}
disableClick={nameMenuOpen}
to={`/reports/summary/${widgetId}`}
menuItems={[
{
Expand Down

0 comments on commit 568cd77

Please sign in to comment.