Skip to content

Commit f0b2a1d

Browse files
committed
feat: update element positions
1 parent d581192 commit f0b2a1d

File tree

6 files changed

+50
-45
lines changed

6 files changed

+50
-45
lines changed

src/features/editor/Toolbar/Logo.tsx

-11
This file was deleted.
+34-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { Flex, Text, TextInput } from "@mantine/core";
2+
import { Box, Flex, Text, TextInput } from "@mantine/core";
33
import { getHotkeyHandler } from "@mantine/hooks";
44
import { AiOutlineSearch } from "react-icons/ai";
55
import { useFocusNode } from "../../../hooks/useFocusNode";
@@ -8,29 +8,38 @@ export const SearchInput = () => {
88
const [searchValue, setValue, skip, nodeCount, currentNode] = useFocusNode();
99

1010
return (
11-
<TextInput
12-
variant="unstyled"
13-
type="search"
14-
size="xs"
15-
id="search-node"
16-
w={180}
17-
value={searchValue}
18-
onChange={e => setValue(e.currentTarget.value)}
19-
placeholder="Search Node"
20-
autoComplete="off"
21-
autoCorrect="off"
22-
onKeyDown={getHotkeyHandler([["Enter", skip]])}
23-
leftSection={<AiOutlineSearch />}
24-
rightSection={
25-
searchValue && (
26-
<Flex h={30} align="center">
27-
<Text size="xs" c="dimmed" pr="md">
28-
{searchValue && `${nodeCount}/${nodeCount > 0 ? currentNode + 1 : "0"}`}
29-
</Text>
30-
</Flex>
31-
)
32-
}
33-
style={{ borderBottom: "1px solid gray" }}
34-
/>
11+
<Box
12+
style={{
13+
position: "absolute",
14+
bottom: "10px",
15+
left: "10px",
16+
zIndex: 100,
17+
}}
18+
>
19+
<TextInput
20+
variant="unstyled"
21+
type="search"
22+
size="xs"
23+
id="search-node"
24+
w={180}
25+
value={searchValue}
26+
onChange={e => setValue(e.currentTarget.value)}
27+
placeholder="Search Node"
28+
autoComplete="off"
29+
autoCorrect="off"
30+
onKeyDown={getHotkeyHandler([["Enter", skip]])}
31+
leftSection={<AiOutlineSearch />}
32+
rightSection={
33+
searchValue && (
34+
<Flex h={30} align="center">
35+
<Text size="xs" c="dimmed" pr="md">
36+
{searchValue && `${nodeCount}/${nodeCount > 0 ? currentNode + 1 : "0"}`}
37+
</Text>
38+
</Flex>
39+
)
40+
}
41+
style={{ borderBottom: "1px solid gray" }}
42+
/>
43+
</Box>
3544
);
3645
};

src/features/editor/Toolbar/index.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { JSONCrackLogo } from "../../../layout/JsonCrackLogo";
1010
import useFile from "../../../store/useFile";
1111
import useModal from "../../../store/useModal";
1212
import { FileMenu } from "./FileMenu";
13-
import { Logo } from "./Logo";
1413
import { ToolsMenu } from "./ToolsMenu";
1514
import { ViewMenu } from "./ViewMenu";
1615
import { StyledToolElement } from "./styles";
@@ -55,7 +54,13 @@ export const Toolbar = ({ isWidget = false }: ToolbarProps) => {
5554

5655
return (
5756
<StyledTools>
58-
{isWidget && <Logo />}
57+
{isWidget && (
58+
<StyledToolElement title="JSON Crack">
59+
<Flex gap="xs" align="center" justify="center">
60+
<JSONCrackLogo fontSize="0.8rem" hideLogo />
61+
</Flex>
62+
</StyledToolElement>
63+
)}
5964
{!isWidget && (
6065
<Group gap="xs" justify="left" w="100%" style={{ flexWrap: "nowrap" }}>
6166
<StyledToolElement title="JSON Crack">

src/features/editor/views/GraphView/OptionsMenu.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import useToggleHide from "../../../../hooks/useToggleHide";
1111
import useConfig from "../../../../store/useConfig";
1212
import useModal from "../../../../store/useModal";
1313
import type { LayoutDirection } from "../../../../types/graph";
14-
import { SearchInput } from "../../Toolbar/SearchInput";
1514
import useGraph from "./stores/useGraph";
1615

1716
const StyledFlowIcon = styled(TiFlowMerge)<{ rotate: number }>`
@@ -32,7 +31,7 @@ const rotateLayout = (direction: LayoutDirection) => {
3231
return 360;
3332
};
3433

35-
export const OptionsMenu = ({ isWidget = false }) => {
34+
export const OptionsMenu = () => {
3635
const toggleGestures = useConfig(state => state.toggleGestures);
3736
const toggleChildrenCount = useConfig(state => state.toggleChildrenCount);
3837
const toggleRulers = useConfig(state => state.toggleRulers);
@@ -91,15 +90,15 @@ export const OptionsMenu = ({ isWidget = false }) => {
9190
align="center"
9291
style={{
9392
position: "absolute",
94-
bottom: "10px",
93+
top: "10px",
9594
left: "10px",
9695
zIndex: 100,
9796
}}
9897
>
9998
<Menu withArrow>
10099
<Menu.Target>
101-
<ActionIcon variant="light" color="gray">
102-
<LuMenu />
100+
<ActionIcon aria-label="actions" size="lg" color="gray" variant="light">
101+
<LuMenu size="18" />
103102
</ActionIcon>
104103
</Menu.Target>
105104
<Menu.Dropdown>
@@ -212,7 +211,6 @@ export const OptionsMenu = ({ isWidget = false }) => {
212211
</Menu>
213212
</Menu.Dropdown>
214213
</Menu>
215-
{!isWidget && <SearchInput />}
216214
</Flex>
217215
);
218216
};

src/features/editor/views/GraphView/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { ElkRoot } from "reaflow/dist/layout/useLayout";
88
import { useLongPress } from "use-long-press";
99
import useToggleHide from "../../../../hooks/useToggleHide";
1010
import useConfig from "../../../../store/useConfig";
11+
import { SearchInput } from "../../Toolbar/SearchInput";
1112
import { CustomEdge } from "./CustomEdge";
1213
import { CustomNode } from "./CustomNode";
1314
import { NotSupported } from "./NotSupported";
@@ -176,7 +177,8 @@ export const GraphView = ({ isWidget = false }: GraphProps) => {
176177
return (
177178
<>
178179
<LoadingOverlay visible={loading} />
179-
<OptionsMenu isWidget={isWidget} />
180+
{!isWidget && <OptionsMenu />}
181+
{!isWidget && <SearchInput />}
180182
<ZoomControl />
181183
<StyledEditorWrapper
182184
$widget={isWidget}

src/features/modals/UpgradeModal/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
Image,
1515
Box,
1616
CloseButton,
17+
FocusTrap,
1718
} from "@mantine/core";
1819
import Cookie from "js-cookie";
1920
import { LuCheck, LuZap } from "react-icons/lu";
@@ -103,6 +104,7 @@ export const UpgradeModal = ({ opened, onClose }: ModalProps) => {
103104
withCloseButton={false}
104105
closeOnClickOutside={false}
105106
>
107+
<FocusTrap.InitialFocus />
106108
<Flex justify="center" align="center" gap="xs">
107109
<Image
108110
ml="auto"

0 commit comments

Comments
 (0)