diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index cf3d64f..4d5442e 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -132,6 +132,19 @@ function rotateLayout(direction: "LEFT" | "RIGHT" | "DOWN" | "UP") { return 360; } +const SidebarButton: React.FC<{ + onClick: () => void; + deviceDisplay?: "desktop" | "mobile"; + title: string; + component: React.ReactNode; +}> = ({ onClick, deviceDisplay, title, component }) => { + return ( + + {component} + + ); +}; + export const Sidebar: React.FC = () => { const setVisible = useModal(state => state.setVisible); const setDirection = useGraph(state => state.setDirection); @@ -184,77 +197,84 @@ export const Sidebar: React.FC = () => { - - toggleFullscreen(!fullscreen)}> - - - + toggleFullscreen(!fullscreen)} + component={} + /> - - setVisible("import")(true)}> - - - + setVisible("import")(true)} + component={} + /> - - - - - + } + /> - - - - - + } + /> - - - {foldNodes ? : } - - + : } + /> - - - {graphCollapsed ? : } - - + : } + /> - - - - - + } + /> - - setVisible("download")(true)}> - - - + setVisible("download")(true)} + component={} + /> - - setVisible("clear")(true)}> - - - + setVisible("clear")(true)} + component={} + /> - - setVisible("cloud")(true)}> - - - + setVisible("cloud")(true)} + component={} + /> - - setVisible("account")(true)}> - - - - - setVisible("settings")(true)}> - - - + setVisible("account")(true)} + component={} + /> + setVisible("settings")(true)} + component={} + /> ); diff --git a/src/components/Tooltip/index.tsx b/src/components/Tooltip/index.tsx index 6d18dc5..d07f63a 100644 --- a/src/components/Tooltip/index.tsx +++ b/src/components/Tooltip/index.tsx @@ -5,14 +5,9 @@ interface TooltipProps extends React.ComponentPropsWithoutRef<"div"> { title?: string; } -const StyledTooltipWrapper = styled.div` - position: relative; - width: fit-content; - height: 100%; -`; - -const StyledTooltip = styled.div<{ visible: boolean }>` +const StyledTooltip = styled.div` position: absolute; + display: none; top: 0; right: 0; transform: translate(calc(100% + 15px), 25%); @@ -21,7 +16,6 @@ const StyledTooltip = styled.div<{ visible: boolean }>` color: ${({ theme }) => theme.TEXT_NORMAL}; border-radius: 5px; padding: 6px 8px; - display: ${({ visible }) => (visible ? "initial" : "none")}; white-space: nowrap; font-family: "Mona Sans"; font-size: 16px; @@ -47,22 +41,23 @@ const StyledTooltip = styled.div<{ visible: boolean }>` } `; -const StyledChildren = styled.div``; +const StyledTooltipWrapper = styled.div` + position: relative; + width: fit-content; + height: 100%; + + &:hover ${StyledTooltip} { + display: initial; + } +`; export const Tooltip: React.FC> = ({ children, title, ...props -}) => { - const [visible, setVisible] = React.useState(false); - - return ( - - {title && {title}} - - setVisible(true)} onMouseLeave={() => setVisible(false)}> - {children} - - - ); -}; +}) => ( + + {title && {title}} +
{children}
+
+); diff --git a/src/containers/Modals/CloudModal/index.tsx b/src/containers/Modals/CloudModal/index.tsx index 84d2d1b..308fd7e 100644 --- a/src/containers/Modals/CloudModal/index.tsx +++ b/src/containers/Modals/CloudModal/index.tsx @@ -152,11 +152,9 @@ const CreateCard: React.FC = () => ( ); export const CloudModal: React.FC = ({ visible, setVisible }) => { - const { isReady, query } = useRouter(); + const { query } = useRouter(); - const { data, isFetching, refetch } = useQuery(["allJson", query], () => getAllJson(), { - enabled: isReady, - }); + const { data, isFetching, refetch } = useQuery(["allJson", query], () => getAllJson()); return ( diff --git a/src/services/db/json.tsx b/src/services/db/json.tsx index 498fed3..b747c5f 100644 --- a/src/services/db/json.tsx +++ b/src/services/db/json.tsx @@ -24,7 +24,7 @@ const saveJson = async ({ id, data }): Promise<{ data: { _id: string } }> => { }); }; -const getAllJson = async (): Promise<{ data: JSON[] }> => await altogic.endpoint.get(`json`); +const getAllJson = async (): Promise<{ data: { result: JSON[] } }> => await altogic.endpoint.get(`json`); const updateJson = async (id: string, data: object) => await altogic.endpoint.put(`json/${id}`, {