|
@@ -4,8 +4,6 @@ import Link from "next/link";
|
|
import styled from "styled-components";
|
|
import styled from "styled-components";
|
|
import { CanvasDirection } from "reaflow";
|
|
import { CanvasDirection } from "reaflow";
|
|
import { TiFlowMerge } from "react-icons/ti";
|
|
import { TiFlowMerge } from "react-icons/ti";
|
|
-import { BsList } from "react-icons/bs";
|
|
|
|
-import { MdUploadFile } from "react-icons/md";
|
|
|
|
import { RiPatreonFill } from "react-icons/ri";
|
|
import { RiPatreonFill } from "react-icons/ri";
|
|
import { CgArrowsMergeAltH, CgArrowsShrinkH } from "react-icons/cg";
|
|
import { CgArrowsMergeAltH, CgArrowsShrinkH } from "react-icons/cg";
|
|
import {
|
|
import {
|
|
@@ -20,15 +18,16 @@ import { Tooltip } from "src/components/Tooltip";
|
|
import { ConfigActionType } from "src/reducer/reducer";
|
|
import { ConfigActionType } from "src/reducer/reducer";
|
|
import { useConfig } from "src/hocs/config";
|
|
import { useConfig } from "src/hocs/config";
|
|
import { useRouter } from "next/router";
|
|
import { useRouter } from "next/router";
|
|
|
|
+import { ImportModal } from "src/containers/ImportModal";
|
|
|
|
|
|
const StyledSidebar = styled.div`
|
|
const StyledSidebar = styled.div`
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
align-items: center;
|
|
- width: 36px;
|
|
|
|
|
|
+ width: fit-content;
|
|
background: ${({ theme }) => theme.BACKGROUND_TERTIARY};
|
|
background: ${({ theme }) => theme.BACKGROUND_TERTIARY};
|
|
- padding: 8px;
|
|
|
|
|
|
+ padding: 4px;
|
|
border-right: 1px solid ${({ theme }) => theme.BACKGROUND_MODIFIER_ACCENT};
|
|
border-right: 1px solid ${({ theme }) => theme.BACKGROUND_MODIFIER_ACCENT};
|
|
`;
|
|
`;
|
|
|
|
|
|
@@ -37,19 +36,23 @@ const StyledElement = styled.div`
|
|
justify-content: center;
|
|
justify-content: center;
|
|
text-align: center;
|
|
text-align: center;
|
|
font-size: 28px;
|
|
font-size: 28px;
|
|
- font-weight: 700;
|
|
|
|
|
|
+ font-weight: 600;
|
|
width: 100%;
|
|
width: 100%;
|
|
color: ${({ theme }) => theme.INTERACTIVE_NORMAL};
|
|
color: ${({ theme }) => theme.INTERACTIVE_NORMAL};
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
|
|
|
- &:hover :is(a, svg) {
|
|
|
|
- color: ${({ theme }) => theme.INTERACTIVE_HOVER};
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
svg {
|
|
svg {
|
|
- padding: 8px 0;
|
|
|
|
|
|
+ padding: 8px;
|
|
vertical-align: middle;
|
|
vertical-align: middle;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ a {
|
|
|
|
+ display: flex;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ &:hover :is(a, svg) {
|
|
|
|
+ color: ${({ theme }) => theme.INTERACTIVE_HOVER};
|
|
|
|
+ }
|
|
`;
|
|
`;
|
|
|
|
|
|
const StyledText = styled.span<{ secondary?: boolean }>`
|
|
const StyledText = styled.span<{ secondary?: boolean }>`
|
|
@@ -90,14 +93,6 @@ const StyledLogo = styled.div`
|
|
color: ${({ theme }) => theme.FULL_WHITE};
|
|
color: ${({ theme }) => theme.FULL_WHITE};
|
|
`;
|
|
`;
|
|
|
|
|
|
-const StyledImportFile = styled.label`
|
|
|
|
- cursor: pointer;
|
|
|
|
-
|
|
|
|
- input[type="file"] {
|
|
|
|
- display: none;
|
|
|
|
- }
|
|
|
|
-`;
|
|
|
|
-
|
|
|
|
function rotateLayout(layout: CanvasDirection) {
|
|
function rotateLayout(layout: CanvasDirection) {
|
|
if (layout === "LEFT") return 90;
|
|
if (layout === "LEFT") return 90;
|
|
if (layout === "UP") return 180;
|
|
if (layout === "UP") return 180;
|
|
@@ -109,6 +104,7 @@ export const Sidebar: React.FC = () => {
|
|
const { json, settings, dispatch } = useConfig();
|
|
const { json, settings, dispatch } = useConfig();
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
const [jsonFile, setJsonFile] = React.useState<File | null>(null);
|
|
const [jsonFile, setJsonFile] = React.useState<File | null>(null);
|
|
|
|
+ const [modalVisible, setModalVisible] = React.useState(false);
|
|
|
|
|
|
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
if (e.target.files) setJsonFile(e.target.files?.item(0));
|
|
if (e.target.files) setJsonFile(e.target.files?.item(0));
|
|
@@ -147,6 +143,7 @@ export const Sidebar: React.FC = () => {
|
|
return (
|
|
return (
|
|
<StyledSidebar>
|
|
<StyledSidebar>
|
|
<StyledTopWrapper>
|
|
<StyledTopWrapper>
|
|
|
|
+ <ImportModal visible={modalVisible} setVisible={setModalVisible} />
|
|
<Link passHref href="/">
|
|
<Link passHref href="/">
|
|
<StyledElement onClick={() => router.push("/")}>
|
|
<StyledElement onClick={() => router.push("/")}>
|
|
<StyledLogo>
|
|
<StyledLogo>
|
|
@@ -156,16 +153,8 @@ export const Sidebar: React.FC = () => {
|
|
</StyledElement>
|
|
</StyledElement>
|
|
</Link>
|
|
</Link>
|
|
<Tooltip title="Import File">
|
|
<Tooltip title="Import File">
|
|
- <StyledElement>
|
|
|
|
- <StyledImportFile>
|
|
|
|
- <input
|
|
|
|
- key={jsonFile?.name}
|
|
|
|
- onChange={handleFileChange}
|
|
|
|
- type="file"
|
|
|
|
- accept="application/JSON"
|
|
|
|
- />
|
|
|
|
- <AiOutlineFileAdd />
|
|
|
|
- </StyledImportFile>
|
|
|
|
|
|
+ <StyledElement onClick={() => setModalVisible(true)}>
|
|
|
|
+ <AiOutlineFileAdd />
|
|
</StyledElement>
|
|
</StyledElement>
|
|
</Tooltip>
|
|
</Tooltip>
|
|
<Tooltip title="Rotate Layout">
|
|
<Tooltip title="Rotate Layout">
|