Skip to content

Commit

Permalink
remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Philreact committed Oct 25, 2024
1 parent 600215f commit b29906a
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 30 deletions.
2 changes: 0 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,7 @@ function App() {
}
useEffect(() => {
chrome?.runtime?.sendMessage({ action: "getApiKey" }, (response) => {
console.log('goingggg', response)
if (response) {
console.log('response', response)
handleSetGlobalApikey(response)
setApiKey(response);

Expand Down
20 changes: 1 addition & 19 deletions src/ExtStates/NotAuthenticated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const NotAuthenticated = ({
globalApiKey,
handleSetGlobalApikey,
}) => {
console.log("apiKey", apiKey);
const [isValidApiKey, setIsValidApiKey] = useState<boolean | null>(null);
const [hasLocalNode, setHasLocalNode] = useState<boolean | null>(null);
const [useLocalNode, setUseLocalNode] = useState(false);
Expand All @@ -57,12 +56,10 @@ export const NotAuthenticated = ({
const isLocal = cleanUrl(currentNode?.url) === "127.0.0.1:12391";
const handleFileChangeApiKey = (event) => {
const file = event.target.files[0]; // Get the selected file
console.log('file', file)
if (file) {
const reader = new FileReader();
reader.onload = (e) => {
const text = e.target.result; // Get the file content
console.log('text', text)

setImportedApiKey(text); // Store the file content in the state
};
Expand Down Expand Up @@ -95,7 +92,6 @@ export const NotAuthenticated = ({
{ action: "getCustomNodesFromStorage" },
(response) => {
if (response) {
console.log("response", response);
setCustomNodes(response || []);
}
}
Expand All @@ -109,11 +105,9 @@ export const NotAuthenticated = ({
currentNodeRef.current = currentNode
}, [currentNode])

console.log('currentNode', currentNode)

const validateApiKey = useCallback(async (key) => {
try {
console.log('currentNodeRef.current', currentNodeRef.current, key)
if(!currentNodeRef.current) return
const isLocalKey = cleanUrl(key?.url) === "127.0.0.1:12391";
const isCurrentNodeLocal = cleanUrl(currentNodeRef.current?.url) === "127.0.0.1:12391";
Expand All @@ -132,7 +126,6 @@ export const NotAuthenticated = ({
} else if(currentNodeRef.current) {
payload = currentNodeRef.current;
}
console.log('payload', payload)
const url = `${payload?.url}/admin/apikey/test`;
const response = await fetch(url, {
method: "GET",
Expand All @@ -144,12 +137,10 @@ export const NotAuthenticated = ({

// Assuming the response is in plain text and will be 'true' or 'false'
const data = await response.text();
console.log("data", data);
if (data === "true") {
chrome?.runtime?.sendMessage(
{ action: "setApiKey", payload },
(response) => {
console.log("setApiKey", response);
if (response) {
handleSetGlobalApikey(payload);
setIsValidApiKey(true);
Expand Down Expand Up @@ -189,7 +180,6 @@ export const NotAuthenticated = ({

const saveCustomNodes = (myNodes) => {
let nodes = [...(myNodes || [])];
console.log("customNodeToSaveIndex", customNodeToSaveIndex);
if (customNodeToSaveIndex !== null) {
nodes.splice(customNodeToSaveIndex, 1, {
url,
Expand All @@ -208,7 +198,6 @@ export const NotAuthenticated = ({
chrome?.runtime?.sendMessage(
{ action: "setCustomNodes", nodes },
(response) => {
console.log("setCustomNodes", response);
if (response) {
setMode("list");
setUrl("http://");
Expand All @@ -219,7 +208,6 @@ export const NotAuthenticated = ({
);
};

console.log("render customNodes", customNodes, mode);

return (
<>
Expand Down Expand Up @@ -340,7 +328,6 @@ export const NotAuthenticated = ({
chrome?.runtime?.sendMessage(
{ action: "setApiKey", payload:null },
(response) => {
console.log("setApiKey", response);
if (response) {
setApiKey(null);
handleSetGlobalApikey(null);
Expand Down Expand Up @@ -519,12 +506,7 @@ export const NotAuthenticated = ({
const nodesToSave = [
...(customNodes || []),
].filter((item) => item?.url !== node?.url);
console.log(
"nodesToSave",
nodesToSave,
customNodes,
node
);


saveCustomNodes(nodesToSave);
}}
Expand Down
5 changes: 0 additions & 5 deletions src/components/Chat/ChatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR

setTimeout(() => {
const hasUnreadMessages = totalMessages.some((msg) => msg.unread && !msg?.chatReference);
console.log('hasUnreadMessages', hasUnreadMessages)
if (parentRef.current) {
const { scrollTop, scrollHeight, clientHeight } = parentRef.current;
const atBottom = scrollTop + clientHeight >= scrollHeight - 10; // Adjust threshold as needed
console.log('atBottom', atBottom, {scrollTop, scrollHeight, clientHeight})
if (!atBottom && hasUnreadMessages) {
setShowScrollButton(hasUnreadMessages);
} else {
Expand All @@ -60,7 +58,6 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR
}, [initialMessages, tempMessages]);

const handleMessageSeen = useCallback(() => {
console.log('hello handle seen')
setMessages((prevMessages) =>
prevMessages.map((msg) => ({
...msg,
Expand Down Expand Up @@ -101,7 +98,6 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR
return messages[lastIndex]?.signature
}, [messages])

console.log('messages', messages)

// Initialize the virtualizer
const rowVirtualizer = useVirtualizer({
Expand All @@ -113,7 +109,6 @@ export const ChatList = ({ initialMessages, myAddress, tempMessages, chatId, onR
typeof window !== 'undefined' &&
navigator.userAgent.indexOf('Firefox') === -1
? element => {
console.log('height', element?.getBoundingClientRect().height)
return element?.getBoundingClientRect().height
}
: undefined,
Expand Down
2 changes: 0 additions & 2 deletions src/components/Chat/MessageItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ export const MessageItem = ({

useEffect(() => {
if (inView && message.unread) {
console.log('seenlast')
onSeen(message.id);
}
}, [inView, message.id, message.unread, onSeen]);

console.log('isLast', lastSignature === message?.signature)

return (
<div
Expand Down
1 change: 0 additions & 1 deletion src/components/Group/Forum/GroupMail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ export const GroupMail = ({
const getAllThreads = React.useCallback(
async (groupId: string, mode: string, isInitial?: boolean) => {
try {
console.log('mode', mode)
setIsLoading(true)
const offset = isInitial ? 0 : allThreads.length;
const isReverse = mode === "Newest" ? true : false;
Expand Down
1 change: 0 additions & 1 deletion src/components/Group/Group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ export const Group = ({
});
} catch (error) {}
};
console.log('desktopViewMode', desktopViewMode)
const getGroupDataSingle = async (groupId) => {
try {
return new Promise((res, rej) => {
Expand Down

0 comments on commit b29906a

Please sign in to comment.