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
12 changes: 6 additions & 6 deletions src/components/NotificationRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import {
} from 'react';

import { AppContext } from '../context/App';
import { PILL_CLASS_NAME } from '../styles/gitify';
import { IconColor } from '../types';
import type { Notification } from '../typesGitHub';
import { openExternalLink } from '../utils/comms';
import Constants from '../utils/constants';
import {
formatForDisplay,
formatNotificationUpdatedAt,
Expand Down Expand Up @@ -156,7 +156,7 @@ export const NotificationRow: FC<IProps> = ({ notification, hostname }) => {
<div>
{notification.subject?.linkedIssues?.length > 0 && (
<span title={linkedIssuesPillDescription}>
<button type="button" className={Constants.PILL_CLASS_NAME}>
<button type="button" className={PILL_CLASS_NAME}>
<IssueClosedIcon
size={12}
className={`mr-1 ${IconColor.GREEN}`}
Expand All @@ -174,7 +174,7 @@ export const NotificationRow: FC<IProps> = ({ notification, hostname }) => {

return (
<span key={review.state} title={icon.description}>
<button type="button" className={Constants.PILL_CLASS_NAME}>
<button type="button" className={PILL_CLASS_NAME}>
<icon.type
size={12}
className={`mr-1 ${icon.color}`}
Expand All @@ -187,7 +187,7 @@ export const NotificationRow: FC<IProps> = ({ notification, hostname }) => {
})}
{notification.subject?.comments > 0 && (
<span title={commentsPillDescription}>
<button type="button" className={Constants.PILL_CLASS_NAME}>
<button type="button" className={PILL_CLASS_NAME}>
<CommentIcon
size={12}
className={`mr-1 ${IconColor.GRAY}`}
Expand All @@ -199,7 +199,7 @@ export const NotificationRow: FC<IProps> = ({ notification, hostname }) => {
)}
{notification.subject?.labels?.length > 0 && (
<span title={labelsPillDescription}>
<button type="button" className={Constants.PILL_CLASS_NAME}>
<button type="button" className={PILL_CLASS_NAME}>
<TagIcon
size={12}
className={`mr-1 ${IconColor.GRAY}`}
Expand All @@ -214,7 +214,7 @@ export const NotificationRow: FC<IProps> = ({ notification, hostname }) => {
className="ml-1"
title={notification.subject.milestone.title}
>
<button type="button" className={Constants.PILL_CLASS_NAME}>
<button type="button" className={PILL_CLASS_NAME}>
<MilestoneIcon
size={12}
className={
Expand Down
10 changes: 4 additions & 6 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { type FC, useCallback, useContext, useMemo } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { Logo } from '../components/Logo';
import { AppContext } from '../context/App';
import { BUTTON_SIDEBAR_CLASS_NAME } from '../styles/gitify';
import { openExternalLink, quitApp } from '../utils/comms';
import { Constants } from '../utils/constants';
import { getNotificationCount } from '../utils/notifications';
Expand Down Expand Up @@ -39,9 +40,6 @@ export const Sidebar: FC = () => {
return getNotificationCount(notifications);
}, [notifications]);

const sidebarButtonClasses =
'flex justify-evenly items-center bg-transparent border-0 w-full text-sm text-white my-1 py-2 cursor-pointer hover:text-gray-500 focus:outline-none disabled:text-gray-500 disabled:cursor-default';

return (
<div className="flex flex-col fixed left-14 w-14 -ml-14 h-full bg-gray-sidebar overflow-y-auto">
<div className="flex flex-col flex-1 items-center py-4">
Expand Down Expand Up @@ -76,7 +74,7 @@ export const Sidebar: FC = () => {
<>
<button
type="button"
className={sidebarButtonClasses}
className={BUTTON_SIDEBAR_CLASS_NAME}
title="Refresh Notifications"
onClick={() => {
navigate('/', { replace: true });
Expand All @@ -92,7 +90,7 @@ export const Sidebar: FC = () => {
</button>
<button
type="button"
className={sidebarButtonClasses}
className={BUTTON_SIDEBAR_CLASS_NAME}
title="Settings"
onClick={toggleSettings}
>
Expand All @@ -104,7 +102,7 @@ export const Sidebar: FC = () => {
{!isLoggedIn && (
<button
type="button"
className={sidebarButtonClasses}
className={BUTTON_SIDEBAR_CLASS_NAME}
title="Quit Gitify"
aria-label="Quit Gitify"
onClick={quitApp}
Expand Down
10 changes: 4 additions & 6 deletions src/routes/Accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { AppContext } from '../context/App';

import { AuthMethodIcon } from '../components/icons/AuthMethodIcon';
import { PlatformIcon } from '../components/icons/PlatformIcon';
import { BUTTON_CLASS_NAME } from '../styles/gitify';
import type { Account } from '../types';
import { getAccountUUID, getDeveloperSettingsURL } from '../utils/auth/utils';
import {
Expand Down Expand Up @@ -59,9 +60,6 @@ export const AccountsRoute: FC = () => {
return navigate('/login-oauth-app', { replace: true });
}, []);

const buttonClass =
'hover:text-gray-500 py-1 px-2 my-1 mx-2 focus:outline-none';

return (
<div
className="flex flex-1 flex-col h-screen dark:bg-gray-dark dark:text-white"
Expand Down Expand Up @@ -134,7 +132,7 @@ export const AccountsRoute: FC = () => {
<div>
<button
type="button"
className={buttonClass}
className={BUTTON_CLASS_NAME}
title={`Logout ${account.user.login}`}
onClick={() => logoutAccount(account)}
>
Expand All @@ -154,7 +152,7 @@ export const AccountsRoute: FC = () => {
<div>
<button
type="button"
className={buttonClass}
className={BUTTON_CLASS_NAME}
title="Login with Personal Access Token"
onClick={loginWithPersonalAccessToken}
hidden={isPersonalAccessTokenLoggedIn(auth)}
Expand All @@ -164,7 +162,7 @@ export const AccountsRoute: FC = () => {
</button>
<button
type="button"
className={buttonClass}
className={BUTTON_CLASS_NAME}
title="Login with OAuth App"
onClick={loginWithOAuthApp}
hidden={isOAuthAppLoggedIn(auth)}
Expand Down
8 changes: 3 additions & 5 deletions src/routes/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { useNavigate } from 'react-router-dom';
import { Checkbox } from '../components/fields/Checkbox';
import { RadioGroup } from '../components/fields/RadioGroup';
import { AppContext } from '../context/App';
import { BUTTON_CLASS_NAME } from '../styles/gitify';
import { Theme } from '../types';
import { getAppVersion, openExternalLink, quitApp } from '../utils/comms';
import Constants from '../utils/constants';
Expand Down Expand Up @@ -61,9 +62,6 @@ export const SettingsRoute: FC = () => {
});
}, [settings.theme]);

const footerButtonClass =
'hover:text-gray-500 py-1 px-2 my-1 mx-2 focus:outline-none';

return (
<div
className="flex flex-1 flex-col h-screen dark:bg-gray-dark dark:text-white"
Expand Down Expand Up @@ -299,7 +297,7 @@ export const SettingsRoute: FC = () => {
<div>
<button
type="button"
className={footerButtonClass}
className={BUTTON_CLASS_NAME}
title="Accounts"
onClick={() => {
navigate('/accounts');
Expand All @@ -310,7 +308,7 @@ export const SettingsRoute: FC = () => {

<button
type="button"
className={`${footerButtonClass} mr-0`}
className={BUTTON_CLASS_NAME}
title="Quit Gitify"
onClick={quitApp}
>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/__snapshots__/Settings.test.tsx.snap

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

10 changes: 10 additions & 0 deletions src/styles/gitify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const BUTTON_CLASS_NAME =
'hover:text-gray-500 py-1 px-2 my-1 mx-2 focus:outline-none';

export const BUTTON_SIDEBAR_CLASS_NAME =
'flex justify-evenly items-center bg-transparent border-0 w-full text-sm text-white my-1 py-2 cursor-pointer hover:text-gray-500 focus:outline-none disabled:text-gray-500 disabled:cursor-default';

export const PILL_CLASS_NAME =
'rounded-full text-xss px-1 m-0.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700';

export const READ_NOTIFICATION_CLASS_NAME = 'opacity-50 dark:opacity-50';
5 changes: 0 additions & 5 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ export const Constants = {

FETCH_INTERVAL: 60000,

READ_CLASS_NAME: 'opacity-50 dark:opacity-50',

PILL_CLASS_NAME:
'rounded-full text-xss px-1 m-0.5 bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700',

// GitHub Docs
GITHUB_DOCS: {
OAUTH_URL:
Expand Down
4 changes: 2 additions & 2 deletions src/utils/remove-notification.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mockSingleAccountNotifications } from '../__mocks__/notifications-mocks';
import { mockSettings } from '../__mocks__/state-mocks';
import { READ_NOTIFICATION_CLASS_NAME } from '../styles/gitify';
import { mockSingleNotification } from './api/__mocks__/response-mocks';
import Constants from './constants';
import { removeNotification } from './remove-notification';

describe('utils/remove-notification.ts', () => {
Expand Down Expand Up @@ -39,6 +39,6 @@ describe('utils/remove-notification.ts', () => {
expect(document.getElementById).toHaveBeenCalledWith(
mockSingleAccountNotifications[0].notifications[0].id,
);
expect(mockElement.className).toContain(Constants.READ_CLASS_NAME);
expect(mockElement.className).toContain(READ_NOTIFICATION_CLASS_NAME);
});
});
4 changes: 2 additions & 2 deletions src/utils/remove-notification.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { READ_NOTIFICATION_CLASS_NAME } from '../styles/gitify';
import type { AccountNotifications, SettingsState } from '../types';
import Constants from './constants';

export const removeNotification = (
settings: SettingsState,
Expand All @@ -9,7 +9,7 @@ export const removeNotification = (
): AccountNotifications[] => {
if (settings.delayNotificationState) {
const notificationRow = document.getElementById(id);
notificationRow.className += ` ${Constants.READ_CLASS_NAME}`;
notificationRow.className += ` ${READ_NOTIFICATION_CLASS_NAME}`;
return notifications;
}

Expand Down