diff --git a/.eslintrc.js b/.eslintrc.js index d86d237..4829fca 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,5 +5,6 @@ module.exports = { 'react-native/no-inline-styles': 0, radix: 0, '@typescript-eslint/no-unused-vars': ['warn'], + semi: 0, }, -}; +} diff --git a/.prettierrc.js b/.prettierrc.js index c026d20..ed7187a 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -5,4 +5,5 @@ module.exports = { trailingComma: 'all', arrowParens: 'avoid', printWidth: 120, -}; + semi: false, +} diff --git a/App.tsx b/App.tsx index fc046c1..caba2ea 100644 --- a/App.tsx +++ b/App.tsx @@ -1,14 +1,14 @@ -import React from 'react'; -import { DarkTheme, NavigationContainer } from '@react-navigation/native'; -import SplashPage from './src/components/SplashPage'; -import RootNavigator from './src/components/navigation/RootNavigator'; -import { Provider } from 'jotai'; -import { StatusBar, View } from 'react-native'; -import colors from './src/styles/colors'; -import TrackPlayerState from './src/components/TrackPlayerState'; +import React from 'react' +import { DarkTheme, NavigationContainer } from '@react-navigation/native' +import SplashPage from './src/components/SplashPage' +import RootNavigator from './src/components/navigation/RootNavigator' +import { Provider } from 'jotai' +import { StatusBar, View } from 'react-native' +import colors from './src/styles/colors' +import TrackPlayerState from './src/components/TrackPlayerState' -const theme = { ...DarkTheme }; -theme.colors.background = colors.gradient.high; +const theme = { ...DarkTheme } +theme.colors.background = colors.gradient.high const App = () => ( @@ -22,6 +22,6 @@ const App = () => ( -); +) -export default App; +export default App diff --git a/__tests__/App-test.tsx b/__tests__/App-test.tsx index 1784766..351e770 100644 --- a/__tests__/App-test.tsx +++ b/__tests__/App-test.tsx @@ -2,13 +2,13 @@ * @format */ -import 'react-native'; -import React from 'react'; -import App from '../App'; +import 'react-native' +import React from 'react' +import App from '../App' // Note: test renderer must be required after react-native. -import renderer from 'react-test-renderer'; +import renderer from 'react-test-renderer' it('renders correctly', () => { - renderer.create(); -}); + renderer.create() +}) diff --git a/babel.config.js b/babel.config.js index d6be578..5d45acd 100644 --- a/babel.config.js +++ b/babel.config.js @@ -4,4 +4,4 @@ module.exports = { // reanimated has to be listed last in plugins 'react-native-reanimated/plugin', ], -}; +} diff --git a/index.js b/index.js index a3ee640..5d85b86 100644 --- a/index.js +++ b/index.js @@ -1,19 +1,19 @@ -import 'react-native-gesture-handler'; -import 'react-native-get-random-values'; +import 'react-native-gesture-handler' +import 'react-native-get-random-values' -import { enableScreens } from 'react-native-screens'; -enableScreens(); +import { enableScreens } from 'react-native-screens' +enableScreens() -import { AppRegistry } from 'react-native'; -import App from './App'; -import { name as appName } from './app.json'; -import TrackPlayer, { Capability } from 'react-native-track-player'; +import { AppRegistry } from 'react-native' +import App from './App' +import { name as appName } from './app.json' +import TrackPlayer, { Capability } from 'react-native-track-player' -AppRegistry.registerComponent(appName, () => App); -TrackPlayer.registerPlaybackService(() => require('./src/playback/service')); +AppRegistry.registerComponent(appName, () => App) +TrackPlayer.registerPlaybackService(() => require('./src/playback/service')) async function start() { - await TrackPlayer.setupPlayer(); + await TrackPlayer.setupPlayer() await TrackPlayer.updateOptions({ capabilities: [ Capability.Play, @@ -23,6 +23,6 @@ async function start() { Capability.SkipToPrevious, ], compactCapabilities: [Capability.Play, Capability.Pause, Capability.SkipToNext, Capability.SkipToPrevious], - }); + }) } -start(); +start() diff --git a/metro.config.js b/metro.config.js index e91aba9..c81b3ca 100644 --- a/metro.config.js +++ b/metro.config.js @@ -14,4 +14,4 @@ module.exports = { }, }), }, -}; +} diff --git a/react-native.config.js b/react-native.config.js index ef09f5b..be7d438 100644 --- a/react-native.config.js +++ b/react-native.config.js @@ -4,4 +4,4 @@ module.exports = { android: {}, }, assets: ['./assets/fonts'], -}; +} diff --git a/src/components/ArtistsList.tsx b/src/components/ArtistsList.tsx index 8715682..7b43c45 100644 --- a/src/components/ArtistsList.tsx +++ b/src/components/ArtistsList.tsx @@ -1,8 +1,8 @@ -import React from 'react'; -import { FlatList, Text, View } from 'react-native'; -import { useAtomValue } from 'jotai/utils'; -import { Artist } from '../models/music'; -import { artistsAtom } from '../state/music'; +import React from 'react' +import { FlatList, Text, View } from 'react-native' +import { useAtomValue } from 'jotai/utils' +import { Artist } from '../models/music' +import { artistsAtom } from '../state/music' const ArtistItem: React.FC<{ item: Artist }> = ({ item }) => ( @@ -15,15 +15,15 @@ const ArtistItem: React.FC<{ item: Artist }> = ({ item }) => ( {item.name} -); +) const List = () => { - const artists = useAtomValue(artistsAtom); + const artists = useAtomValue(artistsAtom) - const renderItem: React.FC<{ item: Artist }> = ({ item }) => ; + const renderItem: React.FC<{ item: Artist }> = ({ item }) => - return item.id} />; -}; + return item.id} /> +} const ArtistsList = () => ( @@ -31,6 +31,6 @@ const ArtistsList = () => ( -); +) -export default ArtistsList; +export default ArtistsList diff --git a/src/components/FocusableIcon.tsx b/src/components/FocusableIcon.tsx index 658add3..f65b61a 100644 --- a/src/components/FocusableIcon.tsx +++ b/src/components/FocusableIcon.tsx @@ -1,19 +1,19 @@ -import React from 'react'; -import { Image, ImageSourcePropType } from 'react-native'; -import colors from '../styles/colors'; +import React from 'react' +import { Image, ImageSourcePropType } from 'react-native' +import colors from '../styles/colors' export type FocusableIconProps = { - focused: boolean; - source: ImageSourcePropType; - focusedSource?: ImageSourcePropType; - width?: number; - height?: number; -}; + focused: boolean + source: ImageSourcePropType + focusedSource?: ImageSourcePropType + width?: number + height?: number +} const FocusableIcon: React.FC = props => { - props.focusedSource = props.focusedSource || props.source; - props.width = props.width || 26; - props.height = props.height || 26; + props.focusedSource = props.focusedSource || props.source + props.width = props.width || 26 + props.height = props.height || 26 return ( = props => { }} source={props.focused ? props.focusedSource : props.source} /> - ); -}; + ) +} -export default FocusableIcon; +export default FocusableIcon diff --git a/src/components/NowPlayingLayout.tsx b/src/components/NowPlayingLayout.tsx index ae4e679..f466838 100644 --- a/src/components/NowPlayingLayout.tsx +++ b/src/components/NowPlayingLayout.tsx @@ -1,15 +1,15 @@ -import { useAtomValue } from 'jotai/utils'; -import React from 'react'; -import { Pressable, StatusBar, StyleSheet, Text, useWindowDimensions, View } from 'react-native'; -import FastImage from 'react-native-fast-image'; -import TrackPlayer, { State } from 'react-native-track-player'; -import { currentQueueNameAtom, currentTrackAtom, playerStateAtom } from '../state/trackplayer'; -import text from '../styles/text'; -import CoverArt from './common/CoverArt'; -import ImageGradientBackground from './common/ImageGradientBackground'; +import { useAtomValue } from 'jotai/utils' +import React from 'react' +import { Pressable, StatusBar, StyleSheet, Text, useWindowDimensions, View } from 'react-native' +import FastImage from 'react-native-fast-image' +import TrackPlayer, { State } from 'react-native-track-player' +import { currentQueueNameAtom, currentTrackAtom, playerStateAtom } from '../state/trackplayer' +import text from '../styles/text' +import CoverArt from './common/CoverArt' +import ImageGradientBackground from './common/ImageGradientBackground' const NowPlayingHeader = () => { - const queueName = useAtomValue(currentQueueNameAtom); + const queueName = useAtomValue(currentQueueNameAtom) return ( @@ -19,8 +19,8 @@ const NowPlayingHeader = () => { - ); -}; + ) +} const headerStyles = StyleSheet.create({ container: { @@ -38,13 +38,13 @@ const headerStyles = StyleSheet.create({ queueName: { ...text.paragraph, }, -}); +}) const SongCoverArt = () => { - const track = useAtomValue(currentTrackAtom); - const layout = useWindowDimensions(); + const track = useAtomValue(currentTrackAtom) + const layout = useWindowDimensions() - const size = layout.width - layout.width / 7; + const size = layout.width - layout.width / 7 return ( @@ -55,8 +55,8 @@ const SongCoverArt = () => { coverArtUri={track?.artwork as string} /> - ); -}; + ) +} const coverArtStyles = StyleSheet.create({ container: { @@ -64,18 +64,18 @@ const coverArtStyles = StyleSheet.create({ alignItems: 'center', marginTop: 10, }, -}); +}) const SongInfo = () => { - const track = useAtomValue(currentTrackAtom); + const track = useAtomValue(currentTrackAtom) return ( {track?.title} {track?.artist} - ); -}; + ) +} const infoStyles = StyleSheet.create({ container: { @@ -94,33 +94,33 @@ const infoStyles = StyleSheet.create({ fontSize: 14, textAlign: 'center', }, -}); +}) const PlayerControls = () => { - const state = useAtomValue(playerStateAtom); + const state = useAtomValue(playerStateAtom) - let playPauseIcon: number; - let playPauseStyle: any; - let playPauseAction: () => void; + let playPauseIcon: number + let playPauseStyle: any + let playPauseAction: () => void switch (state) { case State.Playing: case State.Buffering: case State.Connecting: - playPauseIcon = require('../../res/pause_circle-fill.png'); - playPauseStyle = controlsStyles.enabled; - playPauseAction = () => TrackPlayer.pause(); - break; + playPauseIcon = require('../../res/pause_circle-fill.png') + playPauseStyle = controlsStyles.enabled + playPauseAction = () => TrackPlayer.pause() + break case State.Paused: - playPauseIcon = require('../../res/play_circle-fill.png'); - playPauseStyle = controlsStyles.enabled; - playPauseAction = () => TrackPlayer.play(); - break; + playPauseIcon = require('../../res/play_circle-fill.png') + playPauseStyle = controlsStyles.enabled + playPauseAction = () => TrackPlayer.play() + break default: - playPauseIcon = require('../../res/play_circle-fill.png'); - playPauseStyle = controlsStyles.disabled; - playPauseAction = () => {}; - break; + playPauseIcon = require('../../res/play_circle-fill.png') + playPauseStyle = controlsStyles.disabled + playPauseAction = () => {} + break } return ( @@ -139,8 +139,8 @@ const PlayerControls = () => { style={{ ...controlsStyles.skip, ...playPauseStyle }} /> - ); -}; + ) +} const controlsStyles = StyleSheet.create({ container: { @@ -165,10 +165,10 @@ const controlsStyles = StyleSheet.create({ disabled: { opacity: 0.35, }, -}); +}) const NowPlayingLayout = () => { - const track = useAtomValue(currentTrackAtom); + const track = useAtomValue(currentTrackAtom) return ( { - ); -}; + ) +} -export default NowPlayingLayout; +export default NowPlayingLayout diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index fb48a25..b157f8c 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -1,40 +1,40 @@ -import { useNavigation } from '@react-navigation/core'; -import { useAtom } from 'jotai'; -import md5 from 'md5'; -import React from 'react'; -import { Button, Text, View } from 'react-native'; -import { v4 as uuidv4 } from 'uuid'; -import { appSettingsAtom } from '../state/settings'; -import { getAllKeys, multiRemove } from '../storage/asyncstorage'; -import text from '../styles/text'; +import { useNavigation } from '@react-navigation/core' +import { useAtom } from 'jotai' +import md5 from 'md5' +import React from 'react' +import { Button, Text, View } from 'react-native' +import { v4 as uuidv4 } from 'uuid' +import { appSettingsAtom } from '../state/settings' +import { getAllKeys, multiRemove } from '../storage/asyncstorage' +import text from '../styles/text' const TestControls = () => { - const navigation = useNavigation(); + const navigation = useNavigation() const removeAllKeys = async () => { - const allKeys = await getAllKeys(); - await multiRemove(allKeys); - }; + const allKeys = await getAllKeys() + await multiRemove(allKeys) + } return (