mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-17 14:10:14 +02:00
restructure files onto electron-vite boilerplate
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useCallback, useEffect, WheelEvent } from 'react';
|
||||
import isElectron from 'is-electron';
|
||||
import { useCallback, useEffect, WheelEvent } from 'react';
|
||||
|
||||
import {
|
||||
useMuted,
|
||||
usePlayerControls,
|
||||
@@ -9,10 +10,10 @@ import {
|
||||
} from '/@/renderer/store';
|
||||
import { useGeneralSettings } from '/@/renderer/store/settings.store';
|
||||
|
||||
const mpvPlayer = isElectron() ? window.electron.mpvPlayer : null;
|
||||
const mpvPlayerListener = isElectron() ? window.electron.mpvPlayerListener : null;
|
||||
const ipc = isElectron() ? window.electron.ipc : null;
|
||||
const remote = isElectron() ? window.electron.remote : null;
|
||||
const mpvPlayer = isElectron() ? window.api.mpvPlayer : null;
|
||||
const mpvPlayerListener = isElectron() ? window.api.mpvPlayerListener : null;
|
||||
const ipc = isElectron() ? window.api.ipc : null;
|
||||
const remote = isElectron() ? window.api.remote : null;
|
||||
|
||||
const calculateVolumeUp = (volume: number, volumeWheelStep: number) => {
|
||||
let volumeToSet;
|
||||
@@ -39,7 +40,7 @@ const calculateVolumeDown = (volume: number, volumeWheelStep: number) => {
|
||||
};
|
||||
|
||||
export const useRightControls = () => {
|
||||
const { setVolume, setMuted } = usePlayerControls();
|
||||
const { setMuted, setVolume } = usePlayerControls();
|
||||
const volume = useVolume();
|
||||
const muted = useMuted();
|
||||
const { volumeWheelStep } = useGeneralSettings();
|
||||
@@ -98,7 +99,7 @@ export const useRightControls = () => {
|
||||
}, [setVolume, volume, volumeWheelStep]);
|
||||
|
||||
const handleVolumeWheel = useCallback(
|
||||
(e: WheelEvent<HTMLDivElement | HTMLButtonElement>) => {
|
||||
(e: WheelEvent<HTMLButtonElement | HTMLDivElement>) => {
|
||||
let volumeToSet;
|
||||
if (e.deltaY > 0 || e.deltaX > 0) {
|
||||
volumeToSet = calculateVolumeDown(volume, volumeWheelStep);
|
||||
|
||||
Reference in New Issue
Block a user