diff --git a/build/bin/textualize.app/Contents/MacOS/Textualize b/build/bin/textualize.app/Contents/MacOS/Textualize new file mode 100755 index 0000000..98df797 Binary files /dev/null and b/build/bin/textualize.app/Contents/MacOS/Textualize differ diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index 5aeaeab..b8999e6 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -8,15 +8,16 @@ type AppLayoutProps = { children: React.ReactNode } +const initialProjectProps = { + id: '', + documents: [] as ipc.Document[], + groups: [] as ipc.Group[] +} + export default function MainAppLayout({ children }: AppLayoutProps) { return - + {children} diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index 18cf086..b137e83 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -1,6 +1,6 @@ import 'server-only' import MainHead from '../components/MainHead' -import DocumentRenderer from '../components/workspace/DocumentRenderer' +import MainWorkspace from '../components/workspace/Main' import Navigation from '../components/workspace/Navigation' export default function Home() { @@ -8,23 +8,7 @@ export default function Home() { <> - -
-
-
-
-

Dashboard

-
-
-
-
- -
-
-
-
-
-
+ ) } diff --git a/frontend/components/workspace/DocumentRenderer.tsx b/frontend/components/workspace/DocumentRenderer.tsx index 6cb75e0..24f8083 100644 --- a/frontend/components/workspace/DocumentRenderer.tsx +++ b/frontend/components/workspace/DocumentRenderer.tsx @@ -27,7 +27,7 @@ const DocumentRenderer = () => { const context = canvas.getContext('2d') if (!context) return - context.drawImage(image, 10, 10, image.width, image.height) + context.drawImage(image, 0, 0, image.width, image.height) } useEffect(() => { diff --git a/frontend/components/workspace/Main.tsx b/frontend/components/workspace/Main.tsx new file mode 100644 index 0000000..f5921a1 --- /dev/null +++ b/frontend/components/workspace/Main.tsx @@ -0,0 +1,29 @@ +'use client' + +import { useProject } from "../../context/Project/provider" +import DocumentRenderer from "./DocumentRenderer" + +const MainWorkspace = () => { + const { getSelectedDocument } = useProject() + + return
+
+
+
+

+ { getSelectedDocument()?.name } +

+
+
+
+
+ +
+
+
+
+
+
+} + +export default MainWorkspace diff --git a/frontend/components/workspace/Sidebar.tsx b/frontend/components/workspace/Sidebar.tsx index a69af46..b90630c 100644 --- a/frontend/components/workspace/Sidebar.tsx +++ b/frontend/components/workspace/Sidebar.tsx @@ -102,10 +102,7 @@ function Sidebar() { const response = await requestAddDocument(groupId, documentName) if (!response.id) return - setSelectedDocumentId(response.id) - - setSelectedGroupId(groupId) setIsAddNewDocumentInputShowing(false) } @@ -121,6 +118,10 @@ function Sidebar() { setIsAddNewGroupInputShowing(false) } + const onEnterHandler = (event: React.KeyboardEvent, callback: Function) => { + if (event.key === 'Enter') callback() + } + const renderAddGroupInput = () => { return isAddNewGroupInputShowing ?
@@ -129,8 +130,13 @@ function Sidebar() { type="text" name="groupName" id="groupName" + autoFocus className="text-white placeholder-gray-400 bg-gray-900 bg-opacity-5 block w-full rounded-none rounded-l-md border-late-700 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" placeholder="Add Group" + onKeyDown={(event) => { + onEnterHandler(event, + onConfirmAddGroupClickHandler) + }} ref={addGroupTextInput} />
@@ -174,6 +180,11 @@ function Sidebar() { id="documentName" className="text-white placeholder-gray-400 bg-gray-900 bg-opacity-5 block w-full rounded-none rounded-l-md border-late-700 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" placeholder="Add Document" + autoFocus + onKeyDown={(event) => { + onEnterHandler(event, + () => onConfirmAddDocumentClickHandler(groupId)) + }} ref={addDocumentTextInput} /> diff --git a/main.go b/main.go index e791961..183bb3f 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,7 @@ import ( app "textualize/core/App" document "textualize/core/Document" - Channel "textualize/ipc" + ipc "textualize/ipc" "github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2/pkg/logger" @@ -50,7 +50,7 @@ func main() { app := app.GetInstance() document.InitizeModule() - ipcChannel := Channel.GetInstance() + ipcChannel := ipc.GetInstance() // Create application with options err := wails.Run(&options.App{