Skip to content

Commit

Permalink
♻️ (common) migrating to specific common component import paths (#1418)
Browse files Browse the repository at this point in the history
Just moving away from the barrel `common` export to a bit more specific
imports.

Part 1 of the migration (other imports to follow in other PRs).
  • Loading branch information
MatissJanis authored Jul 30, 2023
1 parent 61d7074 commit 60e5f1a
Show file tree
Hide file tree
Showing 42 changed files with 184 additions and 203 deletions.
6 changes: 5 additions & 1 deletion packages/desktop-client/src/components/LoggedInUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ import { useSelector } from 'react-redux';
import { useActions } from '../hooks/useActions';
import { colors, styles } from '../style';

import { View, Text, Button, Tooltip, Menu } from './common';
import Button from './common/Button';
import Menu from './common/Menu';
import Text from './common/Text';
import View from './common/View';
import { useServerURL } from './ServerContext';
import { Tooltip } from './tooltips';

export default function LoggedInUser({ hideIfNoServer, style, color }) {
let userData = useSelector(state => state.userData);
Expand Down
5 changes: 4 additions & 1 deletion packages/desktop-client/src/components/NotesButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import { send } from 'loot-core/src/platform/client/fetch';
import CustomNotesPaper from '../icons/v2/CustomNotesPaper';
import { colors } from '../style';

import { View, Button, Tooltip, useTooltip, Text } from './common';
import Button from './common/Button';
import Text from './common/Text';
import View from './common/View';
import { Tooltip, useTooltip } from './tooltips';

type NotesTooltipProps = {
editable?: boolean;
Expand Down
7 changes: 6 additions & 1 deletion packages/desktop-client/src/components/SidebarWithData.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import { useActions } from '../hooks/useActions';
import ExpandArrow from '../icons/v0/ExpandArrow';
import { styles, colors } from '../style';

import { Button, Input, InitialFocus, Text, Tooltip, Menu } from './common';
import Button from './common/Button';
import InitialFocus from './common/InitialFocus';
import Input from './common/Input';
import Menu from './common/Menu';
import Text from './common/Text';
import { Sidebar } from './sidebar';
import { Tooltip } from './tooltips';

function EditableBudgetName({ prefs, savePrefs }) {
let dispatch = useDispatch();
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/Titlebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import {
ButtonLink,
Button,
ButtonWithLoading,
Tooltip,
ExternalLink,
} from './common';
import Paragraph from './common/Paragraph';
Expand All @@ -43,6 +42,7 @@ import LoggedInUser from './LoggedInUser';
import { useServerURL } from './ServerContext';
import useSheetValue from './spreadsheet/useSheetValue';
import { ThemeSelector } from './ThemeSelector';
import { Tooltip } from './tooltips';

export let TitlebarContext = createContext();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { authorizeBank } from '../../gocardless';
import { useActions } from '../../hooks/useActions';
import ExclamationOutline from '../../icons/v1/ExclamationOutline';
import { colors } from '../../style';
import { View, Button, Tooltip, ExternalLink } from '../common';
import { ExternalLink } from '../common';
import Button from '../common/Button';
import View from '../common/View';
import { Tooltip } from '../tooltips';

function getErrorMessage(type, code) {
switch (type.toUpperCase()) {
Expand Down
20 changes: 9 additions & 11 deletions packages/desktop-client/src/components/accounts/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ import SvgRemove from '../../icons/v2/Remove';
import SearchAlternate from '../../icons/v2/SearchAlternate';
import { styles, colors } from '../../style';
import AnimatedRefresh from '../AnimatedRefresh';
import {
View,
Button,
MenuButton,
MenuTooltip,
Input,
InputWithContent,
InitialFocus,
Menu,
Stack,
} from '../common';
import Button from '../common/Button';
import InitialFocus from '../common/InitialFocus';
import Input from '../common/Input';
import InputWithContent from '../common/InputWithContent';
import Menu from '../common/Menu';
import MenuButton from '../common/MenuButton';
import MenuTooltip from '../common/MenuTooltip';
import Stack from '../common/Stack';
import View from '../common/View';
import { FilterButton } from '../filters/FiltersMenu';
import { FiltersStack } from '../filters/SavedFilters';
import { KeyHandlers } from '../KeyHandlers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import Add from '../../icons/v1/Add';
import CheveronLeft from '../../icons/v1/CheveronLeft';
import SearchAlternate from '../../icons/v2/SearchAlternate';
import { colors, styles } from '../../style';
import { Button, InputWithContent, Label, View } from '../common';
import Button from '../common/Button';
import InputWithContent from '../common/InputWithContent';
import Label from '../common/Label';
import Text from '../common/Text';
import View from '../common/View';
import CellValue from '../spreadsheet/CellValue';
import { TransactionList } from '../transactions/MobileTransaction';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import * as queries from 'loot-core/src/client/queries';
import { useActions } from '../../hooks/useActions';
import { useSetThemeColor } from '../../hooks/useSetThemeColor';
import { colors, styles } from '../../style';
import { Button, Text, TextOneLine, View } from '../common';
import Button from '../common/Button';
import Text from '../common/Text';
import TextOneLine from '../common/TextOneLine';
import View from '../common/View';
import { Page } from '../Page';
import CellValue from '../spreadsheet/CellValue';

Expand Down
3 changes: 2 additions & 1 deletion packages/desktop-client/src/components/accounts/Reconcile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { currencyToInteger } from 'loot-core/src/shared/util';

import CheckCircle1 from '../../icons/v2/CheckCircle1';
import { styles, colors } from '../../style';
import { View, Text, Button, Input, InitialFocus, Tooltip } from '../common';
import { View, Text, Button, Input, InitialFocus } from '../common';
import format from '../spreadsheet/format';
import useSheetValue from '../spreadsheet/useSheetValue';
import { Tooltip } from '../tooltips';

export function ReconcilingMessage({
balanceQuery,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import { type CSSProperties, css } from 'glamor';

import Remove from '../../icons/v2/Remove';
import { colors } from '../../style';
import { View, Input, Tooltip, Button } from '../common';
import Button from '../common/Button';
import Input from '../common/Input';
import View from '../common/View';
import { Tooltip } from '../tooltips';

const inst: { lastChangeType? } = {};

Expand Down
10 changes: 2 additions & 8 deletions packages/desktop-client/src/components/budget/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@ import ExpandArrow from '../../icons/v0/ExpandArrow';
import CheveronDown from '../../icons/v1/CheveronDown';
import DotsHorizontalTriple from '../../icons/v1/DotsHorizontalTriple';
import { styles, colors } from '../../style';
import {
View,
Text,
Button,
Tooltip,
Menu,
IntersectionBoundary,
} from '../common';
import { View, Text, Button, Menu } from '../common';
import NotesButton from '../NotesButton';
import {
useDraggable,
Expand All @@ -30,6 +23,7 @@ import {
} from '../sort';
import NamespaceContext from '../spreadsheet/NamespaceContext';
import { Row, InputCell, ROW_HEIGHT } from '../table';
import { Tooltip, IntersectionBoundary } from '../tooltips';

import BudgetSummaries from './BudgetSummaries';
import { INCOME_HEADER_HEIGHT, MONTH_BOX_SHADOW } from './constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,20 @@ import DotsHorizontalTriple from '../../../icons/v1/DotsHorizontalTriple';
import ArrowButtonDown1 from '../../../icons/v2/ArrowButtonDown1';
import ArrowButtonUp1 from '../../../icons/v2/ArrowButtonUp1';
import { colors, styles } from '../../../style';
import {
View,
Text,
Button,
Tooltip,
Menu,
Stack,
HoverTarget,
AlignedText,
} from '../../common';
import AlignedText from '../../common/AlignedText';
import Button from '../../common/Button';
import HoverTarget from '../../common/HoverTarget';
import Menu from '../../common/Menu';
import Stack from '../../common/Stack';
import Text from '../../common/Text';
import View from '../../common/View';
import NotesButton from '../../NotesButton';
import PrivacyFilter from '../../PrivacyFilter';
import CellValue from '../../spreadsheet/CellValue';
import format from '../../spreadsheet/format';
import NamespaceContext from '../../spreadsheet/NamespaceContext';
import useSheetValue from '../../spreadsheet/useSheetValue';
import { Tooltip } from '../../tooltips';
import { MONTH_BOX_SHADOW } from '../constants';
import { makeAmountFullStyle } from '../util';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util';
import useFeatureFlag from '../../../hooks/useFeatureFlag';
import CheveronDown from '../../../icons/v1/CheveronDown';
import { styles, colors } from '../../../style';
import { Button, View, Text, Tooltip, Menu, useTooltip } from '../../common';
import Button from '../../common/Button';
import Menu from '../../common/Menu';
import Text from '../../common/Text';
import View from '../../common/View';
import CellValue from '../../spreadsheet/CellValue';
import format from '../../spreadsheet/format';
import useSheetValue from '../../spreadsheet/useSheetValue';
import { Field, SheetCell } from '../../table';
import { Tooltip, useTooltip } from '../../tooltips';
import BalanceWithCarryover from '../BalanceWithCarryover';
import { MONTH_RIGHT_PADDING } from '../constants';
import { makeAmountGrey } from '../util';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@ import DotsHorizontalTriple from '../../../icons/v1/DotsHorizontalTriple';
import ArrowButtonDown1 from '../../../icons/v2/ArrowButtonDown1';
import ArrowButtonUp1 from '../../../icons/v2/ArrowButtonUp1';
import { colors, styles } from '../../../style';
import {
View,
Block,
Button,
Tooltip,
Menu,
HoverTarget,
AlignedText,
} from '../../common';
import AlignedText from '../../common/AlignedText';
import Block from '../../common/Block';
import Button from '../../common/Button';
import HoverTarget from '../../common/HoverTarget';
import Menu from '../../common/Menu';
import View from '../../common/View';
import NotesButton from '../../NotesButton';
import PrivacyFilter from '../../PrivacyFilter';
import CellValue from '../../spreadsheet/CellValue';
import format from '../../spreadsheet/format';
import NamespaceContext from '../../spreadsheet/NamespaceContext';
import useSheetName from '../../spreadsheet/useSheetName';
import useSheetValue from '../../spreadsheet/useSheetValue';
import { Tooltip } from '../../tooltips';
import { MONTH_BOX_SHADOW } from '../constants';

import HoldTooltip from './HoldTooltip';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ import { useSpreadsheet } from 'loot-core/src/client/SpreadsheetProvider';
import evalArithmetic from 'loot-core/src/shared/arithmetic';
import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util';

import { View, Button, Tooltip, InitialFocus, Input } from '../../common';
import Button from '../../common/Button';
import InitialFocus from '../../common/InitialFocus';
import Input from '../../common/Input';
import View from '../../common/View';
import NamespaceContext from '../../spreadsheet/NamespaceContext';
import { Tooltip } from '../../tooltips';

type HoldTooltipProps = {
onSubmit: (amount: number) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ import evalArithmetic from 'loot-core/src/shared/arithmetic';
import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util';

import CategoryAutocomplete from '../../autocomplete/CategorySelect';
import { View, Button, Tooltip, InitialFocus, Input } from '../../common';
import Button from '../../common/Button';
import InitialFocus from '../../common/InitialFocus';
import Input from '../../common/Input';
import View from '../../common/View';
import NamespaceContext from '../../spreadsheet/NamespaceContext';
import { Tooltip } from '../../tooltips';
import { addToBeBudgetedGroup, CategoryGroupsContext } from '../util';

type TransferTooltipProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ import useFeatureFlag from '../../../hooks/useFeatureFlag';
import CheveronDown from '../../../icons/v1/CheveronDown';
import { styles, colors } from '../../../style';
import CategoryAutocomplete from '../../autocomplete/CategorySelect';
import {
View,
Text,
useTooltip,
InitialFocus,
Tooltip,
Button,
Menu,
} from '../../common';
import Button from '../../common/Button';
import InitialFocus from '../../common/InitialFocus';
import Menu from '../../common/Menu';
import Text from '../../common/Text';
import View from '../../common/View';
import CellValue from '../../spreadsheet/CellValue';
import format from '../../spreadsheet/format';
import useSheetValue from '../../spreadsheet/useSheetValue';
import { Row, Field, SheetCell } from '../../table';
import { Tooltip, useTooltip } from '../../tooltips';
import BalanceWithCarryover from '../BalanceWithCarryover';
import { MONTH_RIGHT_PADDING } from '../constants';
import {
Expand Down
14 changes: 1 addition & 13 deletions packages/desktop-client/src/components/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,18 @@ import { colors } from '../style';

import Button from './common/Button';

export { default as AlignedText } from './common/AlignedText';
export { default as AnchorLink } from './common/AnchorLink';
export { default as Block } from './common/Block';
export { default as Button, ButtonWithLoading } from './common/Button';
export { default as Card } from './common/Card';
export { default as Select } from './common/Select';
export { default as FormError } from './common/FormError';
export { default as HoverTarget } from './common/HoverTarget';
export { default as InitialFocus } from './common/InitialFocus';
export { default as InlineField } from './common/InlineField';
export { default as Input } from './common/Input';
export { default as InputWithContent } from './common/InputWithContent';
export { default as Label } from './common/Label';
export { default as Menu } from './common/Menu';
export { default as MenuButton } from './common/MenuButton';
export { default as MenuTooltip } from './common/MenuTooltip';
export { default as Modal, ModalButtons } from './common/Modal';
export { default as Search } from './common/Search';
export { default as Stack } from './Stack';
export { default as Stack } from './common/Stack';
export { default as Text } from './common/Text';
export { default as TextOneLine } from './common/TextOneLine';
export { default as View } from './common/View';
export { default as LinkButton } from './common/LinkButton';

Expand Down Expand Up @@ -84,6 +75,3 @@ export function ButtonLink({
/>
);
}

export * from './tooltips';
export { useTooltip } from './tooltips';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { Tooltip } from '../common';
import { Tooltip } from '../tooltips';

export default function MenuTooltip({ width, onClose, children }) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import React, {
type ReactNode,
} from 'react';

import Text from './common/Text';
import View from './common/View';
import Text from './Text';
import View from './View';

function getChildren(key, children) {
return Children.toArray(children).reduce((list, child) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ import { titleFirst } from 'loot-core/src/shared/util';
import DeleteIcon from '../../icons/v0/Delete';
import SettingsSliderAlternate from '../../icons/v2/SettingsSliderAlternate';
import { colors } from '../../style';
import { View, Text, Tooltip, Stack, Button, Menu, Select } from '../common';
import Button from '../common/Button';
import Menu from '../common/Menu';
import Select from '../common/Select';
import Stack from '../common/Stack';
import Text from '../common/Text';
import View from '../common/View';
import { Value } from '../ManageRules';
import { Tooltip } from '../tooltips';
import GenericInput from '../util/GenericInput';

import { CondOpMenu } from './SavedFilters';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import { send, sendCatch } from 'loot-core/src/platform/client/fetch';

import ExpandArrow from '../../icons/v0/ExpandArrow';
import { colors } from '../../style';
import { View, Text, Button, Menu, MenuTooltip, Stack } from '../common';
import Button from '../common/Button';
import Menu from '../common/Menu';
import MenuTooltip from '../common/MenuTooltip';
import Stack from '../common/Stack';
import Text from '../common/Text';
import View from '../common/View';
import { FormField, FormLabel } from '../forms';
import { FieldSelect } from '../modals/EditRule';
import GenericInput from '../util/GenericInput';
Expand Down
3 changes: 2 additions & 1 deletion packages/desktop-client/src/components/manager/BudgetList.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import Key from '../../icons/v2/Key';
import RefreshArrow from '../../icons/v2/RefreshArrow';
import { styles, colors } from '../../style';
import tokens from '../../tokens';
import { View, Text, Button, Tooltip, Menu } from '../common';
import { View, Text, Button, Menu } from '../common';
import { Tooltip } from '../tooltips';

function getFileDescription(file) {
if (file.state === 'unknown') {
Expand Down
Loading

0 comments on commit 60e5f1a

Please sign in to comment.