summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-07-31 11:17:58 +0200
committerThomas F. K. Jorna <[email protected]>2021-07-31 11:17:58 +0200
commit1bd37ff86e5d5e2397b77c10fcc90e80bfbfce49 (patch)
treeaa8c5ff3fd6927c8e6ee178ce837e50ed7fcb25d
parent1e4f74c0c8b83068fdc49037064964b8a5a3d6c5 (diff)
refactoring
-rw-r--r--components/config.ts2
-rw-r--r--components/tweaks.tsx33
-rw-r--r--pages/index.tsx8
3 files changed, 24 insertions, 19 deletions
diff --git a/components/config.ts b/components/config.ts
index fdb4145..c2f8ff5 100644
--- a/components/config.ts
+++ b/components/config.ts
@@ -73,7 +73,7 @@ export const initialVisuals = {
nodeHighlight: '',
linkHighlight: 'purple.500',
backgroundColor: 'white',
- emacsNodeColor: 'grey.800',
+ emacsNodeColor: 'gray.800',
labelTextColor: 'black',
labelBackgroundColor: 'white',
labelBackgroundOpacity: 0.7,
diff --git a/components/tweaks.tsx b/components/tweaks.tsx
index b2b0aaf..b5ce2ec 100644
--- a/components/tweaks.tsx
+++ b/components/tweaks.tsx
@@ -37,6 +37,7 @@ import {
Collapse,
Grid,
Portal,
+ SlideFade,
} from '@chakra-ui/react'
import React, { useState, useContext } from 'react'
import Scrollbars from 'react-custom-scrollbars-2'
@@ -102,20 +103,22 @@ export const Tweaks = (props: TweakProps) => {
]
return (
<>
- <Box
- position="relative"
- zIndex="overlay"
- marginTop={10}
- marginLeft={10}
- display={showTweaks ? 'none' : 'block'}
- >
- <IconButton
- aria-label="Settings"
- icon={<SettingsIcon />}
- onClick={() => setShowTweaks(true)}
- />
- </Box>
- <Collapse in={showTweaks} animateOpacity>
+ <SlideFade in={!showTweaks} animateOpacity>
+ <Box
+ position="absolute"
+ zIndex="overlay"
+ marginTop={10}
+ marginLeft={10}
+ display={showTweaks ? 'none' : 'block'}
+ >
+ <IconButton
+ aria-label="Settings"
+ icon={<SettingsIcon />}
+ onClick={() => setShowTweaks(true)}
+ />
+ </Box>
+ </SlideFade>
+ <SlideFade in={showTweaks} animateOpacity>
<Box
bg="alt.100"
w="xs"
@@ -1191,7 +1194,7 @@ export const Tweaks = (props: TweakProps) => {
</Accordion>
</Scrollbars>
</Box>
- </Collapse>
+ </SlideFade>
</>
)
}
diff --git a/pages/index.tsx b/pages/index.tsx
index b414bf8..7c943cf 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -253,16 +253,17 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) {
//mouse.highlight:
case mouse.local: {
if (scope.nodeIds.includes(node.id as string)) {
- return
+ break
}
setScope((currentScope) => ({
...currentScope,
nodeIds: [...currentScope.nodeIds, node.id as string],
}))
+ break
}
case mouse.follow: {
window.open('org-protocol://roam-node?node=' + node.id, '_self')
- return
+ break
}
default:
break
@@ -287,7 +288,7 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) {
setScope({ nodeIds: [emacsNodeId] })
setTimeout(() => {
fg?.zoomToFit(
- 1000,
+ 2000,
numberWithinRange(20, 200, windowWidth / 8),
(node: NodeObject) => getNeighborNodes(emacsNodeId)[node.id!],
)
@@ -442,6 +443,7 @@ export const Graph = forwardRef(function (props: GraphProps, graphRef: any) {
const themeContext = useContext<ThemeContextProps>(ThemeContext)
const getThemeColor = (name: string) => {
+ console.log(name)
if (!theme) {
return
}