mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-28 18:40:34 -05:00
Merge branch 'master' into scrollToLocationBudget
This commit is contained in:
39
.github/workflows/trafico.yml
vendored
Normal file
39
.github/workflows/trafico.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
##########################################################################################
|
||||
# WARNING! This workflow uses the 'pull_request_target' event. That mans that it will #
|
||||
# always run in the context of the main actualbudget/actual repo, even if the PR is from #
|
||||
# a fork. This is necessary to get access to a GitHub token that can modify the PR. #
|
||||
# Be VERY CAREFUL about adding things to this workflow, since forks can inject #
|
||||
# arbitrary code into their branch, and can pollute the artifacts we download. Arbitrary #
|
||||
# code execution in this workflow could lead to a compromise of the main repo. #
|
||||
##########################################################################################
|
||||
# See: https://securitylab.github.com/research/github-actions-preventing-pwn-requests #
|
||||
##########################################################################################
|
||||
|
||||
name: Trafico Reviews
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
- closed
|
||||
- reopened
|
||||
- synchronize
|
||||
- edited
|
||||
- review_requested
|
||||
- review_request_removed
|
||||
pull_request_review:
|
||||
types: [submitted, edited, dismissed]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
manage-review:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actualbudget/trafico@main
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -7,6 +7,7 @@ import React, {
|
||||
type ComponentType,
|
||||
type ComponentPropsWithoutRef,
|
||||
type ReactElement,
|
||||
useCallback,
|
||||
} from 'react';
|
||||
|
||||
import { css } from 'glamor';
|
||||
@@ -135,6 +136,21 @@ function CategoryList({
|
||||
);
|
||||
}
|
||||
|
||||
function customSort(obj: CategoryAutocompleteItem, value: string): number {
|
||||
const name = obj.name.toLowerCase();
|
||||
const groupName = obj.group ? obj.group.name.toLowerCase() : '';
|
||||
if (obj.id === 'split') {
|
||||
return -2;
|
||||
}
|
||||
if (name.includes(value)) {
|
||||
return -1;
|
||||
}
|
||||
if (groupName.includes(value)) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
type CategoryAutocompleteProps = ComponentProps<
|
||||
typeof Autocomplete<CategoryAutocompleteItem>
|
||||
> & {
|
||||
@@ -183,6 +199,33 @@ export function CategoryAutocomplete({
|
||||
[defaultCategoryGroups, categoryGroups, showSplitOption],
|
||||
);
|
||||
|
||||
const filterSuggestions = useCallback(
|
||||
(
|
||||
suggestions: CategoryAutocompleteItem[],
|
||||
value: string,
|
||||
): CategoryAutocompleteItem[] => {
|
||||
return suggestions
|
||||
.filter(suggestion => {
|
||||
return (
|
||||
suggestion.id === 'split' ||
|
||||
suggestion.group?.name
|
||||
.toLowerCase()
|
||||
.includes(value.toLowerCase()) ||
|
||||
(suggestion.group?.name + ' ' + suggestion.name)
|
||||
.toLowerCase()
|
||||
.includes(value.toLowerCase()) ||
|
||||
defaultFilterSuggestion(suggestion, value)
|
||||
);
|
||||
})
|
||||
.sort(
|
||||
(a, b) =>
|
||||
customSort(a, value.toLowerCase()) -
|
||||
customSort(b, value.toLowerCase()),
|
||||
);
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
return (
|
||||
<Autocomplete
|
||||
strict={true}
|
||||
@@ -197,14 +240,7 @@ export function CategoryAutocomplete({
|
||||
}
|
||||
return 0;
|
||||
}}
|
||||
filterSuggestions={(suggestions, value) => {
|
||||
return suggestions.filter(suggestion => {
|
||||
return (
|
||||
suggestion.id === 'split' ||
|
||||
defaultFilterSuggestion(suggestion, value)
|
||||
);
|
||||
});
|
||||
}}
|
||||
filterSuggestions={filterSuggestions}
|
||||
suggestions={categorySuggestions}
|
||||
renderItems={(items, getItemProps, highlightedIndex) => (
|
||||
<CategoryList
|
||||
|
||||
@@ -468,7 +468,7 @@ describe('Transactions', () => {
|
||||
items = screen
|
||||
.getByTestId('autocomplete')
|
||||
.querySelectorAll('[data-testid$="category-item"]');
|
||||
expect(items.length).toBe(0);
|
||||
expect(items.length).toBe(3);
|
||||
});
|
||||
|
||||
test('dropdown selects an item with keyboard', async () => {
|
||||
|
||||
6
upcoming-release-notes/2861.md
Normal file
6
upcoming-release-notes/2861.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Enhancements
|
||||
authors: [Crazypkr]
|
||||
---
|
||||
|
||||
Add autocomplete to include categories underneath the prioritized subcategory
|
||||
6
upcoming-release-notes/2895.md
Normal file
6
upcoming-release-notes/2895.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Maintenance
|
||||
authors: [twk3]
|
||||
---
|
||||
|
||||
Switch to using a Trafico GitHub action to restore review management.
|
||||
Reference in New Issue
Block a user