Skip to content

Commit

Permalink
feat: remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Rassl committed Nov 24, 2024
1 parent a4a74ec commit a63b335
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 113 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -61,7 +61,7 @@ export const Body = () => {

setActualTopicNode(node)
} catch (error) {
console.log(error)
console.error(error)
} finally {
setTopicIsLoading(false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const Body = () => {
setActualNode(selectedNode)
}
} catch (error) {
console.log(error)
console.error(error)
} finally {
setTopicIsLoading(false)
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/Universe/Graph/Cubes/Text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ export const TextNode = memo(({ node, hide, ignoreDistance }: Props) => {
const ringRef = useRef<Mesh | null>(null)
const circleRef = useRef<Mesh | null>(null)

console.log('rerender')

const nodePositionRef = useRef(new Vector3())

const { texture } = useTexture(node.properties?.image_url || '')
Expand Down
2 changes: 1 addition & 1 deletion src/components/Universe/Graph/UI/NodeControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const NodeControls = memo(() => {
}
}
} catch (error) {
console.log(error)
console.error(error)
}
}, [addNewNode, selectedNode?.ref_id, selectionGraphData.nodes.length])

Expand Down
2 changes: 0 additions & 2 deletions src/modules/mindset/components/PlayerContols/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ export const PlayerControl = ({ markers }: Props) => {

const startTime = ((playingTime - start) / (end - start)) * 100

console.log(startTime)

const showPlayer = playingNode

return showPlayer ? (
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mindset/components/Scene/Board/Node/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 22 in src/modules/mindset/components/Scene/Board/Node/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected console statement

// Function to calculate the distance between the camera and the node
const getPixelSize = (worldSize: number, worldHeight: number) => {
Expand Down
113 changes: 49 additions & 64 deletions src/modules/mindset/components/Scene/Board/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -45,8 +38,6 @@ export const Board = ({ w = 1 }: Props) => {
}
}, [camera])

console.log(width, xW)

const rangeMin = 0
const rangeMax = 97.52 * 10

Expand All @@ -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 : (
<Node
key={node.ref_id}
color="#353A46"
height={1}
name={node.name}
onButtonClick={console.log}
position={[position, y, 0]}
type={node.node_type}
url="logo.png"
width={w}
/>
)
})}
{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 ? (
<Node
key={node.ref_id}
color="red"
height={10}
name={node.name}
onButtonClick={console.log}
position={[x, y, 0]}
type={node.node_type}
url="logo.png"
width={5}
/>
) : null
})}
<mesh position={[-13, 0, 0]}>
<circleGeometry args={[3, 64]} /> {/* Radius: Half of viewport width */}
<meshBasicMaterial color="blue" />
</mesh>
</>
)
<>
{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 : (

Check warning on line 71 in src/modules/mindset/components/Scene/Board/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected constant condition
<Node
key={node.ref_id}
color="#353A46"
height={1}
name={node.name}
onButtonClick={console.log}

Check warning on line 77 in src/modules/mindset/components/Scene/Board/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Unexpected console statement
position={[position, y, 0]}
type={node.node_type}
url="logo.png"
width={4}
/>
)
})}
{edgesMention.map((e) => {
const node = nodes.find((i) => i.ref_id === e.source)

const x = (e.start / totalDuration) * width

const y = -5

return node ? (
<Node
key={node.ref_id}
color="red"
height={10}
name={node.name}
onButtonClick={() => null}
position={[x, y, 0]}
type={node.node_type}
url="logo.png"
width={5}
/>
) : null
})}
<mesh position={[-13, 0, 0]}>
<circleGeometry args={[3, 64]} /> {/* Radius: Half of viewport width */}
<meshBasicMaterial color="blue" />
</mesh>
</>
)
}
2 changes: 1 addition & 1 deletion src/modules/mindset/components/Scene/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const Scene = () => {

<Canvas orthographic>
<DynamicOrthographicCamera x={cameraX} />
<Board w={4} />
<Board />
<gridHelper args={[100, 100, 'white', 'gray']} />
<gridHelper args={[100, 100, 'white', 'gray']} rotation={[Math.PI / 2, 0, 0]} />

Expand Down
4 changes: 2 additions & 2 deletions src/modules/mindset/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const MindSet = () => {
handleNewNodeCreated(data)
}
} catch (error) {
console.log(error)
console.error(error)
}
}

Expand All @@ -96,7 +96,7 @@ export const MindSet = () => {
setSelectedEpisode(data)
}
} catch (error) {
console.log(error)
console.error(error)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/stores/useDataStore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export const useDataStore = create<DataStore>()(
sidebarFilterCounts,
})
} catch (error) {
console.log(error)
console.error(error)

if (error !== 'abort') {
set({ isLoadingNew: false, isFetching: false })
Expand Down Expand Up @@ -347,7 +347,7 @@ export const useDataStore = create<DataStore>()(
setHideNodeDetails: (hideNodeDetails) => set({ hideNodeDetails }),
setSeedQuestions: (questions) => set({ seedQuestions: questions }),
updateNode: (updatedNode) => {
console.log(updatedNode)
console.info(updatedNode)

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/curationTable/curation.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/sourcesTable/sourcesTable.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/admin/topics.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/checkEnv.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addSource.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/createGeneratedEdges/createGeneratedEdges.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addTweet.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/admin/signin.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addWebpage.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addContent/addYoutube.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/trendingTopics/trendingTopics.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/addNode/addNodeType.cy.ts)

Unexpected console statement

Check warning on line 350 in src/stores/useDataStore/index.ts

View workflow job for this annotation

GitHub Actions / cypress-run (cypress/e2e/seeLatest/latest.cy.ts)

Unexpected console statement
},
addNewNode: (data) => {
const { dataInitial: existingData, filters } = get()
Expand Down
4 changes: 1 addition & 3 deletions src/stores/useGraphStore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export const useGraphStore = create<GraphStore>()((set, get) => ({

simulationHelpers.simulationRestart()
} catch (error) {
console.log(error)
console.error(error)
// eslint-disable-next-line no-debugger
}

Expand Down Expand Up @@ -314,8 +314,6 @@ export const useGraphStore = create<GraphStore>()((set, get) => ({
},
},
simulationCreate: (nodes, links) => {
console.log('created')

const structuredNodes = structuredClone(nodes)
const structuredLinks = structuredClone(links)

Expand Down
2 changes: 1 addition & 1 deletion src/stores/useTopicsStore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const useTopicsStore = create<TopicsStore>((set, get) => ({

set({ loading: false })
} catch (error) {
console.log(error)
console.error(error)
}
},
setFilters: (filters: Partial<TopicFilter>) => set({ filters: { ...get().filters, page: 0, ...filters } }),
Expand Down
2 changes: 1 addition & 1 deletion src/testSphinxBridge/saveLsat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
25 changes: 0 additions & 25 deletions src/transformers/splitGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
6 changes: 1 addition & 5 deletions src/utils/relayHelper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}

0 comments on commit a63b335

Please sign in to comment.