From a63b335652ae36a2e11af90ecd4335f2d320ab0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=83=D0=BB?= Date: Mon, 25 Nov 2024 01:01:30 +0300 Subject: [PATCH] feat: remove warnings --- .../EditNodeNameModal/Body/index.tsx | 4 +- .../RemoveNodeModal/Body/index.tsx | 2 +- .../Universe/Graph/Cubes/Text/index.tsx | 2 - .../Universe/Graph/UI/NodeControls/index.tsx | 2 +- .../components/PlayerContols/index.tsx | 2 - .../components/Scene/Board/Node/index.tsx | 2 +- .../mindset/components/Scene/Board/index.tsx | 113 ++++++++---------- .../mindset/components/Scene/index.tsx | 2 +- src/modules/mindset/index.tsx | 4 +- src/stores/useDataStore/index.ts | 4 +- src/stores/useGraphStore/index.ts | 4 +- src/stores/useTopicsStore/index.ts | 2 +- src/testSphinxBridge/saveLsat.ts | 2 +- src/transformers/splitGraph.ts | 25 ---- src/utils/relayHelper/index.ts | 6 +- 15 files changed, 63 insertions(+), 113 deletions(-) diff --git a/src/components/ModalsContainer/EditNodeNameModal/Body/index.tsx b/src/components/ModalsContainer/EditNodeNameModal/Body/index.tsx index 8f1a22810..7db7173a7 100644 --- a/src/components/ModalsContainer/EditNodeNameModal/Body/index.tsx +++ b/src/components/ModalsContainer/EditNodeNameModal/Body/index.tsx @@ -1,5 +1,5 @@ import { Button, Skeleton } from '@mui/material' -import React, { useEffect, useState } from 'react' +import { useEffect, useState } from 'react' import { FormProvider, useForm } from 'react-hook-form' import { ClipLoader } from 'react-spinners' import styled from 'styled-components' @@ -61,7 +61,7 @@ export const Body = () => { setActualTopicNode(node) } catch (error) { - console.log(error) + console.error(error) } finally { setTopicIsLoading(false) } diff --git a/src/components/ModalsContainer/RemoveNodeModal/Body/index.tsx b/src/components/ModalsContainer/RemoveNodeModal/Body/index.tsx index 650afdabe..c82f9d466 100644 --- a/src/components/ModalsContainer/RemoveNodeModal/Body/index.tsx +++ b/src/components/ModalsContainer/RemoveNodeModal/Body/index.tsx @@ -53,7 +53,7 @@ export const Body = () => { setActualNode(selectedNode) } } catch (error) { - console.log(error) + console.error(error) } finally { setTopicIsLoading(false) } diff --git a/src/components/Universe/Graph/Cubes/Text/index.tsx b/src/components/Universe/Graph/Cubes/Text/index.tsx index 9483e09ac..64f3b8808 100644 --- a/src/components/Universe/Graph/Cubes/Text/index.tsx +++ b/src/components/Universe/Graph/Cubes/Text/index.tsx @@ -72,8 +72,6 @@ export const TextNode = memo(({ node, hide, ignoreDistance }: Props) => { const ringRef = useRef(null) const circleRef = useRef(null) - console.log('rerender') - const nodePositionRef = useRef(new Vector3()) const { texture } = useTexture(node.properties?.image_url || '') diff --git a/src/components/Universe/Graph/UI/NodeControls/index.tsx b/src/components/Universe/Graph/UI/NodeControls/index.tsx index d66fa1972..7b3fc5cb2 100644 --- a/src/components/Universe/Graph/UI/NodeControls/index.tsx +++ b/src/components/Universe/Graph/UI/NodeControls/index.tsx @@ -56,7 +56,7 @@ export const NodeControls = memo(() => { } } } catch (error) { - console.log(error) + console.error(error) } }, [addNewNode, selectedNode?.ref_id, selectionGraphData.nodes.length]) diff --git a/src/modules/mindset/components/PlayerContols/index.tsx b/src/modules/mindset/components/PlayerContols/index.tsx index b7670479a..060f72367 100644 --- a/src/modules/mindset/components/PlayerContols/index.tsx +++ b/src/modules/mindset/components/PlayerContols/index.tsx @@ -25,8 +25,6 @@ export const PlayerControl = ({ markers }: Props) => { const startTime = ((playingTime - start) / (end - start)) * 100 - console.log(startTime) - const showPlayer = playingNode return showPlayer ? ( diff --git a/src/modules/mindset/components/Scene/Board/Node/index.tsx b/src/modules/mindset/components/Scene/Board/Node/index.tsx index 0dc4cef52..e07cda450 100644 --- a/src/modules/mindset/components/Scene/Board/Node/index.tsx +++ b/src/modules/mindset/components/Scene/Board/Node/index.tsx @@ -19,7 +19,7 @@ type Props = { export const Node = ({ width, height, position, url, onButtonClick, name, type, color }: Props) => { const { camera, size } = useThree() - console.log(url, type) + console.info(url, type) // Function to calculate the distance between the camera and the node const getPixelSize = (worldSize: number, worldHeight: number) => { diff --git a/src/modules/mindset/components/Scene/Board/index.tsx b/src/modules/mindset/components/Scene/Board/index.tsx index 47e170d05..302b6738a 100644 --- a/src/modules/mindset/components/Scene/Board/index.tsx +++ b/src/modules/mindset/components/Scene/Board/index.tsx @@ -3,20 +3,13 @@ import { useEffect, useMemo } from 'react' import { edges, edgesMention, maxTimestamp, minTimestamp, nodes, normalizeTimestamp } from '~/modules/mindset/data' import { Node } from './Node' -type Props = { - w: number -} - const totalDuration = 185 -export const Board = ({ w = 1 }: Props) => { +export const Board = () => { const state = useThree() - console.log(state) - const { width } = state.viewport const { camera } = state - const xW = w useEffect(() => { const orthoCamera = camera as THREE.OrthographicCamera @@ -45,8 +38,6 @@ export const Board = ({ w = 1 }: Props) => { } }, [camera]) - console.log(width, xW) - const rangeMin = 0 const rangeMax = 97.52 * 10 @@ -68,60 +59,54 @@ export const Board = ({ w = 1 }: Props) => { [rangeMin, rangeMax], ) - console.log(-width) - return ( - true && ( - <> - {nodes.map((node, i) => { - const hasTimeStamp = positions.some((p) => p.source === nodes[i].ref_id) - - const position = hasTimeStamp ? positions.find((p) => p.source === nodes[i].ref_id)?.xStart || 0 : i * 35 - - const y = hasTimeStamp ? 0 : 15 - - return true ? null : ( - - ) - })} - {edgesMention.map((e) => { - const node = nodes.find((i) => i.ref_id === e.source) - - const x = (e.start / totalDuration) * width - - console.log(x) - - const y = -5 - - return node ? ( - - ) : null - })} - - {/* Radius: Half of viewport width */} - - - - ) + <> + {nodes.map((node, i) => { + const hasTimeStamp = positions.some((p) => p.source === nodes[i].ref_id) + + const position = hasTimeStamp ? positions.find((p) => p.source === nodes[i].ref_id)?.xStart || 0 : i * 35 + + const y = hasTimeStamp ? 0 : 15 + + return true ? null : ( + + ) + })} + {edgesMention.map((e) => { + const node = nodes.find((i) => i.ref_id === e.source) + + const x = (e.start / totalDuration) * width + + const y = -5 + + return node ? ( + null} + position={[x, y, 0]} + type={node.node_type} + url="logo.png" + width={5} + /> + ) : null + })} + + {/* Radius: Half of viewport width */} + + + ) } diff --git a/src/modules/mindset/components/Scene/index.tsx b/src/modules/mindset/components/Scene/index.tsx index fad461158..6d5f5913d 100644 --- a/src/modules/mindset/components/Scene/index.tsx +++ b/src/modules/mindset/components/Scene/index.tsx @@ -18,7 +18,7 @@ export const Scene = () => { - + diff --git a/src/modules/mindset/index.tsx b/src/modules/mindset/index.tsx index 67f1910cf..60a208275 100644 --- a/src/modules/mindset/index.tsx +++ b/src/modules/mindset/index.tsx @@ -77,7 +77,7 @@ export const MindSet = () => { handleNewNodeCreated(data) } } catch (error) { - console.log(error) + console.error(error) } } @@ -96,7 +96,7 @@ export const MindSet = () => { setSelectedEpisode(data) } } catch (error) { - console.log(error) + console.error(error) } } diff --git a/src/stores/useDataStore/index.ts b/src/stores/useDataStore/index.ts index dd9a7decf..adc0a774f 100644 --- a/src/stores/useDataStore/index.ts +++ b/src/stores/useDataStore/index.ts @@ -286,7 +286,7 @@ export const useDataStore = create()( sidebarFilterCounts, }) } catch (error) { - console.log(error) + console.error(error) if (error !== 'abort') { set({ isLoadingNew: false, isFetching: false }) @@ -347,7 +347,7 @@ export const useDataStore = create()( setHideNodeDetails: (hideNodeDetails) => set({ hideNodeDetails }), setSeedQuestions: (questions) => set({ seedQuestions: questions }), updateNode: (updatedNode) => { - console.log(updatedNode) + console.info(updatedNode) }, addNewNode: (data) => { const { dataInitial: existingData, filters } = get() diff --git a/src/stores/useGraphStore/index.ts b/src/stores/useGraphStore/index.ts index 915a94fdd..67dae899e 100644 --- a/src/stores/useGraphStore/index.ts +++ b/src/stores/useGraphStore/index.ts @@ -210,7 +210,7 @@ export const useGraphStore = create()((set, get) => ({ simulationHelpers.simulationRestart() } catch (error) { - console.log(error) + console.error(error) // eslint-disable-next-line no-debugger } @@ -314,8 +314,6 @@ export const useGraphStore = create()((set, get) => ({ }, }, simulationCreate: (nodes, links) => { - console.log('created') - const structuredNodes = structuredClone(nodes) const structuredLinks = structuredClone(links) diff --git a/src/stores/useTopicsStore/index.ts b/src/stores/useTopicsStore/index.ts index 04f22b13a..5120004d0 100644 --- a/src/stores/useTopicsStore/index.ts +++ b/src/stores/useTopicsStore/index.ts @@ -67,7 +67,7 @@ export const useTopicsStore = create((set, get) => ({ set({ loading: false }) } catch (error) { - console.log(error) + console.error(error) } }, setFilters: (filters: Partial) => set({ filters: { ...get().filters, page: 0, ...filters } }), diff --git a/src/testSphinxBridge/saveLsat.ts b/src/testSphinxBridge/saveLsat.ts index c8346a19c..ebb2e99b7 100644 --- a/src/testSphinxBridge/saveLsat.ts +++ b/src/testSphinxBridge/saveLsat.ts @@ -28,7 +28,7 @@ export async function saveLsat(invoice: string, macaroon: string, host: string) return null } catch (error) { - console.log(JSON.stringify(error)) + console.error(JSON.stringify(error)) return null } diff --git a/src/transformers/splitGraph.ts b/src/transformers/splitGraph.ts index 07eb941b6..620540edc 100644 --- a/src/transformers/splitGraph.ts +++ b/src/transformers/splitGraph.ts @@ -195,31 +195,6 @@ export const generateSplitGraphPositions = (nodes: NodeExtended[], links: Link[] return updated }) - // const links = generateLinksFromNodeData(updatedNodes, true, true) - - // do links - const updatedLinks = links.map((l: Link) => { - const sourceNode = updatedNodes.find((f) => f.ref_id === l.sourceRef) - const targetNode = updatedNodes.find((f) => f.ref_id === l.targetRef) - let onlyVisibleOnSelect = false - - if (sourceNode?.node_type === 'Guest' || sourceNode?.node_type === 'Topic') { - onlyVisibleOnSelect = true - } - - const sourcePosition = new Vector3(sourceNode?.x || 0, sourceNode?.y || 0, sourceNode?.z || 0) - const targetPosition = new Vector3(targetNode?.x || 0, targetNode?.y || 0, targetNode?.z || 0) - - return { - ...l, - onlyVisibleOnSelect, - sourcePosition, - targetPosition, - } - }) - - console.log(updatedLinks) - // sort back to weighted sort updatedNodes.sort((a, b) => (b.weight || 0) - (a.weight || 0)) diff --git a/src/utils/relayHelper/index.ts b/src/utils/relayHelper/index.ts index f807afdac..597000a0a 100644 --- a/src/utils/relayHelper/index.ts +++ b/src/utils/relayHelper/index.ts @@ -27,10 +27,6 @@ export const saveSearchTerm = async () => { await executeIfProd(async () => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - const res = await sphinx.enable(true) - - if (!res) { - console.log('Sphinx enable failed, means no pubkey and no budget (including budget of 0)') - } + await sphinx.enable(true) }) }