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