()
| 29 | import "./styles/titlebar.less" |
| 30 | |
| 31 | const TitleBar: React.FunctionComponent = () => { |
| 32 | const {hover, videoDrag} = useActiveSelector() |
| 33 | const {setVideoDrag} = useActiveActions() |
| 34 | const {theme, os, transparent, pinned} = useThemeSelector() |
| 35 | const {setTheme, setOS, setTransparent, setPinned} = useThemeActions() |
| 36 | const [iconHover, setIconHover] = useState(false) |
| 37 | |
| 38 | useEffect(() => { |
| 39 | window.ipcRenderer.on("toggle-pinned", switchPinned) |
| 40 | return () => { |
| 41 | window.ipcRenderer.removeListener("toggle-pinned", switchPinned) |
| 42 | } |
| 43 | }, []) |
| 44 | |
| 45 | const onMouseDown = () => { |
| 46 | window.ipcRenderer.send("moveWindow") |
| 47 | } |
| 48 | |
| 49 | const close = () => { |
| 50 | window.ipcRenderer.invoke("close") |
| 51 | } |
| 52 | |
| 53 | const minimize = async () => { |
| 54 | await window.ipcRenderer.invoke("minimize") |
| 55 | setIconHover(false) |
| 56 | } |
| 57 | |
| 58 | const maximize = () => { |
| 59 | window.ipcRenderer.invoke("maximize") |
| 60 | } |
| 61 | |
| 62 | const upload = () => { |
| 63 | window.ipcRenderer.invoke("upload-file", false) |
| 64 | } |
| 65 | |
| 66 | const download = () => { |
| 67 | window.ipcRenderer.invoke("trigger-download") |
| 68 | } |
| 69 | |
| 70 | const search = () => { |
| 71 | window.ipcRenderer.invoke("show-link-dialog") |
| 72 | } |
| 73 | |
| 74 | const fx = () => { |
| 75 | window.ipcRenderer.invoke("show-fx-dialog") |
| 76 | } |
| 77 | |
| 78 | const drag = () => { |
| 79 | setVideoDrag(!videoDrag) |
| 80 | } |
| 81 | |
| 82 | const switchTheme = () => { |
| 83 | setTheme(theme === "light" ? "dark" : "light") |
| 84 | } |
| 85 | |
| 86 | const switchOSStyle = () => { |
| 87 | setOS(os === "mac" ? "windows" : "mac") |
| 88 | } |
nothing calls this directly
no test coverage detected