diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 44ac70d..df1c2c7 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,9 +2,9 @@ "version": "2.0.0", "tasks": [ { - "label": "Run", - "type": "shell", - "command": "npm run dev", + "label": "Backend", + "type": "npm", + "script": "backend:run", "options": { "cwd": "${workspaceFolder}" }, @@ -16,23 +16,73 @@ }, "group": { "kind": "build" + }, + "isBackground": true + }, + { + "label": "Frontend (Web)", + "type": "npm", + "script": "frontend:dev", + "options": { + "cwd": "${workspaceFolder}" + }, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared" + }, + "group": { + "kind": "build", + }, + "isBackground": true + }, + { + "label": "Frontend (Electron)", + "type": "npm", + "script": "frontend:electron:dev", + "options": { + "cwd": "${workspaceFolder}" + }, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared" + }, + "group": { + "kind": "build" + }, + "isBackground": true + }, + + { + "label": "Web", + "dependsOn": ["Backend", "Frontend (Web)"], + "dependsOrder": "parallel", + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared" } }, { - "label": "Run (Electron)", - "type": "shell", - "command": "npm run dev:electron", - "options": { - "cwd": "${workspaceFolder}" + "label": "Electron", + "dependsOn": ["Backend", "Frontend (Electron)"], + "dependsOrder": "parallel", + "group": { + "kind": "build" }, "presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared" - }, - "group": { - "kind": "build" } } ] diff --git a/frontend/src/ui/hooks/useChat.ts b/frontend/src/ui/hooks/useChat.ts index 9653c46..cf7a19d 100644 --- a/frontend/src/ui/hooks/useChat.ts +++ b/frontend/src/ui/hooks/useChat.ts @@ -2,7 +2,7 @@ import { useEffect, useCallback, useRef } from "react"; import { useAppState } from "../state"; import { request, websocket } from "../../websocket"; import { API_BASE_URL } from "../../core/config"; -import type { Message, WebSocketMessage, User } from "../../core/types"; +import type { Message, WebSocketMessage } from "../../core/types"; import { getAuthHeaders } from "../../auth/api"; export function useChat() { @@ -12,11 +12,11 @@ export function useChat() { updateMessage, removeMessage, clearMessages, - setCurrentChat, - setActiveTab, - setDmUsers, + setCurrentChat, + setActiveTab, + setDmUsers, setActiveDm, - user + user } = useAppState(); const messagesLoadedRef = useRef(false); @@ -87,7 +87,6 @@ export function useChat() { break; case 'newMessage': if (response.data) { - const isAuthor = response.data.username === user.currentUser?.username; addMessage(response.data); } break; diff --git a/frontend/src/ui/state.ts b/frontend/src/ui/state.ts index 60543d2..2cafd3b 100644 --- a/frontend/src/ui/state.ts +++ b/frontend/src/ui/state.ts @@ -1,5 +1,5 @@ import { create } from "zustand"; -import type { Message, User, UserProfile, WebSocketMessage } from "../core/types"; +import type { Message, User, WebSocketMessage } from "../core/types"; import { request } from "../websocket"; type Page = "login" | "register" | "chat"