remove logs

This commit is contained in:
PhilReact 2024-10-25 06:44:34 +03:00
parent 600215fb15
commit b29906af84
6 changed files with 1 additions and 30 deletions

View File

@ -402,9 +402,7 @@ function App() {
} }
useEffect(() => { useEffect(() => {
chrome?.runtime?.sendMessage({ action: "getApiKey" }, (response) => { chrome?.runtime?.sendMessage({ action: "getApiKey" }, (response) => {
console.log('goingggg', response)
if (response) { if (response) {
console.log('response', response)
handleSetGlobalApikey(response) handleSetGlobalApikey(response)
setApiKey(response); setApiKey(response);

View File

@ -33,7 +33,6 @@ export const NotAuthenticated = ({
globalApiKey, globalApiKey,
handleSetGlobalApikey, handleSetGlobalApikey,
}) => { }) => {
console.log("apiKey", apiKey);
const [isValidApiKey, setIsValidApiKey] = useState<boolean | null>(null); const [isValidApiKey, setIsValidApiKey] = useState<boolean | null>(null);
const [hasLocalNode, setHasLocalNode] = useState<boolean | null>(null); const [hasLocalNode, setHasLocalNode] = useState<boolean | null>(null);
const [useLocalNode, setUseLocalNode] = useState(false); const [useLocalNode, setUseLocalNode] = useState(false);
@ -57,12 +56,10 @@ export const NotAuthenticated = ({
const isLocal = cleanUrl(currentNode?.url) === "127.0.0.1:12391"; const isLocal = cleanUrl(currentNode?.url) === "127.0.0.1:12391";
const handleFileChangeApiKey = (event) => { const handleFileChangeApiKey = (event) => {
const file = event.target.files[0]; // Get the selected file const file = event.target.files[0]; // Get the selected file
console.log('file', file)
if (file) { if (file) {
const reader = new FileReader(); const reader = new FileReader();
reader.onload = (e) => { reader.onload = (e) => {
const text = e.target.result; // Get the file content const text = e.target.result; // Get the file content
console.log('text', text)
setImportedApiKey(text); // Store the file content in the state setImportedApiKey(text); // Store the file content in the state
}; };
@ -95,7 +92,6 @@ export const NotAuthenticated = ({
{ action: "getCustomNodesFromStorage" }, { action: "getCustomNodesFromStorage" },
(response) => { (response) => {
if (response) { if (response) {
console.log("response", response);
setCustomNodes(response || []); setCustomNodes(response || []);
} }
} }
@ -109,11 +105,9 @@ export const NotAuthenticated = ({
currentNodeRef.current = currentNode currentNodeRef.current = currentNode
}, [currentNode]) }, [currentNode])
console.log('currentNode', currentNode)
const validateApiKey = useCallback(async (key) => { const validateApiKey = useCallback(async (key) => {
try { try {
console.log('currentNodeRef.current', currentNodeRef.current, key)
if(!currentNodeRef.current) return if(!currentNodeRef.current) return
const isLocalKey = cleanUrl(key?.url) === "127.0.0.1:12391"; const isLocalKey = cleanUrl(key?.url) === "127.0.0.1:12391";
const isCurrentNodeLocal = cleanUrl(currentNodeRef.current?.url) === "127.0.0.1:12391"; const isCurrentNodeLocal = cleanUrl(currentNodeRef.current?.url) === "127.0.0.1:12391";
@ -132,7 +126,6 @@ export const NotAuthenticated = ({
} else if(currentNodeRef.current) { } else if(currentNodeRef.current) {
payload = currentNodeRef.current; payload = currentNodeRef.current;
} }
console.log('payload', payload)
const url = `${payload?.url}/admin/apikey/test`; const url = `${payload?.url}/admin/apikey/test`;
const response = await fetch(url, { const response = await fetch(url, {
method: "GET", method: "GET",
@ -144,12 +137,10 @@ export const NotAuthenticated = ({
// Assuming the response is in plain text and will be 'true' or 'false' // Assuming the response is in plain text and will be 'true' or 'false'
const data = await response.text(); const data = await response.text();
console.log("data", data);
if (data === "true") { if (data === "true") {
chrome?.runtime?.sendMessage( chrome?.runtime?.sendMessage(
{ action: "setApiKey", payload }, { action: "setApiKey", payload },
(response) => { (response) => {
console.log("setApiKey", response);
if (response) { if (response) {
handleSetGlobalApikey(payload); handleSetGlobalApikey(payload);
setIsValidApiKey(true); setIsValidApiKey(true);
@ -189,7 +180,6 @@ export const NotAuthenticated = ({
const saveCustomNodes = (myNodes) => { const saveCustomNodes = (myNodes) => {
let nodes = [...(myNodes || [])]; let nodes = [...(myNodes || [])];
console.log("customNodeToSaveIndex", customNodeToSaveIndex);
if (customNodeToSaveIndex !== null) { if (customNodeToSaveIndex !== null) {
nodes.splice(customNodeToSaveIndex, 1, { nodes.splice(customNodeToSaveIndex, 1, {
url, url,
@ -208,7 +198,6 @@ export const NotAuthenticated = ({
chrome?.runtime?.sendMessage( chrome?.runtime?.sendMessage(
{ action: "setCustomNodes", nodes }, { action: "setCustomNodes", nodes },
(response) => { (response) => {
console.log("setCustomNodes", response);
if (response) { if (response) {
setMode("list"); setMode("list");
setUrl("http://"); setUrl("http://");
@ -219,7 +208,6 @@ export const NotAuthenticated = ({
); );
}; };
console.log("render customNodes", customNodes, mode);
return ( return (
<> <>
@ -340,7 +328,6 @@ export const NotAuthenticated = ({
chrome?.runtime?.sendMessage( chrome?.runtime?.sendMessage(
{ action: "setApiKey", payload:null }, { action: "setApiKey", payload:null },
(response) => { (response) => {
console.log("setApiKey", response);
if (response) { if (response) {
setApiKey(null); setApiKey(null);
handleSetGlobalApikey(null); handleSetGlobalApikey(null);
@ -519,12 +506,7 @@ export const NotAuthenticated = ({
const nodesToSave = [ const nodesToSave = [
...(customNodes || []), ...(customNodes || []),
].filter((item) => item?.url !== node?.url); ].filter((item) => item?.url !== node?.url);
console.log(
"nodesToSave",
nodesToSave,
customNodes,
node
);
saveCustomNodes(nodesToSave); saveCustomNodes(nodesToSave);
}} }}

View File

@ -41,11 +41,9 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR
setTimeout(() => { setTimeout(() => {
const hasUnreadMessages = totalMessages.some((msg) => msg.unread && !msg?.chatReference); const hasUnreadMessages = totalMessages.some((msg) => msg.unread && !msg?.chatReference);
console.log('hasUnreadMessages', hasUnreadMessages)
if (parentRef.current) { if (parentRef.current) {
const { scrollTop, scrollHeight, clientHeight } = parentRef.current; const { scrollTop, scrollHeight, clientHeight } = parentRef.current;
const atBottom = scrollTop + clientHeight >= scrollHeight - 10; // Adjust threshold as needed const atBottom = scrollTop + clientHeight >= scrollHeight - 10; // Adjust threshold as needed
console.log('atBottom', atBottom, {scrollTop, scrollHeight, clientHeight})
if (!atBottom && hasUnreadMessages) { if (!atBottom && hasUnreadMessages) {
setShowScrollButton(hasUnreadMessages); setShowScrollButton(hasUnreadMessages);
} else { } else {
@ -60,7 +58,6 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR
}, [initialMessages, tempMessages]); }, [initialMessages, tempMessages]);
const handleMessageSeen = useCallback(() => { const handleMessageSeen = useCallback(() => {
console.log('hello handle seen')
setMessages((prevMessages) => setMessages((prevMessages) =>
prevMessages.map((msg) => ({ prevMessages.map((msg) => ({
...msg, ...msg,
@ -101,7 +98,6 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR
return messages[lastIndex]?.signature return messages[lastIndex]?.signature
}, [messages]) }, [messages])
console.log('messages', messages)
// Initialize the virtualizer // Initialize the virtualizer
const rowVirtualizer = useVirtualizer({ const rowVirtualizer = useVirtualizer({
@ -113,7 +109,6 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR
typeof window !== 'undefined' && typeof window !== 'undefined' &&
navigator.userAgent.indexOf('Firefox') === -1 navigator.userAgent.indexOf('Firefox') === -1
? element => { ? element => {
console.log('height', element?.getBoundingClientRect().height)
return element?.getBoundingClientRect().height return element?.getBoundingClientRect().height
} }
: undefined, : undefined,

View File

@ -39,12 +39,10 @@ export const MessageItem = ({
useEffect(() => { useEffect(() => {
if (inView && message.unread) { if (inView && message.unread) {
console.log('seenlast')
onSeen(message.id); onSeen(message.id);
} }
}, [inView, message.id, message.unread, onSeen]); }, [inView, message.id, message.unread, onSeen]);
console.log('isLast', lastSignature === message?.signature)
return ( return (
<div <div

View File

@ -172,7 +172,6 @@ export const GroupMail = ({
const getAllThreads = React.useCallback( const getAllThreads = React.useCallback(
async (groupId: string, mode: string, isInitial?: boolean) => { async (groupId: string, mode: string, isInitial?: boolean) => {
try { try {
console.log('mode', mode)
setIsLoading(true) setIsLoading(true)
const offset = isInitial ? 0 : allThreads.length; const offset = isInitial ? 0 : allThreads.length;
const isReverse = mode === "Newest" ? true : false; const isReverse = mode === "Newest" ? true : false;

View File

@ -519,7 +519,6 @@ export const Group = ({
}); });
} catch (error) {} } catch (error) {}
}; };
console.log('desktopViewMode', desktopViewMode)
const getGroupDataSingle = async (groupId) => { const getGroupDataSingle = async (groupId) => {
try { try {
return new Promise((res, rej) => { return new Promise((res, rej) => {