Skip to content

Commit 5431011

Browse files
committed
Merge branch 'main' into refactor/api-request-shape-2
Signed-off-by: Adam Setch <adam.setch@outlook.com>
2 parents 9cc842d + 048be62 commit 5431011

48 files changed

Lines changed: 2065 additions & 963 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"@octokit/oauth-methods": "6.0.2",
8888
"@octokit/openapi-types": "27.0.0",
8989
"@octokit/request": "10.0.7",
90+
"@octokit/types": "16.0.0",
9091
"@parcel/watcher": "2.5.4",
9192
"@primer/css": "22.1.0",
9293
"@primer/octicons-react": "19.21.2",
@@ -115,7 +116,7 @@
115116
"electron-builder": "26.4.0",
116117
"final-form": "5.0.0",
117118
"graphql": "16.12.0",
118-
"html-webpack-plugin": "5.6.5",
119+
"html-webpack-plugin": "5.6.6",
119120
"husky": "9.1.7",
120121
"identity-obj-proxy": "3.0.0",
121122
"jest": "30.2.0",

pnpm-lock.yaml

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/__helpers__/test-utils.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { mockAuth, mockSettings } from '../__mocks__/state-mocks';
99

1010
import { AppContext, type AppContextState } from '../context/App';
1111

12+
export type DeepPartial<T> = { [K in keyof T]?: DeepPartial<T[K]> };
13+
1214
/**
1315
* Props for the AppContextProvider wrapper
1416
*/

src/renderer/components/avatars/AvatarWithFallback.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const AvatarWithFallback: React.FC<AvatarWithFallbackProps> = ({
2323
size = Size.MEDIUM,
2424
userType = 'User',
2525
}) => {
26-
const [isBroken, setIsBroken] = useState(false);
26+
const [hasBrokenAvatarSource, setHasBrokenAvatarSource] = useState(false);
2727

2828
const isNonHuman = isNonHumanUser(userType);
2929
const DefaultUserIcon = getDefaultUserIcon(userType);
@@ -36,12 +36,12 @@ export const AvatarWithFallback: React.FC<AvatarWithFallbackProps> = ({
3636
direction="horizontal"
3737
gap="condensed"
3838
>
39-
{!src || isBroken ? (
39+
{!src || hasBrokenAvatarSource ? (
4040
<DefaultUserIcon size={size} />
4141
) : (
4242
<Avatar
4343
alt={alt}
44-
onError={() => setIsBroken(true)}
44+
onError={() => setHasBrokenAvatarSource(true)}
4545
size={size}
4646
square={isNonHuman}
4747
src={src}

src/renderer/components/fields/Tooltip.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ export interface TooltipProps {
1111
}
1212

1313
export const Tooltip: FC<TooltipProps> = (props: TooltipProps) => {
14-
const [showTooltip, setShowTooltip] = useState(false);
14+
const [shouldShowTooltipContents, setShouldShowTooltipContents] =
15+
useState(false);
16+
1517
const scrollContainerRef = useRef<HTMLElement | null>(null);
1618
const overlayRef = useRef<HTMLDivElement>(null);
1719

1820
useEffect(() => {
19-
if (!showTooltip) {
21+
if (!shouldShowTooltipContents) {
2022
return;
2123
}
2224

@@ -42,7 +44,7 @@ export const Tooltip: FC<TooltipProps> = (props: TooltipProps) => {
4244
scrollContainerRef.current = findScrollContainer(tooltipButton);
4345

4446
const handleScroll = () => {
45-
setShowTooltip(false);
47+
setShouldShowTooltipContents(false);
4648
};
4749

4850
const handleClickOutside = (event: MouseEvent) => {
@@ -51,7 +53,7 @@ export const Tooltip: FC<TooltipProps> = (props: TooltipProps) => {
5153
!overlayRef.current.contains(event.target as Node) &&
5254
!tooltipButton?.contains(event.target as Node)
5355
) {
54-
setShowTooltip(false);
56+
setShouldShowTooltipContents(false);
5557
}
5658
};
5759

@@ -67,19 +69,21 @@ export const Tooltip: FC<TooltipProps> = (props: TooltipProps) => {
6769
}
6870
document.removeEventListener('mousedown', handleClickOutside);
6971
};
70-
}, [showTooltip, props.name]);
72+
}, [shouldShowTooltipContents, props.name]);
7173

7274
return (
7375
<AnchoredOverlay
7476
align="center"
75-
open={showTooltip}
77+
open={shouldShowTooltipContents}
7678
renderAnchor={(anchorProps) => (
7779
<button
7880
{...anchorProps}
7981
aria-label={props.name}
8082
data-testid={`tooltip-icon-${props.name}`}
8183
id={props.name}
82-
onClick={() => setShowTooltip(!showTooltip)}
84+
onClick={() =>
85+
setShouldShowTooltipContents(!shouldShowTooltipContents)
86+
}
8387
type="button"
8488
>
8589
<QuestionIcon className="text-gitify-tooltip-icon" />

src/renderer/components/filters/FilterSection.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ export const FilterSection = <T extends FilterSettingsValue>({
8383
key={type as string}
8484
label={typeTitle}
8585
name={typeTitle}
86-
onChange={(evt) =>
87-
updateFilter(filterSetting, type, evt.target.checked)
88-
}
86+
onChange={() => updateFilter(filterSetting, type, !isChecked)}
8987
tooltip={
9088
typeDescription ? <Text>{typeDescription}</Text> : null
9189
}

src/renderer/components/filters/TokenSearchInput.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
3232
onRemove,
3333
}) => {
3434
const [inputValue, setInputValue] = useState('');
35-
const [showSuggestions, setShowSuggestions] = useState(false);
35+
const [shouldShowFilterSuggestions, setShouldShowFilterSuggestions] =
36+
useState(false);
3637

3738
const tokenItems = tokens.map((text, id) => ({ id, text }));
3839

@@ -54,9 +55,9 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
5455
function onKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {
5556
if (INPUT_KEY_EVENTS.has(e.key)) {
5657
tryAddToken(e);
57-
setShowSuggestions(false);
58+
setShouldShowFilterSuggestions(false);
5859
} else if (e.key === 'ArrowDown') {
59-
setShowSuggestions(true);
60+
setShouldShowFilterSuggestions(true);
6061
}
6162
}
6263

@@ -78,7 +79,7 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
7879
block
7980
onBlur={(e) => {
8081
tryAddToken(e);
81-
setShowSuggestions(false);
82+
setShouldShowFilterSuggestions(false);
8283
}}
8384
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
8485
setInputValue(e.target.value);
@@ -87,17 +88,17 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
8788
!val.includes(SEARCH_DELIMITER) ||
8889
val.endsWith(SEARCH_DELIMITER)
8990
) {
90-
setShowSuggestions(true);
91+
setShouldShowFilterSuggestions(true);
9192
} else {
92-
setShowSuggestions(false);
93+
setShouldShowFilterSuggestions(false);
9394
}
9495
}}
9596
onFocus={(e) => {
9697
if (
9798
showSuggestionsOnFocusIfEmpty &&
9899
(e.target as HTMLInputElement).value.trim() === ''
99100
) {
100-
setShowSuggestions(true);
101+
setShouldShowFilterSuggestions(true);
101102
}
102103
}}
103104
onKeyDown={onKeyDown}
@@ -114,7 +115,7 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
114115
/>
115116
<SearchFilterSuggestions
116117
inputValue={inputValue}
117-
open={showSuggestions}
118+
open={shouldShowFilterSuggestions}
118119
/>
119120
</div>
120121
</Stack>

src/renderer/components/metrics/MetricGroup.test.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { mockSettings } from '../../__mocks__/state-mocks';
44

55
import type { GitifyMilestone } from '../../types';
66

7-
import { MetricGroup } from './MetricGroup';
7+
import { MetricGroup, type MetricGroupProps } from './MetricGroup';
88

99
describe('renderer/components/metrics/MetricGroup.tsx', () => {
1010
describe('showPills disabled', () => {
1111
it('should not render any pills when showPills is disabled', async () => {
1212
const mockNotification = mockGitifyNotification;
1313

14-
const props = {
14+
const props: MetricGroupProps = {
1515
notification: mockNotification,
1616
};
1717

@@ -27,7 +27,7 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
2727
const mockNotification = mockGitifyNotification;
2828
mockNotification.subject.linkedIssues = ['#1'];
2929

30-
const props = {
30+
const props: MetricGroupProps = {
3131
notification: mockNotification,
3232
};
3333

@@ -39,7 +39,7 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
3939
const mockNotification = mockGitifyNotification;
4040
mockNotification.subject.linkedIssues = ['#1', '#2'];
4141

42-
const props = {
42+
const props: MetricGroupProps = {
4343
notification: mockNotification,
4444
};
4545

@@ -53,7 +53,7 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
5353
const mockNotification = mockGitifyNotification;
5454
mockNotification.subject.commentCount = null;
5555

56-
const props = {
56+
const props: MetricGroupProps = {
5757
notification: mockNotification,
5858
};
5959

@@ -65,7 +65,7 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
6565
const mockNotification = mockGitifyNotification;
6666
mockNotification.subject.commentCount = 1;
6767

68-
const props = {
68+
const props: MetricGroupProps = {
6969
notification: mockNotification,
7070
};
7171

@@ -77,7 +77,7 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
7777
const mockNotification = mockGitifyNotification;
7878
mockNotification.subject.commentCount = 2;
7979

80-
const props = {
80+
const props: MetricGroupProps = {
8181
notification: mockNotification,
8282
};
8383

@@ -91,7 +91,7 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
9191
const mockNotification = mockGitifyNotification;
9292
mockNotification.subject.labels = ['enhancement', 'good-first-issue'];
9393

94-
const props = {
94+
const props: MetricGroupProps = {
9595
notification: mockNotification,
9696
};
9797

@@ -108,7 +108,7 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
108108
state: 'OPEN',
109109
} as GitifyMilestone;
110110

111-
const props = {
111+
const props: MetricGroupProps = {
112112
notification: mockNotification,
113113
};
114114

@@ -123,7 +123,7 @@ describe('renderer/components/metrics/MetricGroup.tsx', () => {
123123
state: 'CLOSED',
124124
} as GitifyMilestone;
125125

126-
const props = {
126+
const props: MetricGroupProps = {
127127
notification: mockNotification,
128128
};
129129

src/renderer/components/metrics/MetricGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { type GitifyNotification, IconColor } from '../../types';
1414
import { getPullRequestReviewIcon } from '../../utils/icons';
1515
import { MetricPill } from './MetricPill';
1616

17-
interface MetricGroupProps {
17+
export interface MetricGroupProps {
1818
notification: GitifyNotification;
1919
}
2020

0 commit comments

Comments
 (0)