Skip to content

Commit

Permalink
unbreak formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Yayroos committed Feb 10, 2024
1 parent 4546ccc commit 82055ab
Show file tree
Hide file tree
Showing 19 changed files with 169 additions and 97 deletions.
14 changes: 12 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "import", "prettier", "react", "react-hooks", "simple-import-sort"],
"plugins": [
"@typescript-eslint",
"import",
"prettier",
"react",
"react-hooks",
"simple-import-sort"
],
"rules": {
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_" }
],
"react/jsx-filename-extension": [
"warn",
{
Expand Down
4 changes: 2 additions & 2 deletions ACKNOWLEDGMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

This is a list of assets used by Lofi, including, but not limited to, fonts, graphics, images, and vector icons.


- [ipc](https://github.com/jarikomppa/ipc) by [Jari Komppa](http://iki.fi/sol/)
- [Inter-UI](https://rsms.me/inter/) font pack by [Rasmus Andersson](https://twitter.com/rsms)
- [Font Awesome](https://fontawesome.com) vector icons
- [Vaporwave ぎレブ](https://steamcommunity.com/sharedfiles/filedetails/?id=1551937777) by [mrchernobyl](https://steamcommunity.com/id/mrchernobyl)

## Removal
If your license doesn't permit Lofi to use your asset, or you would like me to remove the asset from Lofi (for whatever reason), please submit an [issue](https://github.com/dvx/lofi/issues).

If your license doesn't permit Lofi to use your asset, or you would like me to remove the asset from Lofi (for whatever reason), please submit an [issue](https://github.com/dvx/lofi/issues).
2 changes: 2 additions & 0 deletions BUGS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Known bugs

Bugs:

- When Windows Desktop DPI size is not 100%, application window "touchable" area might not be the right size. Drag the window to fix this.
20 changes: 16 additions & 4 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ const createMainWindow = (): void => {

const windowOpenHandler = (
details: HandlerDetails
): { action: 'allow' | 'deny'; overrideBrowserWindowOptions?: BrowserWindowConstructorOptions } => {
): {
action: 'allow' | 'deny';
overrideBrowserWindowOptions?: BrowserWindowConstructorOptions;
} => {
switch (details.frameName) {
case WindowName.About: {
return {
Expand Down Expand Up @@ -300,7 +303,10 @@ const createMainWindow = (): void => {
});

childWindow.on('close', () => {
setAlwaysOnTop({ window: mainWindow, isAlwaysOnTop: settings.isAlwaysOnTop });
setAlwaysOnTop({
window: mainWindow,
isAlwaysOnTop: settings.isAlwaysOnTop,
});
});
break;
}
Expand All @@ -317,7 +323,10 @@ const createMainWindow = (): void => {
case WindowName.TrackInfo: {
moveTrackInfo(mainWindow, screen);
childWindow.setIgnoreMouseEvents(true);
setAlwaysOnTop({ window: childWindow, isAlwaysOnTop: settings.isAlwaysOnTop });
setAlwaysOnTop({
window: childWindow,
isAlwaysOnTop: settings.isAlwaysOnTop,
});
if (MACOS) {
childWindow.setWindowButtonVisibility(false);
}
Expand Down Expand Up @@ -390,7 +399,10 @@ app.on('ready', () => {
mainWindow.center();
}

setAlwaysOnTop({ window: mainWindow, isAlwaysOnTop: settings.isAlwaysOnTop });
setAlwaysOnTop({
window: mainWindow,
isAlwaysOnTop: settings.isAlwaysOnTop,
});

const bounds = mainWindow.getBounds();
const currentDisplay = screen.getDisplayMatching(bounds);
Expand Down
12 changes: 9 additions & 3 deletions src/renderer/app/cover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const Cover: FunctionComponent<Props> = ({ settings, message, onVisualiza
visualizationId,
visualizationType,
visualizerOpacity,
refreshTime
refreshTime,
} = useMemo(() => settings, [settings]);

const [currentSongId, setCurrentSongId] = useState('');
Expand All @@ -82,7 +82,10 @@ export const Cover: FunctionComponent<Props> = ({ settings, message, onVisualiza
return;
}

dispatch({ type: CurrentlyPlayingActions.SetCurrentlyPlaying, payload: currentlyPlaying });
dispatch({
type: CurrentlyPlayingActions.SetCurrentlyPlaying,
payload: currentlyPlaying,
});
setErrorToDisplay('');
} catch (error) {
console.error(error);
Expand All @@ -97,7 +100,10 @@ export const Cover: FunctionComponent<Props> = ({ settings, message, onVisualiza
if (state.isLiked !== isTrackLiked) {
ipcRenderer.send(IpcMessage.TrackLiked, isTrackLiked);
}
dispatch({ type: CurrentlyPlayingActions.SetTrackLiked, payload: isTrackLiked });
dispatch({
type: CurrentlyPlayingActions.SetTrackLiked,
payload: isTrackLiked,
});
await handlePlaybackChanged();
} catch (error) {
console.error(error);
Expand Down
12 changes: 10 additions & 2 deletions src/renderer/app/cover/visualizer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ export const Visualizer: FunctionComponent<Props> = ({

useEffect(() => {
if (!visualizationId || visualizationId < 0 || visualizationId >= visualizations.length) {
visualizations[0].visualize({ canvas: canvasRef.current, peakFactor, timeFactor });
visualizations[0].visualize({
canvas: canvasRef.current,
peakFactor,
timeFactor,
});
} else {
visualizations[visualizationId].visualize({ canvas: canvasRef.current, peakFactor, timeFactor });
visualizations[visualizationId].visualize({
canvas: canvasRef.current,
peakFactor,
timeFactor,
});
}
const canvasRefValue = canvasRef.current;
return () => {
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,13 @@ export const App: FunctionComponent = () => {
let mouseX = 0;
let mouseY = 0;

setDisplays(() => displayData.map(({ label, bounds: { height, width } }) => ({ label, height, width })));
setDisplays(() =>
displayData.map(({ label, bounds: { height, width } }) => ({
label,
height,
width,
}))
);

const moveWindow = (): void => {
ipcRenderer.send(IpcMessage.WindowMoving, { mouseX, mouseY });
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/contexts/currently-playing.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ interface CurrentlyPlayingContext {
dispatch: Dispatch<CurrentlyPlayingAction>;
}

const Context = createContext<CurrentlyPlayingContext>({ state: null, dispatch: null });
const Context = createContext<CurrentlyPlayingContext>({
state: null,
dispatch: null,
});

export const CurrentlyPlayingProvider: FunctionComponent = ({ children }) => {
const [state, dispatch] = useReducer(useCurrentlyPlayingReducer, INITIAL_STATE);
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/contexts/settings.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export const SettingsProvider: FunctionComponent = ({ children }) => {
}),
[]
);
const [state, dispatch] = useReducer(useSettingsReducer, { ...DEFAULT_SETTINGS, ...store.get('settings') });
const [state, dispatch] = useReducer(useSettingsReducer, {
...DEFAULT_SETTINGS,
...store.get('settings'),
});

useEffect(() => {
store.set('settings', state || DEFAULT_SETTINGS);
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/hooks/use-hover.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { useState } from 'react';

export const useHover = (): { isHovering: boolean; props: { onMouseEnter: () => void; onMouseLeave: () => void } } => {
export const useHover = (): {
isHovering: boolean;
props: { onMouseEnter: () => void; onMouseLeave: () => void };
} => {
const [isHovering, setIsHovering] = useState(false);

const props = {
Expand Down
19 changes: 8 additions & 11 deletions src/renderer/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>lofi</title>
</head>

<head>
<meta charset="utf-8" />
<title>lofi</title>
</head>

<body id="app-body">
<div id="app"
class="app"></div>
</body>

</html>
<body id="app-body">
<div id="app" class="app"></div>
</body>
</html>
8 changes: 4 additions & 4 deletions src/renderer/style.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@import url('./static/inter-ui/inter-ui.css');
@import url('./static/fontawesome/css/all.min.css');
@import url("./static/inter-ui/inter-ui.css");
@import url("./static/fontawesome/css/all.min.css");

html,
body {
font-family: 'Inter UI', sans-serif;
font-family: "Inter UI", sans-serif;
height: 100%;
width: 100%;
-webkit-app-region: none;
Expand Down Expand Up @@ -64,4 +64,4 @@ body {
background-color: transparent;
width: 100%;
height: 100%;
}
}
7 changes: 4 additions & 3 deletions src/renderer/windows/settings/advanced-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { DEFAULT_SETTINGS, Settings } from '../../../models/settings';
import { FieldSet, FormGroup, Label, Legend, RangeValue, Row, Slider, StyledCheckbox } from '../../components';
import { INPUT_COLOR } from '../../components/mantine.styled';



export const AdvancedSettings: FunctionComponent = () => {
const { register, watch } = useFormContext<Settings>();

Expand Down Expand Up @@ -36,7 +34,10 @@ export const AdvancedSettings: FunctionComponent = () => {
max={10000}
step={500}
defaultValue={DEFAULT_SETTINGS.refreshTime}
{...register('refreshTime', { required: true, valueAsNumber: true })}
{...register('refreshTime', {
required: true,
valueAsNumber: true,
})}
/>
<RangeValue>{refreshTimeWatch}</RangeValue>
</Label>
Expand Down
10 changes: 8 additions & 2 deletions src/renderer/windows/settings/audio-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export const AudioSettings: FunctionComponent = () => {
max={100}
step={2}
defaultValue={DEFAULT_SETTINGS.volumeIncrement}
{...register('volumeIncrement', { required: true, valueAsNumber: true })}
{...register('volumeIncrement', {
required: true,
valueAsNumber: true,
})}
/>
<RangeValue>{volumeIncrementWatch}</RangeValue>
</Label>
Expand All @@ -37,7 +40,10 @@ export const AudioSettings: FunctionComponent = () => {
max={MAX_SKIP_SONG_DELAY}
step={5}
defaultValue={DEFAULT_SETTINGS.skipSongDelay}
{...register('skipSongDelay', { required: true, valueAsNumber: true })}
{...register('skipSongDelay', {
required: true,
valueAsNumber: true,
})}
/>
<RangeValue>{skipSongDelayWatch}</RangeValue>
</Label>
Expand Down
10 changes: 8 additions & 2 deletions src/renderer/windows/settings/track-info-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export const TrackInfoSettings: FunctionComponent = () => {
max={MAX_FONT_SIZE}
step={1}
defaultValue={DEFAULT_SETTINGS.trackInfoFontSize}
{...register('trackInfoFontSize', { required: true, valueAsNumber: true })}
{...register('trackInfoFontSize', {
required: true,
valueAsNumber: true,
})}
/>
<RangeValue>{trackInfoFontSizeWatch}</RangeValue>
</Label>
Expand All @@ -57,7 +60,10 @@ export const TrackInfoSettings: FunctionComponent = () => {
max={100}
step={1}
defaultValue={DEFAULT_SETTINGS.trackInfoBackgroundOpacity}
{...register('trackInfoBackgroundOpacity', { required: true, valueAsNumber: true })}
{...register('trackInfoBackgroundOpacity', {
required: true,
valueAsNumber: true,
})}
/>
<RangeValue>{trackInfoBackgroundOpacityWatch}</RangeValue>
</Label>
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/windows/settings/visualization-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export const VisualizationSettings: FunctionComponent<Props> = ({
max={100}
step={5}
defaultValue={DEFAULT_SETTINGS.visualizerOpacity}
{...register('visualizerOpacity', { required: true, valueAsNumber: true })}
{...register('visualizerOpacity', {
required: true,
valueAsNumber: true,
})}
/>
<RangeValue>{opacityWatch}</RangeValue>
</Label>
Expand Down
10 changes: 8 additions & 2 deletions src/renderer/windows/settings/window-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ export const WindowSettings: FunctionComponent = () => {
max={MAX_BAR_THICKNESS}
step={1}
defaultValue={DEFAULT_SETTINGS.barThickness}
{...register('barThickness', { required: true, valueAsNumber: true })}
{...register('barThickness', {
required: true,
valueAsNumber: true,
})}
/>
<RangeValue>{barThicknessWatch}</RangeValue>
</Label>
Expand All @@ -82,7 +85,10 @@ export const WindowSettings: FunctionComponent = () => {
max={MAX_CORNER_RADIUS}
step={1}
defaultValue={DEFAULT_SETTINGS.cornerRadius}
{...register('cornerRadius', { required: true, valueAsNumber: true })}
{...register('cornerRadius', {
required: true,
valueAsNumber: true,
})}
/>
<RangeValue>{cornerRadiusWatch}</RangeValue>
</Label>
Expand Down
Loading

0 comments on commit 82055ab

Please sign in to comment.