Change TS import baseUrl

This commit is contained in:
jeffvli
2022-07-30 17:44:57 -07:00
parent df5f8c08f3
commit bb4576390d
49 changed files with 106 additions and 128 deletions
+5 -6
View File
@@ -1,10 +1,9 @@
import '@testing-library/jest-dom';
// import { render } from '@testing-library/react';
// import { App } from 'renderer/app';
import { render } from '@testing-library/react';
import { App } from '../renderer/app';
describe('App', () => {
// eslint-disable-next-line jest/no-commented-out-tests
// it('should render', () => {
// expect(render(<App />)).toBeTruthy();
// });
it('should render', () => {
expect(render(<App />)).toBeTruthy();
});
});
+1 -1
View File
@@ -1,4 +1,4 @@
import { api } from 'renderer/lib';
import { api } from '../lib';
import { AlbumsResponse, BasePaginationRequest } from './types';
export interface AlbumsRequest extends BasePaginationRequest {
+1 -1
View File
@@ -1,4 +1,4 @@
import { api } from 'renderer/lib';
import { api } from '../lib';
const getServers = async () => {
const { data } = await api.get<any[]>('/servers');
+1 -1
View File
@@ -1,4 +1,4 @@
import { api } from 'renderer/lib';
import { api } from '../lib';
import { UserResponse } from './types';
const getUsers = async () => {
@@ -18,10 +18,10 @@ interface AudioPlayerProps extends ReactPlayerProps {
crossfadeDuration: number;
crossfadeStyle: CrossfadeStyle;
currentPlayer: 1 | 2;
playbackStyle: PlaybackStyle;
player1: Song;
player2: Song;
status: PlayerStatus;
style: PlaybackStyle;
volume: number;
}
@@ -40,7 +40,7 @@ export const AudioPlayer = forwardRef(
(
{
status,
style,
playbackStyle,
crossfadeStyle,
crossfadeDuration,
currentPlayer,
@@ -161,7 +161,9 @@ export const AudioPlayer = forwardRef(
width={0}
onEnded={handleOnEnded}
onProgress={
style === PlaybackStyle.Gapless ? handleGapless1 : handleCrossfade1
playbackStyle === PlaybackStyle.Gapless
? handleGapless1
: handleCrossfade1
}
/>
<ReactPlayer
@@ -175,7 +177,9 @@ export const AudioPlayer = forwardRef(
width={0}
onEnded={handleOnEnded}
onProgress={
style === PlaybackStyle.Gapless ? handleGapless2 : handleCrossfade2
playbackStyle === PlaybackStyle.Gapless
? handleGapless2
: handleCrossfade2
}
/>
</>
+2 -2
View File
@@ -9,8 +9,8 @@ import {
} from '@mantine/core';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import { Font } from 'renderer/styles';
import { textEllipsis } from 'renderer/styles/mixins';
import { Font } from '../../styles';
import { textEllipsis } from '../../styles/mixins';
type MantineTextDivProps = MantineTextProps & ComponentPropsWithoutRef<'div'>;
type MantineTextLinkProps = MantineTextProps & ComponentPropsWithRef<'link'>;
@@ -1,7 +1,7 @@
import { Card, Skeleton } from '@mantine/core';
import { motion } from 'framer-motion';
import styled from 'styled-components';
import { CardRow } from 'renderer/types';
import { CardRow } from '../../types';
import { Text } from '../text/Text';
import { GridCardControls } from './GridCardControls';
@@ -1,8 +1,8 @@
import React from 'react';
import { UnstyledButton, UnstyledButtonProps } from '@mantine/core';
import { motion } from 'framer-motion';
import { RiPlayFill } from 'react-icons/ri';
import styled from 'styled-components';
import { PlayerPlay } from 'tabler-icons-react';
type PlayButtonType = UnstyledButtonProps &
React.ComponentPropsWithoutRef<'button'>;
@@ -81,7 +81,7 @@ export const GridCardControls = ({
});
}}
>
<PlayerPlay />
<RiPlayFill size={25} />
</PlayButton>
</CenterControls>
<BottomControls />
@@ -1,7 +1,7 @@
import { Ref, useMemo } from 'react';
import { FixedSizeList, FixedSizeListProps } from 'react-window';
import { usePlayQueueHandler } from 'renderer/features/player/hooks/usePlayQueueHandler';
import { CardRow } from 'renderer/types';
import { usePlayQueueHandler } from '../../features/player/hooks/usePlayQueueHandler';
import { CardRow } from '../../types';
import { GridCard } from './GridCard';
export const VirtualGridWrapper = ({
@@ -2,7 +2,7 @@ import { useState, useEffect, useRef, useMemo } from 'react';
import debounce from 'lodash/debounce';
import { FixedSizeListProps } from 'react-window';
import InfiniteLoader from 'react-window-infinite-loader';
import { CardRow } from 'renderer/types';
import { CardRow } from '../../types';
import { VirtualGridWrapper } from './VirtualGridWrapper';
interface VirtualGridProps
+3 -3
View File
@@ -1,9 +1,9 @@
import md5 from 'md5';
import { nanoid } from 'nanoid';
import { useMutation, useQuery } from 'react-query';
import { authApi } from 'renderer/api/authApi';
import { queryKeys } from 'renderer/api/queryKeys';
import { useAuthStore } from 'renderer/store';
import { authApi } from '../../../api/authApi';
import { queryKeys } from '../../../api/queryKeys';
import { useAuthStore } from '../../../store';
export const useLogin = (
serverUrl: string,
@@ -1,12 +0,0 @@
import { useQuery } from 'react-query';
import { authApi } from 'renderer/api/authApi';
import { queryKeys } from 'renderer/api/queryKeys';
export const usePingServer = (server: string) => {
return useQuery({
enabled: !!server,
queryFn: () => authApi.ping(server),
queryKey: queryKeys.ping(server),
retry: false,
});
};
@@ -12,7 +12,7 @@ import { useDebouncedValue } from '@mantine/hooks';
import { useTranslation } from 'react-i18next';
import { RiCheckboxCircleFill } from 'react-icons/ri';
import { useSearchParams } from 'react-router-dom';
import { normalizeServerUrl } from 'renderer/utils';
import { normalizeServerUrl } from '../../../utils';
import { useLogin, usePingServer } from '../queries/login';
import styles from './LoginRoute.module.scss';
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
import { motion } from 'framer-motion';
import { Link, LinkProps } from 'react-router-dom';
import styled from 'styled-components';
import { fontGotham } from 'renderer/styles';
import { fontGotham } from '../../../styles';
interface LibraryTabProps extends LinkProps {
children: ReactNode;
@@ -3,12 +3,12 @@ import { useState } from 'react';
import { Button, Group, Menu } from '@mantine/core';
import { useSetState } from '@mantine/hooks';
import AutoSizer from 'react-virtualized-auto-sizer';
import i18n from 'i18n/i18n';
import { albumsApi } from 'renderer/api/albumsApi';
import { VirtualInfiniteGrid } from 'renderer/components/virtual-grid/VirtualInfiniteGrid';
import { AnimatedPage } from 'renderer/features/shared/components/AnimatedPage';
import { AppRoute } from 'renderer/router/utils/routes';
import { Item } from 'types';
import i18n from '../../../../i18n/i18n';
import { Item } from '../../../../types';
import { albumsApi } from '../../../api/albumsApi';
import { VirtualInfiniteGrid } from '../../../components/virtual-grid/VirtualInfiniteGrid';
import { AppRoute } from '../../../router/utils/routes';
import { AnimatedPage } from '../../shared/components/AnimatedPage';
import { ViewType, ViewTypeButton } from '../components/ViewTypeButton';
import { useAlbums } from '../queries/getAlbums';
@@ -1,22 +1,18 @@
/* eslint-disable no-plusplus */
import { useRef } from 'react';
import InfiniteLoader from 'react-window-infinite-loader';
import { AnimatedPage } from 'renderer/features/shared/components/AnimatedPage';
import { AnimatedPage } from '../../shared/components/AnimatedPage';
import { useAlbums } from '../queries/getAlbums';
export const LibraryArtistsRoute = () => {
const infiniteLoaderRef = useRef<InfiniteLoader>(null);
const params = {
orderBy: 'asc',
sortBy: 'title',
};
const { data: albums } = useAlbums({
limit: 0,
page: 0,
skip: 0,
take: 0,
...params,
});
return <AnimatedPage />;
return <AnimatedPage>Temp</AnimatedPage>;
};
@@ -1,6 +1,6 @@
import styled from 'styled-components';
import { AnimatedPage } from 'renderer/features/shared/components/AnimatedPage';
import { AppRoute } from 'renderer/router/utils/routes';
import { AppRoute } from '../../../router/utils/routes';
import { AnimatedPage } from '../../shared/components/AnimatedPage';
import LibraryTab from '../components/LibraryTab';
const TabContainer = styled.div`
@@ -2,18 +2,18 @@ import { useEffect, useMemo, useState } from 'react';
import format from 'format-duration';
import { useTranslation } from 'react-i18next';
import {
RiPlayFill,
RiSkipForwardFill,
RiSkipBackFill,
RiSpeedFill,
RiRewindFill,
RiPauseFill,
RiPlayFill,
RiRewindFill,
RiSkipBackFill,
RiSkipForwardFill,
RiSpeedFill,
} from 'react-icons/ri';
import styled from 'styled-components';
import { Text } from 'renderer/components';
import { usePlayerStore } from 'renderer/store';
import { Font } from 'renderer/styles';
import { PlaybackType, PlayerStatus } from 'types';
import { PlaybackType, PlayerStatus } from '../../../../types';
import { Text } from '../../../components';
import { usePlayerStore } from '../../../store';
import { Font } from '../../../styles';
import { useCenterControls } from '../hooks/useCenterControls';
import { PlayerButton } from './PlayerButton';
import { Slider } from './Slider';
@@ -1,8 +1,8 @@
import { LazyLoadImage as Image } from 'react-lazy-load-image-component';
import styled from 'styled-components';
import { Text } from 'renderer/components';
import { usePlayerStore } from 'renderer/store';
import { Font } from 'renderer/styles';
import { Text } from '../../../components';
import { usePlayerStore } from '../../../store';
import { Font } from '../../../styles';
const LeftControlsContainer = styled.div`
display: flex;
@@ -6,7 +6,7 @@ import {
} from '@mantine/core';
import { motion } from 'framer-motion';
import styled, { css } from 'styled-components';
import { Tooltip } from 'renderer/components';
import { Tooltip } from '../../../components';
type MantineButtonProps = UnstyledButtonProps &
ComponentPropsWithoutRef<'button'>;
@@ -1,8 +1,8 @@
import { useRef } from 'react';
import styled from 'styled-components';
import { AudioPlayer } from 'renderer/components';
import { usePlayerStore } from 'renderer/store';
import { PlaybackType } from 'types';
import { PlaybackType } from '../../../../types';
import { AudioPlayer } from '../../../components';
import { usePlayerStore } from '../../../store';
import { CenterControls } from './CenterControls';
import { LeftControls } from './LeftControls';
import { RightControls } from './RightControls';
@@ -1,7 +1,7 @@
import { RiVolumeUpFill, RiVolumeMuteFill } from 'react-icons/ri';
import styled from 'styled-components';
import { IconButton } from 'renderer/components';
import { usePlayerStore } from 'renderer/store';
import { IconButton } from '../../../components';
import { usePlayerStore } from '../../../store';
import { useRightControls } from '../hooks/useRightControls';
import { Slider } from './Slider';
@@ -1,6 +1,6 @@
import { useCallback } from 'react';
import { usePlayerStore } from 'renderer/store';
import { PlaybackType, PlayerStatus } from '../../../../types';
import { usePlayerStore } from '../../../store';
import { mpvPlayer } from '../utils/mpvPlayer';
export const useCenterControls = (args: { playersRef: any }) => {
@@ -1,11 +1,11 @@
import { useQueryClient } from 'react-query';
import { usePlayerStore } from 'renderer/store';
import { Item, Play } from '../../../../types';
import { usePlayerStore } from '../../../store';
import {
getJellyfinStreamUrl,
getServerFolderAuth,
getSubsonicStreamUrl,
} from 'renderer/utils';
import { Item, Play } from 'types';
} from '../../../utils';
import { mpvPlayer } from '../utils/mpvPlayer';
const getEndpoint = (item: Item) => {
@@ -1,5 +1,5 @@
import { useEffect } from 'react';
import { usePlayerStore } from 'renderer/store';
import { usePlayerStore } from '../../../store';
import { mpvPlayer } from '../utils/mpvPlayer';
export const useRightControls = () => {
@@ -35,7 +35,7 @@ export const AddServerModal = ({ ...rest }: ModalProps) => {
const res = await validateServer(values);
if (res?.token) {
createServerMutation.mutateAsync({
createServerMutation.mutate({
...values,
remoteUserId: res.userId,
token: res.token,
@@ -9,7 +9,7 @@ import {
} from '@mantine/core';
import { useForm } from '@mantine/form';
import { useTranslation } from 'react-i18next';
import { ServerResponse } from 'renderer/api/types';
import { ServerResponse } from '../../../api/types';
interface EditServerModalProps extends ModalProps {
server: ServerResponse | undefined;
@@ -1,8 +1,7 @@
import { useEffect, useState } from 'react';
import { Text } from '@mantine/core';
import { Button, Text } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';
import { ServerResponse } from 'renderer/api/types';
import { IconButton } from 'renderer/components';
import { ServerResponse } from '../../../api/types';
import { useServers } from '../queries/useServers';
import { EditServerModal } from './EditServerModal';
import styles from './ServerList.module.scss';
@@ -60,9 +59,7 @@ export const ServerList = () => {
{server.name}
<Text>Hello</Text>
</div>
<IconButton onClick={() => editServerHandlers.toggle()}>
Edit
</IconButton>
<Button onClick={() => editServerHandlers.toggle()}>Edit</Button>
</div>
{selectedServer && (
<EditServerModal
@@ -1,8 +1,8 @@
import axios from 'axios';
import md5 from 'md5';
import { useMutation } from 'react-query';
import { serversApi } from 'renderer/api/serversApi';
import { randomString } from 'renderer/utils';
import { serversApi } from '../../../api/serversApi';
import { randomString } from '../../../utils';
export const validateServer = async (options: {
legacyAuth: boolean;
@@ -1,9 +1,9 @@
import md5 from 'md5';
import { useQuery } from 'react-query';
import { queryKeys } from 'renderer/api/queryKeys';
import { serversApi } from 'renderer/api/serversApi';
import { ServerFolderResponse } from 'renderer/api/types';
import { ServerFolderAuth } from 'types';
import { ServerFolderAuth } from '../../../../types';
import { queryKeys } from '../../../api/queryKeys';
import { serversApi } from '../../../api/serversApi';
import { ServerFolderResponse } from '../../../api/types';
export const useServers = () => {
return useQuery({
@@ -1,11 +1,11 @@
import isElectron from 'is-electron';
import { PlayerState } from 'renderer/store';
import {
CrossfadeStyle,
PlaybackStyle,
PlaybackType,
PlayerRepeat,
} from 'types';
} from '../../../../types';
import { PlayerState } from '../../../store';
export interface WebSettings {
player: PlayerSettings;
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
import { motion } from 'framer-motion';
import { Link, LinkProps } from 'react-router-dom';
import styled, { css } from 'styled-components';
import { fontInter } from 'renderer/styles';
import { fontInter } from '../../../styles';
interface ListItemProps {
children: ReactNode;
@@ -4,7 +4,7 @@ import {
RiSearch2Fill,
} from 'react-icons/ri';
import styled from 'styled-components';
import { AppRoute } from 'renderer/router/utils/routes';
import { AppRoute } from '../../../router/utils/routes';
import { ListItem } from './ListItem';
const StyledSidebar = styled.div``;
@@ -3,8 +3,8 @@ import { Group } from '@mantine/core';
import { RiArrowLeftSLine, RiArrowRightSLine } from 'react-icons/ri';
import { useNavigate } from 'react-router-dom';
import styled from 'styled-components';
import { IconButton } from 'renderer/components';
import { WindowControls } from 'renderer/features/window-controls';
import { IconButton } from '../../../components';
import { WindowControls } from '../../window-controls';
interface TitlebarProps {
children?: ReactNode;
@@ -2,8 +2,8 @@ import { Button, Menu } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';
import { RiLogoutBoxLine, RiServerFill, RiSettings3Fill } from 'react-icons/ri';
import { useNavigate } from 'react-router';
import { AddServerModal } from 'renderer/features/servers';
import { useAuthStore } from 'renderer/store';
import { useAuthStore } from '../../../store';
import { AddServerModal } from '../../servers';
export const UserMenu = () => {
const navigate = useNavigate();
-1
View File
@@ -1 +0,0 @@
export * from './UserMenu';
+1 -1
View File
@@ -1,7 +1,7 @@
import { createRoot } from 'react-dom/client';
import { I18nextProvider } from 'react-i18next';
import { QueryClientProvider } from 'react-query';
import i18n from 'i18n/i18n';
import i18n from '../i18n/i18n';
import { App } from './app';
import { queryClient } from './lib';
+1 -1
View File
@@ -1,6 +1,6 @@
import { Outlet } from 'react-router-dom';
import styled from 'styled-components';
import { Titlebar } from 'renderer/features/titlebar';
import { Titlebar } from '../../features/titlebar';
const WindowsTitlebarContainer = styled.div`
position: absolute;
@@ -2,9 +2,9 @@ import { AnimatePresence } from 'framer-motion';
import { Outlet, useLocation } from 'react-router-dom';
import * as Space from 'react-spaces';
import styled from 'styled-components';
import { Playerbar } from 'renderer/features/player';
import { Sidebar } from 'renderer/features/sidebar';
import { Titlebar } from 'renderer/features/titlebar';
import { Playerbar } from '../../features/player';
import { Sidebar } from '../../features/sidebar';
import { Titlebar } from '../../features/titlebar';
const LayoutContainer = styled(Space.ViewPort)``;
@@ -22,9 +22,7 @@ const TitlebarContainer = styled(Space.Top)`
border-bottom: var(--playerbar-border-top);
`;
const ContentContainer = styled(Space.Fill)`
padding: 1rem;
`;
const ContentContainer = styled(Space.Fill)``;
const PlayerbarContainer = styled(Space.Bottom)``;
@@ -54,7 +52,7 @@ export const DefaultLayout = () => {
return (
<>
<LayoutContainer>
<TitlebarContainer size={40}>
<TitlebarContainer size={30}>
<Titlebar />
</TitlebarContainer>
<Space.Fill>
@@ -75,7 +73,7 @@ export const DefaultLayout = () => {
maximumSize={400}
size={300}
/>
<Space.Fill>
<Space.Fill scrollable>
<AnimatePresence exitBeforeEnter>
<ContentContainer key={location.pathname}>
<Outlet />
+1 -1
View File
@@ -1,6 +1,6 @@
/* eslint-disable no-underscore-dangle */
import Axios from 'axios';
import { authApi } from 'renderer/api/authApi';
import { authApi } from '../api/authApi';
export const api = Axios.create({
headers: {
+6 -6
View File
@@ -1,11 +1,11 @@
/* eslint-disable sort-keys-fix/sort-keys-fix */
import { Routes, Route } from 'react-router-dom';
import { LoginRoute } from 'renderer/features/auth';
import { DashboardRoute } from 'renderer/features/dashboard';
import { LibraryAlbumsRoute } from 'renderer/features/library/routes/LibraryAlbumsRoute';
import { LibraryArtistsRoute } from 'renderer/features/library/routes/LibraryArtistsRoute';
import { LibraryRoute } from 'renderer/features/library/routes/LibraryRoute';
import { ServersRoute } from 'renderer/features/servers';
import { LoginRoute } from '../features/auth';
import { DashboardRoute } from '../features/dashboard';
import { LibraryAlbumsRoute } from '../features/library/routes/LibraryAlbumsRoute';
import { LibraryArtistsRoute } from '../features/library/routes/LibraryArtistsRoute';
import { LibraryRoute } from '../features/library/routes/LibraryRoute';
import { ServersRoute } from '../features/servers';
import { AuthLayout, DefaultLayout } from '../layouts';
import { AuthOutlet } from './outlets/AuthOutlet';
import { PrivateOutlet } from './outlets/PrivateOutlet';
+1 -1
View File
@@ -1,5 +1,5 @@
import { Navigate, Outlet, useLocation } from 'react-router-dom';
import { useAuthStore } from 'renderer/store';
import { useAuthStore } from '../../store';
interface AuthOutletProps {
redirectTo: string;
@@ -1,5 +1,5 @@
import { Navigate, Outlet, useLocation } from 'react-router-dom';
import { useAuthStore } from 'renderer/store';
import { useAuthStore } from '../../store';
interface PrivateOutletProps {
redirectTo: string;
+1 -1
View File
@@ -1,6 +1,6 @@
import create from 'zustand';
import { devtools } from 'zustand/middleware';
import { Platform } from 'types';
import { Platform } from '../../types';
export interface AppState {
currentPage: {
+2 -2
View File
@@ -2,7 +2,6 @@
import produce from 'immer';
import create from 'zustand';
import { devtools } from 'zustand/middleware';
import { setLocalStorageSettings } from 'renderer/utils';
import {
CrossfadeStyle,
PlaybackStyle,
@@ -10,7 +9,8 @@ import {
PlayerRepeat,
PlayerStatus,
Song,
} from 'types';
} from '../../types';
import { setLocalStorageSettings } from '../utils';
export interface PlayerState {
current: {
+1 -2
View File
@@ -1,5 +1,4 @@
import { Song } from 'renderer/api/types';
// import { ServerFolderAuth } from 'renderer/features/servers';
import { Song } from '../api/types';
export const getJellyfinStreamUrl = (
auth: any,
+1 -1
View File
@@ -1,5 +1,5 @@
import md5 from 'md5';
import { ServerFolderAuth } from 'types';
import { ServerFolderAuth } from '../../types';
export const getServerFolderAuth = (
serverUrl: string,
+1 -2
View File
@@ -1,5 +1,4 @@
import { Song } from 'renderer/api/types';
// import { ServerFolderAuth } from 'renderer/features/servers';
import { Song } from '../api/types';
export const getSubsonicStreamUrl = (
auth: any,
-1
View File
@@ -9,7 +9,6 @@
"strict": true,
"pretty": true,
"sourceMap": true,
"baseUrl": "./src",
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,