mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
Clean up imports
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import { API_BASE_URL } from "../core/config";
|
||||
// import { showLogin } from "../navigation";
|
||||
import type { Headers, User, WebSocketMessage } from "../core/types";
|
||||
import { clearAlerts } from "./auth";
|
||||
import { request } from "../websocket";
|
||||
import type { Headers } from "../core/types";
|
||||
|
||||
/**
|
||||
* Generates authentication headers for API requests
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { PRODUCT_NAME } from "../../../core/config";
|
||||
import { useDialog } from "../../contexts/DialogContext";
|
||||
import { useChat } from "../../hooks/useChat";
|
||||
import { useAppState } from "../../state";
|
||||
import defaultAvatar from "../../../resources/images/default-avatar.png";
|
||||
import { useState, type FormEvent } from "react";
|
||||
|
||||
@@ -146,7 +146,7 @@ export function MessageContextMenu({
|
||||
}, 200); // Match the animation duration from _animations.scss
|
||||
};
|
||||
|
||||
const handleEditSave = (messageId: number, newContent: string) => {
|
||||
const handleEditSave = (_messageId: number, newContent: string) => {
|
||||
// Create a temporary message object with the updated content
|
||||
const updatedMessage = { ...message, content: newContent };
|
||||
onEdit(updatedMessage);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useEffect, useCallback, useRef } from "react";
|
||||
import { useAppState } from "../state";
|
||||
import { request, websocket } from "../../websocket";
|
||||
import { request } from "../../websocket";
|
||||
import { API_BASE_URL } from "../../core/config";
|
||||
import type { Message, WebSocketMessage } from "../../core/types";
|
||||
import type { Message } from "../../core/types";
|
||||
import { getAuthHeaders } from "../../auth/api";
|
||||
import { delay } from "../../utils/utils";
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { MessagePanel, type MessagePanelCallbacks } from "./MessagePanel";
|
||||
import {
|
||||
fetchUserPublicKey,
|
||||
fetchDMHistory,
|
||||
decryptDm,
|
||||
sendDMViaWebSocket
|
||||
} from "../../api/dmApi";
|
||||
import type { Message, DmEnvelope } from "../../core/types";
|
||||
import type { Message } from "../../core/types";
|
||||
import type { UserState } from "../state";
|
||||
|
||||
export interface DMPanelData {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { User, Message } from "../../core/types";
|
||||
import type { Message } from "../../core/types";
|
||||
import type { UserState } from "../state";
|
||||
|
||||
export interface MessagePanelState {
|
||||
|
||||
@@ -6,7 +6,6 @@ import type { Message, WebSocketMessage } from "../../core/types";
|
||||
import type { UserState } from "../state";
|
||||
|
||||
export class PublicChatPanel extends MessagePanel {
|
||||
private chatName: string;
|
||||
private messagesLoaded: boolean = false;
|
||||
|
||||
constructor(
|
||||
@@ -16,7 +15,6 @@ export class PublicChatPanel extends MessagePanel {
|
||||
onStateChange: (state: any) => void
|
||||
) {
|
||||
super(`public-${chatName}`, currentUser, callbacks, onStateChange);
|
||||
this.chatName = chatName;
|
||||
this.updateState({
|
||||
title: chatName,
|
||||
online: true // Public chats are always "online"
|
||||
@@ -113,7 +111,6 @@ export class PublicChatPanel extends MessagePanel {
|
||||
|
||||
// Update chat name
|
||||
setChatName(chatName: string): void {
|
||||
this.chatName = chatName;
|
||||
this.updateState({
|
||||
id: `public-${chatName}`,
|
||||
title: chatName
|
||||
|
||||
@@ -236,10 +236,10 @@ export const useAppState = create<AppState>((set, get) => ({
|
||||
let publicChatPanel = chat.publicChatPanel;
|
||||
if (!publicChatPanel) {
|
||||
const callbacks = {
|
||||
onSendMessage: (content: string) => {},
|
||||
onEditMessage: (messageId: number, content: string) => {},
|
||||
onDeleteMessage: (messageId: number) => {},
|
||||
onReplyToMessage: (messageId: number, content: string) => {},
|
||||
onSendMessage: (_content: string) => {},
|
||||
onEditMessage: (_messageId: number, _content: string) => {},
|
||||
onDeleteMessage: (_messageId: number) => {},
|
||||
onReplyToMessage: (_messageId: number, _content: string) => {},
|
||||
onProfileClick: () => {}
|
||||
};
|
||||
|
||||
@@ -288,10 +288,10 @@ export const useAppState = create<AppState>((set, get) => ({
|
||||
let dmPanel = chat.dmPanel;
|
||||
if (!dmPanel) {
|
||||
const callbacks = {
|
||||
onSendMessage: (content: string) => {},
|
||||
onEditMessage: (messageId: number, content: string) => {},
|
||||
onDeleteMessage: (messageId: number) => {},
|
||||
onReplyToMessage: (messageId: number, content: string) => {},
|
||||
onSendMessage: (_content: string) => {},
|
||||
onEditMessage: (_messageId: number, _content: string) => {},
|
||||
onDeleteMessage: (_messageId: number) => {},
|
||||
onReplyToMessage: (_messageId: number, _content: string) => {},
|
||||
onProfileClick: () => {}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user