Skip to content

Commit

Permalink
Remove invalidate shadows
Browse files Browse the repository at this point in the history
  • Loading branch information
Hacksore committed Nov 6, 2023
1 parent d844f6c commit 807c383
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
import socket from "./rpc/manager";
import { useEffect } from "react";
import { appWindow } from "@tauri-apps/api/window";
import { Routes, Route, useNavigate, useLocation } from "react-router-dom";
import { Routes, Route, useNavigate } from "react-router-dom";
import { Main } from "./views/main";
import { Channel } from "./views/channel";

import { Settings } from "./views/settings";
import { Error } from "./views/error";
import { NavBar } from "./components/nav-bar";
import { invalidateWindowShadows } from "./utils";
import { useClickthrough } from "./use-clickthrough";
import { useBorder } from "./use-border";

function App() {
const navigate = useNavigate();
const location = useLocation();

const { clickthrough } = useClickthrough();
const { mouseInViewport } = useBorder();

useEffect(() => {
console.log("APP: calling socket init");
socket.init(navigate);

// TODO: maybe we set this in rust / config
appWindow.setAlwaysOnTop(true);
}, []);

useEffect(() => {
invalidateWindowShadows();
}, [location]);

const border =
!clickthrough && mouseInViewport
? "hover:border-blue-500"
Expand Down
17 changes: 4 additions & 13 deletions src/rpc/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as uuid from "uuid";
import WebSocket, { Message } from "tauri-plugin-websocket-api";
import { AppActions, AppState, useAppStore as appStore } from "../store";
import type { NavigateFunction } from "react-router-dom";
import { invalidateWindowShadows } from "../utils";

interface TokenResponse {
access_token: string;
Expand Down Expand Up @@ -48,7 +47,7 @@ interface DiscordPayload {
cmd: `${RPCCommand}`;
// TODO: how do i type this properly?
args?: any;
data?: any,
data?: any;
evt?: `${RPCEvent}` | null;
nonce?: string;
}
Expand Down Expand Up @@ -97,7 +96,7 @@ class SocketManager {
this.send({
args: {
client_id: STREAM_KIT_APP_ID,
scopes: ["rpc"],
scopes: ["rpc", "identify"],
},
cmd: RPCCommand.AUTHORIZE,
});
Expand Down Expand Up @@ -138,20 +137,14 @@ class SocketManager {
}

this.store.removeUser(payload.data.user.id);

await invalidateWindowShadows();
}

if (payload.evt === RPCEvent.VOICE_STATE_CREATE) {
this.store.addUser(payload.data);

await invalidateWindowShadows();
}

if (payload.evt === RPCEvent.VOICE_STATE_UPDATE) {
this.store.updateUser(payload.data);

await invalidateWindowShadows();
}

// VOICE_CHANNEL_SELECT sent when the client joins a voice channel
Expand All @@ -166,8 +159,6 @@ class SocketManager {

// after unsub we clear the channel
this.store.setCurrentChannel(null);

await invalidateWindowShadows();
}

// try to find the user
Expand All @@ -187,7 +178,7 @@ class SocketManager {
// we got a token back from discord let's fetch an access token
if (payload.cmd === RPCCommand.AUTHORIZE) {
const { code } = payload.data;
const res = await fetch<TokenResponse>(`${STREAMKIT_URL}/overlay/token`, {
const res = await fetch < TokenResponse > (`${STREAMKIT_URL}/overlay/token`, {
method: "POST",
body: Body.json({ code }),
});
Expand Down Expand Up @@ -253,7 +244,7 @@ class SocketManager {
this.requestUserChannel();
}

// console.log(payload);
console.log(payload);
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/use-border.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ export const useBorder = () => {
const [mousePos, setMousePos] = useState({ x: 0, y: 0 });

useEffect(() => {
console.log("running useBorder effect");

const mouseMoveFn = (event: MouseEvent) => {
setMousePos({ x: event.clientX, y: event.clientY });
};
Expand Down
10 changes: 0 additions & 10 deletions src/utils.ts

This file was deleted.

0 comments on commit 807c383

Please sign in to comment.