Skip to content

Commit

Permalink
Merge branch 'main' into MI-596
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarTrebinjac committed Jan 1, 2025
2 parents c4d9870 + 81dac20 commit 152ebcc
Show file tree
Hide file tree
Showing 1,361 changed files with 5,406 additions and 5,429 deletions.
1 change: 1 addition & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = {
'jsx-a11y/anchor-is-valid': 0,
'react/no-danger': 0,
'@typescript-eslint/return-await': 0,
'@typescript-eslint/consistent-type-imports': 'error',
'tailwindcss/classnames-order': 'warn',
'tailwindcss/no-contradicting-classname': 'error',
'no-restricted-globals': [
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/__mocks__/reactMarkdownMock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement, ReactNode } from 'react';
import type { ReactElement, ReactNode } from 'react';
import React from 'react';

const ReactMarkdown = ({
children,
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/__tests__/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'fake-indexeddb/auto';
import { clear } from 'idb-keyval';
import nodeFetch from 'node-fetch';
import { storageWrapper as storage } from '@dailydotdev/shared/src/lib/storageWrapper';
import { NextRouter } from 'next/router';
import type { NextRouter } from 'next/router';
import { structuredCloneJsonPolyfill } from '@dailydotdev/shared/src/lib/structuredClone';

process.env.NEXT_PUBLIC_API_URL = 'http://localhost:3000';
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/background/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import browser, { Runtime, Tabs } from 'webextension-polyfill';
import type { Runtime, Tabs } from 'webextension-polyfill';
import browser from 'webextension-polyfill';
import { getBootData } from '@dailydotdev/shared/src/lib/boot';
import { graphqlUrl } from '@dailydotdev/shared/src/lib/config';
import { parseOrDefault } from '@dailydotdev/shared/src/lib/func';
Expand Down
6 changes: 4 additions & 2 deletions packages/extension/src/companion/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, { ReactElement, useState } from 'react';
import type { ReactElement } from 'react';
import React, { useState } from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import browser from 'webextension-polyfill';
import { Boot, BootApp } from '@dailydotdev/shared/src/lib/boot';
import type { Boot } from '@dailydotdev/shared/src/lib/boot';
import { BootApp } from '@dailydotdev/shared/src/lib/boot';
import { AuthContextProvider } from '@dailydotdev/shared/src/contexts/AuthContext';
import { SettingsContextProvider } from '@dailydotdev/shared/src/contexts/SettingsContext';
import { useRefreshToken } from '@dailydotdev/shared/src/hooks/useRefreshToken';
Expand Down
8 changes: 2 additions & 6 deletions packages/extension/src/companion/Companion.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import React from 'react';
import '@testing-library/jest-dom';
import {
fireEvent,
render,
RenderResult,
screen,
} from '@testing-library/react';
import type { RenderResult } from '@testing-library/react';
import { fireEvent, render, screen } from '@testing-library/react';
import defaultUser from '@dailydotdev/shared/__tests__/fixture/loggedUser';
import { UserVote } from '@dailydotdev/shared/src/graphql/posts';
import {
Expand Down
16 changes: 6 additions & 10 deletions packages/extension/src/companion/Companion.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import React, {
ReactElement,
ReactNode,
useEffect,
useRef,
useState,
LegacyRef,
useCallback,
} from 'react';
import type { ReactElement, ReactNode, LegacyRef } from 'react';
import React, { useEffect, useRef, useState, useCallback } from 'react';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import classNames from 'classnames';
import Modal from 'react-modal';
import { isTesting } from '@dailydotdev/shared/src/lib/constants';
import { REQUEST_PROTOCOL_KEY } from '@dailydotdev/shared/src/graphql/common';
import '@dailydotdev/shared/src/styles/globals.css';
import { AccessToken, PostBootData } from '@dailydotdev/shared/src/lib/boot';
import type {
AccessToken,
PostBootData,
} from '@dailydotdev/shared/src/lib/boot';
import useLogPageView from '@dailydotdev/shared/src/hooks/log/useLogPageView';
import useDebounceFn from '@dailydotdev/shared/src/hooks/useDebounceFn';
import { usePopupSelector } from '@dailydotdev/shared/src/hooks/usePopupSelector';
Expand Down
5 changes: 3 additions & 2 deletions packages/extension/src/companion/CompanionContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement, useContext, useState } from 'react';
import type { ReactElement } from 'react';
import React, { useContext, useState } from 'react';
import LogoIcon from '@dailydotdev/shared/src/svg/LogoIcon';
import { CopyIcon } from '@dailydotdev/shared/src/components/icons';
import {
Expand All @@ -7,7 +8,7 @@ import {
} from '@dailydotdev/shared/src/components/utilities';
import '@dailydotdev/shared/src/styles/globals.css';
import SimpleTooltip from '@dailydotdev/shared/src/components/tooltips/SimpleTooltip';
import { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import type { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import {
Button,
ButtonColor,
Expand Down
20 changes: 9 additions & 11 deletions packages/extension/src/companion/CompanionContextMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement, useState } from 'react';
import type { ReactElement } from 'react';
import React, { useState } from 'react';
import {
DiscussIcon as CommentIcon,
FlagIcon,
Expand All @@ -7,22 +8,19 @@ import {
DownvoteIcon,
} from '@dailydotdev/shared/src/components/icons';
import { Item, Menu } from '@dailydotdev/react-contexify';
import {
ReportPostModal,
ReportedCallback,
} from '@dailydotdev/shared/src/components/modals';
import { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import type { ReportedCallback } from '@dailydotdev/shared/src/components/modals';
import { ReportPostModal } from '@dailydotdev/shared/src/components/modals';
import type { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import { useToastNotification } from '@dailydotdev/shared/src/hooks/useToastNotification';
import { feedback } from '@dailydotdev/shared/src/lib/constants';
import {
PromptOptions,
usePrompt,
} from '@dailydotdev/shared/src/hooks/usePrompt';
import type { PromptOptions } from '@dailydotdev/shared/src/hooks/usePrompt';
import { usePrompt } from '@dailydotdev/shared/src/hooks/usePrompt';
import { IconSize } from '@dailydotdev/shared/src/components/Icon';
import classNames from 'classnames';
import { Origin } from '@dailydotdev/shared/src/lib/log';
import { labels } from '@dailydotdev/shared/src/lib';
import { Post, UserVote } from '@dailydotdev/shared/src/graphql/posts';
import type { Post } from '@dailydotdev/shared/src/graphql/posts';
import { UserVote } from '@dailydotdev/shared/src/graphql/posts';
import { getCompanionWrapper } from '@dailydotdev/shared/src/lib/extension';

interface CompanionContextMenuProps {
Expand Down
5 changes: 3 additions & 2 deletions packages/extension/src/companion/CompanionDiscussion.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { CSSProperties, ReactElement } from 'react';
import type { CSSProperties, ReactElement } from 'react';
import React from 'react';
import classNames from 'classnames';
import { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import type { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import { NewComment } from '@dailydotdev/shared/src/components/post/NewComment';
import { PostComments } from '@dailydotdev/shared/src/components/post/PostComments';
import { Origin } from '@dailydotdev/shared/src/lib/log';
Expand Down
5 changes: 3 additions & 2 deletions packages/extension/src/companion/CompanionEngagements.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { ReactElement } from 'react';
import { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import type { ReactElement } from 'react';
import React from 'react';
import type { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import { ClickableText } from '@dailydotdev/shared/src/components/buttons/ClickableText';
import { useQueryClient } from '@tanstack/react-query';
import { useRawBackgroundRequest } from '@dailydotdev/shared/src/hooks/companion';
Expand Down
12 changes: 6 additions & 6 deletions packages/extension/src/companion/CompanionMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement, useContext, useEffect } from 'react';
import type { ReactElement } from 'react';
import React, { useContext, useEffect } from 'react';
import {
Button,
ButtonColor,
Expand All @@ -15,7 +16,7 @@ import SimpleTooltip from '@dailydotdev/shared/src/components/tooltips/SimpleToo
import Modal from 'react-modal';
import { useContextMenu } from '@dailydotdev/react-contexify';
import { isTesting } from '@dailydotdev/shared/src/lib/constants';
import { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import type { PostBootData } from '@dailydotdev/shared/src/lib/boot';
import { LogEvent, Origin } from '@dailydotdev/shared/src/lib/log';
import AuthContext from '@dailydotdev/shared/src/contexts/AuthContext';
import usePersistentContext from '@dailydotdev/shared/src/hooks/usePersistentContext';
Expand All @@ -27,12 +28,11 @@ import { LazyModal } from '@dailydotdev/shared/src/components/modals/common/type
import { useLazyModal } from '@dailydotdev/shared/src/hooks/useLazyModal';
import { UserVote } from '@dailydotdev/shared/src/graphql/posts';
import { useVotePost } from '@dailydotdev/shared/src/hooks';
import UpvotedPopupModal, {
UpvotedPopupModalProps,
} from '@dailydotdev/shared/src/components/modals/UpvotedPopupModal';
import type { UpvotedPopupModalProps } from '@dailydotdev/shared/src/components/modals/UpvotedPopupModal';
import UpvotedPopupModal from '@dailydotdev/shared/src/components/modals/UpvotedPopupModal';
import { getCompanionWrapper } from '@dailydotdev/shared/src/lib/extension';
import ShareModal from '@dailydotdev/shared/src/components/modals/ShareModal';
import { ShareProps } from '@dailydotdev/shared/src/components/modals/post/common';
import type { ShareProps } from '@dailydotdev/shared/src/components/modals/post/common';
import CompanionContextMenu from './CompanionContextMenu';
import '@dailydotdev/shared/src/styles/globals.css';
import useCompanionActions from './useCompanionActions';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import '@testing-library/jest-dom';
import { render, RenderResult, screen } from '@testing-library/react';
import type { RenderResult } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import { companionExplainerVideo } from '@dailydotdev/shared/src/lib/constants';
import { ExtensionContext } from '@dailydotdev/shared/src/contexts/ExtensionContext';
import { contentScriptKey } from '@dailydotdev/shared/src/hooks';
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/companion/CompanionPermission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
} from '@dailydotdev/shared/src/components/buttons/Button';
import classed from '@dailydotdev/shared/src/lib/classed';
import { companionExplainerVideo } from '@dailydotdev/shared/src/lib/constants';
import React, { forwardRef, ReactElement, Ref } from 'react';
import type { ReactElement, Ref } from 'react';
import React, { forwardRef } from 'react';
import { PlayIcon } from '@dailydotdev/shared/src/components/icons';
import { ClickableText } from '@dailydotdev/shared/src/components/buttons/ClickableText';
import { useExtensionContext } from '@dailydotdev/shared/src/contexts/ExtensionContext';
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/companion/CompanionPopupButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, ReactElement, useContext, useEffect } from 'react';
import type { ReactElement } from 'react';
import React, { useState, useContext, useEffect } from 'react';
import {
Button,
ButtonVariant,
Expand Down
5 changes: 3 additions & 2 deletions packages/extension/src/companion/CompanionToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import type { ReactElement } from 'react';
import React from 'react';
import {
Button,
ButtonVariant,
Expand All @@ -7,7 +8,7 @@ import { ArrowIcon } from '@dailydotdev/shared/src/components/icons';
import { SimpleTooltip } from '@dailydotdev/shared/src/components/tooltips/SimpleTooltip';
import LogoIcon from '@dailydotdev/shared/src/svg/LogoIcon';
import classNames from 'classnames';
import { BaseTooltipContainerProps } from '@dailydotdev/shared/src/components/tooltips/BaseTooltipContainer';
import type { BaseTooltipContainerProps } from '@dailydotdev/shared/src/components/tooltips/BaseTooltipContainer';
import AlertPointer, {
AlertPlacement,
} from '@dailydotdev/shared/src/components/alert/AlertPointer';
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/companion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
} from '@dailydotdev/shared/src/contexts/SettingsContext';
import { setOnError } from '@dailydotdev/shared/src/components/ProfilePicture';
import { getCompanionWrapper } from '@dailydotdev/shared/src/lib/extension';
import App, { CompanionData } from './App';
import type { CompanionData } from './App';
import App from './App';

let root: ReturnType<typeof createRoot>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { QueryKey, useQueryClient, InfiniteData } from '@tanstack/react-query';
import type { QueryKey, InfiniteData } from '@tanstack/react-query';
import { useQueryClient } from '@tanstack/react-query';
import { useBackgroundRequest } from '@dailydotdev/shared/src/hooks/companion';

export const useBackgroundPaginatedRequest = <T extends InfiniteData<unknown>>(
Expand Down
2 changes: 1 addition & 1 deletion packages/extension/src/companion/useCompanionActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { ADD_FILTERS_TO_FEED_MUTATION } from '@dailydotdev/shared/src/graphql/feedSettings';
import { UPDATE_ALERTS } from '@dailydotdev/shared/src/graphql/alerts';
import { UPDATE_USER_SETTINGS_MUTATION } from '@dailydotdev/shared/src/graphql/settings';
import { MutateFunc } from '@dailydotdev/shared/src/lib/query';
import type { MutateFunc } from '@dailydotdev/shared/src/lib/query';
import { ExtensionMessageType } from '@dailydotdev/shared/src/lib/extension';
import { companionRequest } from './companionRequest';

Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/contexts/ExtensionContext.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement, ReactNode, useContext, useMemo } from 'react';
import type { ReactElement, ReactNode } from 'react';
import React, { useContext, useMemo } from 'react';

import browser from 'webextension-polyfill';
import { useQueryClient } from '@tanstack/react-query';
Expand Down
8 changes: 4 additions & 4 deletions packages/extension/src/lib/CustomRouter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable class-methods-use-this */
import { NextRouter } from 'next/router';
import { UrlObject } from 'url';
import { MittEmitter } from 'next/dist/shared/lib/mitt';
import { RouterEvent } from 'next/dist/client/router';
import type { NextRouter } from 'next/router';
import type { UrlObject } from 'url';
import type { MittEmitter } from 'next/dist/shared/lib/mitt';
import type { RouterEvent } from 'next/dist/client/router';

declare type Url = UrlObject | string;

Expand Down
4 changes: 2 additions & 2 deletions packages/extension/src/lib/extensionScripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
isProduction,
} from '@dailydotdev/shared/src/lib/constants';
import { LogEvent as LogEventName } from '@dailydotdev/shared/src/lib/log';
import { QueryClient } from '@tanstack/react-query';
import { LogEvent } from '@dailydotdev/shared/src/hooks/log/useLogQueue';
import type { QueryClient } from '@tanstack/react-query';
import type { LogEvent } from '@dailydotdev/shared/src/hooks/log/useLogQueue';

export type RequestContentScripts = (data: {
origin: string;
Expand Down
11 changes: 3 additions & 8 deletions packages/extension/src/newtab/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React, {
ReactElement,
useCallback,
useContext,
useEffect,
useState,
} from 'react';
import type { ReactElement } from 'react';
import React, { useCallback, useContext, useEffect, useState } from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import dynamic from 'next/dynamic';
import Modal from 'react-modal';
Expand All @@ -15,7 +10,7 @@ import AuthContext, {
} from '@dailydotdev/shared/src/contexts/AuthContext';
import { SubscriptionContextProvider } from '@dailydotdev/shared/src/contexts/SubscriptionContext';
import browser from 'webextension-polyfill';
import { BootDataProviderProps } from '@dailydotdev/shared/src/contexts/BootProvider';
import type { BootDataProviderProps } from '@dailydotdev/shared/src/contexts/BootProvider';
import { RouterContext } from 'next/dist/shared/lib/router-context.shared-runtime';
import useLogPageView from '@dailydotdev/shared/src/hooks/log/useLogPageView';
import useDeviceId from '@dailydotdev/shared/src/hooks/log/useDeviceId';
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/newtab/CardSelection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import classNames from 'classnames';
import { VIcon } from '@dailydotdev/shared/src/components/icons';
import React, { ReactElement, ReactNode } from 'react';
import type { ReactElement, ReactNode } from 'react';
import React from 'react';

interface CardSelectionProps {
title: string;
Expand Down
5 changes: 3 additions & 2 deletions packages/extension/src/newtab/CustomLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {
import SimpleTooltip from '@dailydotdev/shared/src/components/tooltips/SimpleTooltip';
import { MenuIcon } from '@dailydotdev/shared/src/components/icons';
import classNames from 'classnames';
import React, { MouseEventHandler, ReactElement } from 'react';
import { WithClassNameProps } from '@dailydotdev/shared/src/components/utilities';
import type { MouseEventHandler, ReactElement } from 'react';
import React from 'react';
import type { WithClassNameProps } from '@dailydotdev/shared/src/components/utilities';
import { combinedClicks } from '@dailydotdev/shared/src/lib/click';
import { useFeedLayout } from '@dailydotdev/shared/src/hooks';
import { apiUrl } from '@dailydotdev/shared/src/lib/config';
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/newtab/DndBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement } from 'react';
import type { ReactElement } from 'react';
import React from 'react';
import {
Button,
ButtonSize,
Expand Down
12 changes: 6 additions & 6 deletions packages/extension/src/newtab/DndModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement, useState } from 'react';
import type { ReactElement } from 'react';
import React, { useState } from 'react';
import { format } from 'date-fns';
import { Radio } from '@dailydotdev/shared/src/components/fields/Radio';
import {
Expand All @@ -7,13 +8,12 @@ import {
} from '@dailydotdev/shared/src/components/buttons/Button';
import { Dropdown } from '@dailydotdev/shared/src/components/fields/Dropdown';
import { TextField } from '@dailydotdev/shared/src/components/fields/TextField';
import {
Modal,
ModalProps,
} from '@dailydotdev/shared/src/components/modals/common/Modal';
import type { ModalProps } from '@dailydotdev/shared/src/components/modals/common/Modal';
import { Modal } from '@dailydotdev/shared/src/components/modals/common/Modal';
import { Justify } from '@dailydotdev/shared/src/components/utilities';
import { useDndContext } from '@dailydotdev/shared/src/contexts/DndContext';
import { getDefaultLink, dndOption, CustomTime, TimeFormat } from './dnd';
import type { TimeFormat } from './dnd';
import { getDefaultLink, dndOption, CustomTime } from './dnd';

const timeFormatOptions = Object.entries(dndOption).map(([k, v]) => ({
label: v.label,
Expand Down
3 changes: 2 additions & 1 deletion packages/extension/src/newtab/LinksForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { ReactElement, useState } from 'react';
import type { ReactElement } from 'react';
import React, { useState } from 'react';
import { TextField } from '@dailydotdev/shared/src/components/fields/TextField';

const limit = 8;
Expand Down
9 changes: 2 additions & 7 deletions packages/extension/src/newtab/MainFeedPage.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import React, {
ReactElement,
useCallback,
useContext,
useMemo,
useState,
} from 'react';
import type { ReactElement } from 'react';
import React, { useCallback, useContext, useMemo, useState } from 'react';
import MainLayout from '@dailydotdev/shared/src/components/MainLayout';
import MainFeedLayout from '@dailydotdev/shared/src/components/MainFeedLayout';
import ScrollToTopButton from '@dailydotdev/shared/src/components/ScrollToTopButton';
Expand Down
9 changes: 4 additions & 5 deletions packages/extension/src/newtab/MostVisitedSitesModal.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import React, { ReactElement } from 'react';
import type { ReactElement } from 'react';
import React from 'react';
import { LazyImage } from '@dailydotdev/shared/src/components/LazyImage';
import {
Button,
ButtonVariant,
} from '@dailydotdev/shared/src/components/buttons/Button';
import {
Modal,
ModalProps,
} from '@dailydotdev/shared/src/components/modals/common/Modal';
import type { ModalProps } from '@dailydotdev/shared/src/components/modals/common/Modal';
import { Modal } from '@dailydotdev/shared/src/components/modals/common/Modal';
import { Justify } from '@dailydotdev/shared/src/components/utilities';

interface MostVisitedSitesModalProps extends ModalProps {
Expand Down
Loading

0 comments on commit 152ebcc

Please sign in to comment.