Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { sendRendererEvent } from './events';

export function takeScreenshot(mb: Menubar) {
const date = new Date();
const dateStr = date.toISOString().replace(/:/g, '-');
const dateStr = date.toISOString().replaceAll(':', '-');

const capturedPicFilePath = path.join(
os.homedir(),
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/components/filters/TokenSearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface TokenSearchInputProps {
onRemove: (token: SearchToken) => void;
}

const INPUT_KEY_EVENTS = ['Enter', 'Tab', ' ', ','];
const INPUT_KEY_EVENTS: Set<string> = new Set(['Enter', 'Tab', ' ', ',']);

export const TokenSearchInput: FC<TokenSearchInputProps> = ({
label,
Expand Down Expand Up @@ -51,7 +51,7 @@ export const TokenSearchInput: FC<TokenSearchInputProps> = ({
}

function onKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {
if (INPUT_KEY_EVENTS.includes(e.key)) {
if (INPUT_KEY_EVENTS.has(e.key)) {
tryAddToken(e);
setShowSuggestions(false);
} else if (e.key === 'ArrowDown') {
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/components/metrics/MetricPill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import { Label, Stack, Text } from '@primer/react';
import { type IconColor, Size } from '../../types';

export interface IMetricPill {
key?: string;
title: string;
metric?: number;
icon: Icon;
color: IconColor;
}

export const MetricPill: FC<IMetricPill> = (props: IMetricPill) => {
const Icon = props.icon;

return (
<Label
className="hover:bg-gitify-notification-pill-hover"
Expand All @@ -22,7 +23,7 @@ export const MetricPill: FC<IMetricPill> = (props: IMetricPill) => {
variant="secondary"
>
<Stack align="center" direction="horizontal" gap="none">
<props.icon className={props.color} size={Size.XSMALL} />
<Icon className={props.color} size={Size.XSMALL} />
{props.metric ? (
<Text className="text-xxs px-1">{props.metric}</Text>
) : null}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/primitives/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface ITitle {
}

export const Title: FC<ITitle> = ({ size = 2, ...props }) => {
const name = props.children.toLowerCase().replace(' ', '-');
const name = props.children.toLowerCase().replaceAll(' ', '-');

return (
<legend>
Expand Down
1 change: 0 additions & 1 deletion src/renderer/components/settings/AppearanceSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export const AppearanceSettings: FC = () => {
<FieldLabel label="Theme:" name="theme" />
<Select
data-testid="settings-theme"
id="theme"
onChange={(evt) =>
updateSetting('theme', evt.target.value as Theme)
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/renderer/routes/__snapshots__/Settings.test.tsx.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/renderer/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function actionsURL(repositoryURL: string, filters: string[]): Link {
}

// Note: the GitHub Actions UI cannot handle encoded '+' characters.
return url.toString().replace(/%2B/g, '+') as Link;
return url.toString().replaceAll('%2B', '+') as Link;
}

async function getDiscussionUrl(notification: Notification): Promise<Link> {
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/utils/notifications/handlers/pullRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ export async function getLatestReviewForReviewers(
(review) => review.state === prReview.state,
);

if (!reviewerFound) {
if (reviewerFound) {
reviewerFound.users.push(prReview.user.login);
} else {
reviewers.push({
state: prReview.state,
users: [prReview.user.login],
});
} else {
reviewerFound.users.push(prReview.user.login);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/utils/notifications/handlers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function formatForDisplay(text: string[]): string {
return text
.join(' ')
.replace(/([a-z])([A-Z])/g, '$1 $2') // Add space between lowercase character followed by an uppercase character
.replace(/_/g, ' ') // Replace underscores with spaces
.replaceAll('_', ' ') // Replace underscores with spaces
.replace(/\w+/g, (word) => {
// Convert to proper case (capitalize first letter of each word)
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/utils/notifications/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ export const triggerNativeNotifications = (
return accountNotifications.notifications;
}

const accountPreviousNotificationsIds =
accountPreviousNotifications.notifications.map((item) => item.id);
const accountPreviousNotificationsIds = new Set<string>(
accountPreviousNotifications.notifications.map((item) => item.id),
);

const accountNewNotifications = accountNotifications.notifications.filter(
(item) => {
return !accountPreviousNotificationsIds.includes(`${item.id}`);
return !accountPreviousNotificationsIds.has(`${item.id}`);
},
);

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/utils/notifications/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function getNotifications(state: GitifyState) {
export async function getAllNotifications(
state: GitifyState,
): Promise<AccountNotifications[]> {
const responses = await Promise.all([...getNotifications(state)]);
const responses = await Promise.all(getNotifications(state));

const notifications: AccountNotifications[] = await Promise.all(
responses
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/utils/notifications/remove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export function removeNotifications(
}

const removeNotificationAccount = notificationsToRemove[0].account;
const removeNotificationIDs = notificationsToRemove.map(
(notification) => notification.id,
const removeNotificationIDs = new Set<string>(
notificationsToRemove.map((notification) => notification.id),
);

const accountIndex = allNotifications.findIndex(
Expand All @@ -31,7 +31,7 @@ export function removeNotifications(
updatedNotifications[accountIndex] = {
...updatedNotifications[accountIndex],
notifications: updatedNotifications[accountIndex].notifications.filter(
(notification) => !removeNotificationIDs.includes(notification.id),
(notification) => !removeNotificationIDs.has(notification.id),
),
};
return updatedNotifications;
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/utils/zoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const MULTIPLIER = 2;
* @returns zoomLevel -2 to 0.5
*/
export const zoomPercentageToLevel = (percentage: number): number => {
if (typeof percentage === 'undefined') {
if (percentage === undefined) {
return 0;
}

Expand All @@ -20,7 +20,7 @@ export const zoomPercentageToLevel = (percentage: number): number => {
* @returns percentage 0-150
*/
export const zoomLevelToPercentage = (zoom: number): number => {
if (typeof zoom === 'undefined') {
if (zoom === undefined) {
return 100;
}

Expand Down