Skip to content

Commit a9ea65c

Browse files
committed
feat: search notifications
Signed-off-by: Adam Setch <[email protected]>
1 parent 3d507f5 commit a9ea65c

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

src/renderer/components/filters/SearchFilterSuggestions.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import { useContext, type FC } from 'react';
1+
import { type FC, useContext } from 'react';
22

33
import { Box, Popover, Stack, Text } from '@primer/react';
44

5+
import { AppContext } from '../../context/App';
56
import { Opacity } from '../../types';
67
import { cn } from '../../utils/cn';
78
import {
89
ALL_SEARCH_QUALIFIERS,
910
BASE_SEARCH_QUALIFIERS,
1011
SEARCH_DELIMITER,
1112
} from '../../utils/notifications/filters/search';
12-
import { AppContext } from '../../context/App';
1313

1414
interface SearchFilterSuggestionsProps {
1515
open: boolean;
@@ -22,7 +22,6 @@ export const SearchFilterSuggestions: FC<SearchFilterSuggestionsProps> = ({
2222
inputValue,
2323
onClose,
2424
}) => {
25-
2625
const { settings } = useContext(AppContext);
2726

2827
if (!open) {

src/renderer/components/filters/TokenSearchInput.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
101101
}}
102102
onKeyDown={onKeyDown}
103103
onTokenRemove={(id) => {
104-
const token = tokenItems.find((t) => t.id === id)?.text as
105-
| SearchToken
106-
| undefined;
104+
const token = tokenItems.find((t) => t.id === id)?.text;
107105

108106
if (token) {
109107
onRemove(token);

src/renderer/utils/notifications/filters/search.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@ const SEARCH_QUALIFIERS = {
88
prefix: 'author:',
99
description: 'filter by notification author',
1010
requiresDetailsNotifications: true,
11-
extract: (n: Notification) => n.subject?.user?.login as string | undefined,
11+
extract: (n: Notification) => n.subject?.user?.login,
1212
},
1313
org: {
1414
prefix: 'org:',
1515
description: 'filter by organization owner',
1616
requiresDetailsNotifications: false,
17-
extract: (n: Notification) =>
18-
n.repository?.owner?.login as string | undefined,
17+
extract: (n: Notification) => n.repository?.owner?.login,
1918
},
2019
repo: {
2120
prefix: 'repo:',
2221
description: 'filter by repository full name',
2322
requiresDetailsNotifications: false,
24-
extract: (n: Notification) => n.repository?.full_name as string | undefined,
23+
extract: (n: Notification) => n.repository?.full_name,
2524
},
2625
} as const;
2726

0 commit comments

Comments
 (0)