-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from Itheum/milestone-1.5.0
1.5.0 -> STG
- Loading branch information
Showing
35 changed files
with
1,665 additions
and
2,479 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
import React, { PropsWithChildren } from "react"; | ||
import { Navigate } from "react-router-dom"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { useGetIsLoggedIn } from "hooks"; | ||
import { routeNames } from "routes"; | ||
|
||
export const AuthRedirectWrapper = ({ children }: PropsWithChildren) => { | ||
const isLoggedIn = useGetIsLoggedIn(); | ||
const navigate = useNavigate(); | ||
|
||
// if (isLoggedIn) { | ||
// return <Navigate to={routeNames.dashboard} />; | ||
// } | ||
if (isLoggedIn) { | ||
navigate(routeNames.dashboard); | ||
} | ||
|
||
return <>{children}</>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.zoomable-toolbar-button { | ||
display: block; | ||
width: 2.5rem; | ||
height: 2.5rem; | ||
margin: 1px 2px; | ||
color: rgb(255, 255, 255); | ||
transition: color 200ms ease 0s; | ||
background: none; | ||
padding: 0px; | ||
border: 0px; | ||
outline: 0px; | ||
cursor: pointer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import React, { useRef } from "react"; | ||
import SVG from "react-inlinesvg"; | ||
import { | ||
TransformWrapper, | ||
TransformComponent, | ||
ReactZoomPanPinchRef, | ||
} from "react-zoom-pan-pinch"; | ||
import svgReset from "./Reset.svg"; | ||
import svgZoomIn from "./ZoomIn.svg"; | ||
import svgZoomOut from "./ZoomOut.svg"; | ||
import "./index.scss"; | ||
|
||
const INITIAL_SCALE = 2; | ||
|
||
export const ZoomableSvg = ({ | ||
data, | ||
preProcess, | ||
} : { | ||
data: any, | ||
preProcess: any, | ||
}) => { | ||
const transformComponentRef = useRef<ReactZoomPanPinchRef | null>(null); | ||
|
||
const actionZoomIn = () => { | ||
if (transformComponentRef.current) { | ||
const { zoomIn } = transformComponentRef.current; | ||
zoomIn(); | ||
} | ||
}; | ||
|
||
const actionZoomOut = () => { | ||
if (transformComponentRef.current) { | ||
const { zoomOut } = transformComponentRef.current; | ||
zoomOut(); | ||
} | ||
}; | ||
|
||
const actionReset = () => { | ||
if (transformComponentRef.current) { | ||
const { centerView } = transformComponentRef.current; | ||
centerView(INITIAL_SCALE); | ||
} | ||
}; | ||
|
||
return ( | ||
<TransformWrapper | ||
initialScale={INITIAL_SCALE} | ||
centerOnInit | ||
centerZoomedOut | ||
initialPositionX={0} | ||
initialPositionY={0} | ||
ref={transformComponentRef} | ||
wheel={{ | ||
// step: 0.5, | ||
smoothStep: 0.004, | ||
}} | ||
// pinch={{ | ||
// step: 0.5, | ||
// }} | ||
> | ||
<React.Fragment> | ||
<TransformComponent | ||
wrapperStyle={{ | ||
width: '100%', | ||
height: '100%', | ||
}} | ||
contentStyle={{ | ||
height: "100%", | ||
// width: "auto", | ||
}} | ||
> | ||
<SVG | ||
id="zoomable-svg" | ||
src={data} | ||
preProcessor={(code) => preProcess(code)} | ||
// style={{ width: "100%", height: "auto" }} | ||
/> | ||
</TransformComponent> | ||
|
||
<div | ||
style={{ | ||
position: "absolute", | ||
top: "1rem", | ||
left: "unset", | ||
right: "1rem", | ||
bottom: "unset", | ||
backgroundColor: "rgba(19, 20, 22, 0.9)", | ||
borderRadius: "2px", | ||
display: "flex", | ||
flexDirection: "column", | ||
padding: "2px 1px", | ||
}} | ||
> | ||
<button | ||
className="zoomable-toolbar-button" | ||
onClick={actionZoomIn} | ||
> | ||
<img src={svgZoomIn} style={{ width: "100%", height: "100%" }} /> | ||
</button> | ||
<button | ||
className="zoomable-toolbar-button" | ||
onClick={actionZoomOut} | ||
> | ||
<img src={svgZoomOut} style={{ width: "100%", height: "100%" }} /> | ||
</button> | ||
<button | ||
className="zoomable-toolbar-button" | ||
onClick={actionReset} | ||
> | ||
<img src={svgReset} style={{ width: "100%", height: "100%" }} /> | ||
</button> | ||
</div> | ||
</React.Fragment> | ||
</TransformWrapper> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.