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
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ the macOS native vibrancy material, which Chromium cannot render.
### 🎨 Code Style & Conventions

- Linting and formatting are configured in `vite.config.mts` (the `lint` and `fmt` blocks). Please run `pnpm check` before submitting a PR.
- Renderer React components are defined as function declarations. `React.FC` is reserved for typing a component value (a prop or return type), never a component definition; `react/function-component-definition` enforces this.
- Follow existing file and folder naming conventions.
- See [ARCHITECTURE.md](./ARCHITECTURE.md) for the renderer's module layering, state ownership, and side-effect conventions.
- Keep commit messages clear and descriptive.
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function RequireAuth({ children }: { children: React.ReactNode }) {
return isLoggedIn ? children : <Navigate replace state={{ from: location }} to="/login" />;
}

export const App = () => {
export function App() {
// Initialize store subscriptions with proper cleanup
useEffect(() => {
const cleanup = initializeStoreSubscriptions();
Expand Down Expand Up @@ -128,4 +128,4 @@ export const App = () => {
</ThemeProvider>
</QueryClientProvider>
);
};
}
6 changes: 3 additions & 3 deletions src/renderer/components/AllRead.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FC, useMemo } from 'react';
import { useMemo } from 'react';

import { Constants } from '../constants';

Expand All @@ -12,12 +12,12 @@
fullHeight?: boolean;
}

export const AllRead: FC<AllReadProps> = ({ fullHeight = true }: AllReadProps) => {
export function AllRead({ fullHeight = true }: AllReadProps) {

Check warning on line 15 in src/renderer/components/AllRead.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=gitify-app_gitify&issues=AaE6aea1g2eHdEqAC1nm&open=AaE6aea1g2eHdEqAC1nm&pullRequest=3421
const hasFilters = useFiltersStore((s) => s.hasActiveFilters());

const emoji = useMemo(() => randomElement(Constants.EMOJIS.ALL_READ), []);

const heading = `No new ${hasFilters ? 'filtered ' : ''} notifications`;

return <EmojiSplash emoji={emoji} fullHeight={fullHeight} heading={heading} />;
};
}
6 changes: 3 additions & 3 deletions src/renderer/components/GlobalEffects.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FC, useEffect } from 'react';
import { useEffect } from 'react';

import { useQueryClient } from '@tanstack/react-query';

Expand All @@ -23,7 +23,7 @@ import { setTrayIconColorAndTitle } from '../utils/system/tray';
* Owns: theme application, tray icon updates, global shortcut registration,
* app reset handling, periodic account refreshes, and notification alerts.
*/
export const GlobalEffects: FC = () => {
export function GlobalEffects() {
const queryClient = useQueryClient();

const resetAccounts = useAccountsStore((s) => s.reset);
Expand Down Expand Up @@ -74,4 +74,4 @@ export const GlobalEffects: FC = () => {
}, [resetAccounts, resetSettings, resetFilters, queryClient]);

return null;
};
}
6 changes: 3 additions & 3 deletions src/renderer/components/GlobalShortcuts.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FC, useEffect } from 'react';
import { useEffect } from 'react';

import { useShortcutActions } from '../hooks/useShortcutActions';

Expand All @@ -8,7 +8,7 @@ import { getNormalizedKey, shouldIgnoreKeyboardEvent } from '../utils/ui/keyboar
* Component that registers global keyboard shortcuts for the renderer app.
* Mount once inside App, within Router + AppProvider.
*/
export const GlobalShortcuts: FC = () => {
export function GlobalShortcuts() {
const { shortcuts } = useShortcutActions();

useEffect(() => {
Expand Down Expand Up @@ -41,4 +41,4 @@ export const GlobalShortcuts: FC = () => {
}, [shortcuts]);

return null;
};
}
6 changes: 3 additions & 3 deletions src/renderer/components/Oops.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FC, useMemo } from 'react';
import { useMemo } from 'react';
import { useNavigate } from 'react-router-dom';

import { Button } from '@primer/react';
Expand All @@ -15,7 +15,7 @@
fullHeight?: boolean;
}

export const Oops: FC<OopsProps> = ({ error, fullHeight = true }: OopsProps) => {
export function Oops({ error, fullHeight = true }: OopsProps) {

Check warning on line 18 in src/renderer/components/Oops.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=gitify-app_gitify&issues=AaE6aeamg2eHdEqAC1nl&open=AaE6aeamg2eHdEqAC1nl&pullRequest=3421
const navigate = useNavigate();

const err = error ?? Errors.UNKNOWN;
Expand Down Expand Up @@ -44,4 +44,4 @@
subHeadings={err.descriptions}
/>
);
};
}
6 changes: 2 additions & 4 deletions src/renderer/components/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { FC } from 'react';

import {
BellIcon,
CrosshairsIcon,
Expand All @@ -21,7 +19,7 @@ import { useAccountsStore, useFiltersStore, useSettingsStore } from '../stores';

import { LogoIcon } from '../icons/LogoIcon';

export const Sidebar: FC = () => {
export function Sidebar() {
const { status, notificationCount, hasUnreadNotifications, isFetching } = useNotifications();

const { shortcuts } = useShortcutActions();
Expand Down Expand Up @@ -165,4 +163,4 @@ export const Sidebar: FC = () => {
</Stack>
</Stack>
);
};
}
7 changes: 3 additions & 4 deletions src/renderer/components/avatars/AvatarWithFallback.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type React from 'react';
import type { FC } from 'react';
import { createElement, useState } from 'react';

Expand All @@ -20,14 +19,14 @@
icon?: FC<OcticonProps>;
}

export const AvatarWithFallback: React.FC<AvatarWithFallbackProps> = ({
export function AvatarWithFallback({
src,
alt,
name,
size = Size.MEDIUM,
userType = 'User',
icon,
}) => {
}: AvatarWithFallbackProps) {

Check warning on line 29 in src/renderer/components/avatars/AvatarWithFallback.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=gitify-app_gitify&issues=AaE6aeaFg2eHdEqAC1nj&open=AaE6aeaFg2eHdEqAC1nj&pullRequest=3421
const [hasBrokenAvatarSource, setHasBrokenAvatarSource] = useState(false);

const isNonHuman = isNonHumanUser(userType);
Expand All @@ -54,4 +53,4 @@
)}
</Stack>
);
};
}
6 changes: 3 additions & 3 deletions src/renderer/components/fields/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FC, ReactNode } from 'react';
import type { ReactNode } from 'react';

import { Stack } from '@primer/react';

Expand All @@ -19,7 +19,7 @@ export interface CheckboxProps {
onChange: (evt: React.ChangeEvent<HTMLInputElement>) => void;
}

export const Checkbox: FC<CheckboxProps> = ({ visible = true, ...props }: CheckboxProps) => {
export function Checkbox({ visible = true, ...props }: CheckboxProps) {
const counter = props?.counter === 0 ? '0' : props.counter;

return (
Expand Down Expand Up @@ -53,4 +53,4 @@ export const Checkbox: FC<CheckboxProps> = ({ visible = true, ...props }: Checkb
</Stack>
)
);
};
}
6 changes: 2 additions & 4 deletions src/renderer/components/fields/FieldLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import type { FC } from 'react';

export interface FieldLabelProps {
name: string;
label: string;
}

export const FieldLabel: FC<FieldLabelProps> = (props: FieldLabelProps) => {
export function FieldLabel(props: FieldLabelProps) {

Check warning on line 6 in src/renderer/components/fields/FieldLabel.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=gitify-app_gitify&issues=AaE6aeYag2eHdEqAC1ng&open=AaE6aeYag2eHdEqAC1ng&pullRequest=3421
return (
<label className={'mr-1 font-medium cursor-pointer'} htmlFor={props.name}>
{props.label}
</label>
);
};
}
6 changes: 3 additions & 3 deletions src/renderer/components/fields/RadioGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ChangeEvent, FC, ReactNode } from 'react';
import type { ChangeEvent, ReactNode } from 'react';

import { Stack } from '@primer/react';

Expand All @@ -16,7 +16,7 @@
tooltip?: ReactNode | string;
}

export const RadioGroup: FC<RadioGroupProps> = (props: RadioGroupProps) => {
export function RadioGroup(props: RadioGroupProps) {

Check warning on line 19 in src/renderer/components/fields/RadioGroup.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=gitify-app_gitify&issues=AaE6aeY2g2eHdEqAC1ni&open=AaE6aeY2g2eHdEqAC1ni&pullRequest=3421
return (
<Stack align="center" className="text-sm" direction="horizontal" gap="condensed">
<FieldLabel label={props.label} name={props.name} />
Expand Down Expand Up @@ -44,4 +44,4 @@
{props.tooltip && <Tooltip name={`tooltip-${props.name}`} tooltip={props.tooltip} />}
</Stack>
);
};
}
6 changes: 3 additions & 3 deletions src/renderer/components/fields/Tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FC, type ReactNode, useEffect, useRef, useState } from 'react';
import { type ReactNode, useEffect, useRef, useState } from 'react';

import { QuestionIcon } from '@primer/octicons-react';
import { AnchoredOverlay } from '@primer/react';
Expand All @@ -10,7 +10,7 @@
tooltip: ReactNode | string;
}

export const Tooltip: FC<TooltipProps> = (props: TooltipProps) => {
export function Tooltip(props: TooltipProps) {

Check warning on line 13 in src/renderer/components/fields/Tooltip.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=gitify-app_gitify&issues=AaE6aeYog2eHdEqAC1nh&open=AaE6aeYog2eHdEqAC1nh&pullRequest=3421
const [shouldShowTooltipContents, setShouldShowTooltipContents] = useState(false);

const scrollContainerRef = useRef<HTMLElement | null>(null);
Expand Down Expand Up @@ -100,4 +100,4 @@
</div>
</AnchoredOverlay>
);
};
}
6 changes: 2 additions & 4 deletions src/renderer/components/filters/AccountFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { FC } from 'react';

import { PersonIcon } from '@primer/octicons-react';
import { Stack, Text } from '@primer/react';

Expand All @@ -11,7 +9,7 @@ import { Title } from '../primitives/Title';

import { getAccountUUID } from '../../utils/auth/utils';

export const AccountFilter: FC = () => {
export function AccountFilter() {
const { notifications } = useNotifications();
const accounts = useAccountsStore((s) => s.accounts);
const filteredAccounts = useFiltersStore((s) => s.accounts);
Expand Down Expand Up @@ -46,4 +44,4 @@ export const AccountFilter: FC = () => {
</Stack>
</fieldset>
);
};
}
6 changes: 3 additions & 3 deletions src/renderer/components/filters/FilterSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
layout?: 'horizontal' | 'vertical';
}

const FilterSectionComponent = <K extends keyof FiltersState>({
function FilterSectionComponent<K extends keyof FiltersState>({
id,
title,
icon,
filter,
filterSetting,
tooltip,
layout = 'vertical',
}: FilterSectionProps<K>) => {
}: FilterSectionProps<K>) {

Check warning on line 33 in src/renderer/components/filters/FilterSection.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=gitify-app_gitify&issues=AaE6aePeg2eHdEqAC1nA&open=AaE6aePeg2eHdEqAC1nA&pullRequest=3421
const { notifications } = useNotifications();
const updateFilter = useFiltersStore((s) => s.updateFilter);

Expand Down Expand Up @@ -102,7 +102,7 @@
</Stack>
</fieldset>
);
};
}

// Memoize the component to prevent unnecessary re-renders
export const FilterSection = memo(FilterSectionComponent) as typeof FilterSectionComponent;
6 changes: 2 additions & 4 deletions src/renderer/components/filters/ReasonFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import type { FC } from 'react';

import { NoteIcon } from '@primer/octicons-react';
import { Text } from '@primer/react';

import { reasonFilter } from '../../utils/notifications/filters';
import { FilterSection } from './FilterSection';

export const ReasonFilter: FC = () => {
export function ReasonFilter() {
return (
<FilterSection
filter={reasonFilter}
Expand All @@ -17,4 +15,4 @@ export const ReasonFilter: FC = () => {
tooltip={<Text>Filter notifications by reason.</Text>}
/>
);
};
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { FC } from 'react';

import { Text } from '@primer/react';

export const RequiresDetailedNotificationWarning: FC = () => (
<Text className="text-gitify-caution">
⚠️ This filter requires the <Text as="strong">Detailed Notifications</Text> setting to be
enabled.
</Text>
);
export function RequiresDetailedNotificationWarning() {
return (
<Text className="text-gitify-caution">
⚠️ This filter requires the <Text as="strong">Detailed Notifications</Text> setting to be
enabled.
</Text>
);
}
6 changes: 2 additions & 4 deletions src/renderer/components/filters/ReviewRequestTypeFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import type { FC } from 'react';

import { GitPullRequestIcon } from '@primer/octicons-react';
import { Stack, Text } from '@primer/react';

import { reviewRequestTypeFilter } from '../../utils/notifications/filters';
import { FilterSection } from './FilterSection';

export const ReviewRequestTypeFilter: FC = () => {
export function ReviewRequestTypeFilter() {
return (
<FilterSection
filter={reviewRequestTypeFilter}
Expand All @@ -28,4 +26,4 @@ export const ReviewRequestTypeFilter: FC = () => {
}
/>
);
};
}
6 changes: 2 additions & 4 deletions src/renderer/components/filters/SearchFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { FC } from 'react';

import {
CheckCircleFillIcon,
CommentIcon,
Expand Down Expand Up @@ -27,7 +25,7 @@ import {
import { RequiresDetailedNotificationWarning } from './RequiresDetailedNotificationsWarning';
import { TokenSearchInput } from './TokenSearchInput';

export const SearchFilter: FC = () => {
export function SearchFilter() {
const updateFilter = useFiltersStore((s) => s.updateFilter);
const includeSearchTokens = useFiltersStore((s) => s.includeSearchTokens);
const excludeSearchTokens = useFiltersStore((s) => s.excludeSearchTokens);
Expand Down Expand Up @@ -136,4 +134,4 @@ export const SearchFilter: FC = () => {
</Stack>
</fieldset>
);
};
}
6 changes: 2 additions & 4 deletions src/renderer/components/filters/SearchFilterSuggestions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { FC } from 'react';

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

import { cn } from 'cn';
Expand All @@ -19,7 +17,7 @@
inputValue: string;
}

export const SearchFilterSuggestions: FC<SearchFilterSuggestionsProps> = ({ open, inputValue }) => {
export function SearchFilterSuggestions({ open, inputValue }: SearchFilterSuggestionsProps) {

Check warning on line 20 in src/renderer/components/filters/SearchFilterSuggestions.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark the props of the component as read-only.

See more on https://sonarcloud.io/project/issues?id=gitify-app_gitify&issues=AaE6aeJBg2eHdEqAC1m_&open=AaE6aeJBg2eHdEqAC1m_&pullRequest=3421
const detailedNotifications = useSettingsStore((s) => s.detailedNotifications);

if (!open) {
Expand Down Expand Up @@ -56,4 +54,4 @@
</Popover.Content>
</Popover>
);
};
}
Loading
Loading