A local-first personal finance app
:bug: (rules) add 'no rules' message & always show rule table (#2199)
Matiss Janis Aboltins89698480a574
diff --git a/packages/desktop-client/src/components/ManageRules.tsx b/packages/desktop-client/src/components/ManageRules.tsxindex 7baac60280..6dbcea2715 100644--- a/packages/desktop-client/src/components/ManageRules.tsx+++ b/packages/desktop-client/src/components/ManageRules.tsx@@ -241,10 +241,6 @@ function ManageRulesContent({setHoveredRule(id);}, []);- if (allRules.length === 0) {- return null;- }-return (<SelectedProvider instance={selectedInst}><View>@@ -288,13 +284,17 @@ function ManageRulesContent({// Hide the last border of the item in the tablestyle={{ marginBottom: -1 }}>- <RulesList- rules={filteredRules}- selectedItems={selectedInst.items}- hoveredRule={hoveredRule}- onHover={onHover}- onEditRule={onEditRule}- />+ {filteredRules.length === 0 ? (+ <EmptyMessage text="No rules" style={{ marginTop: 15 }} />+ ) : (+ <RulesList+ rules={filteredRules}+ selectedItems={selectedInst.items}+ hoveredRule={hoveredRule}+ onHover={onHover}+ onEditRule={onEditRule}+ />+ )}</SimpleTable></View><View@@ -321,6 +321,23 @@ function ManageRulesContent({);}+function EmptyMessage({ text, style }) {+ return (+ <View+ style={{+ textAlign: 'center',+ color: theme.pageTextSubdued,+ fontStyle: 'italic',+ fontSize: 13,+ marginTop: 5,+ style,+ }}+ >+ {text}+ </View>+ );+}+type ManageRulesProps = {isModal: boolean;payeeId: string | null;diff --git a/upcoming-release-notes/2199.md b/upcoming-release-notes/2199.mdnew file mode 100644index 0000000000..7fa7eaa4f1--- /dev/null+++ b/upcoming-release-notes/2199.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [MatissJanis]+---++rules: add 'no rules' message and always show the rules table (even if no rules exist)