some ux and naming cleanup
This commit is contained in:
parent
acf93695d3
commit
9ced4f6f29
BIN
build/bin/textualize.app/Contents/MacOS/Textualize
Executable file
BIN
build/bin/textualize.app/Contents/MacOS/Textualize
Executable file
Binary file not shown.
@ -8,15 +8,16 @@ type AppLayoutProps = {
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export default function MainAppLayout({ children }: AppLayoutProps) {
|
||||
return <html className='bg-gray-100 bg-opacity-0'>
|
||||
<body className='min-h-screen' >
|
||||
<ProjectProvider
|
||||
projectProps={{
|
||||
const initialProjectProps = {
|
||||
id: '',
|
||||
documents: [] as ipc.Document[],
|
||||
groups: [] as ipc.Group[]
|
||||
}}>
|
||||
}
|
||||
|
||||
export default function MainAppLayout({ children }: AppLayoutProps) {
|
||||
return <html className='bg-gray-100 bg-opacity-0'>
|
||||
<body className='min-h-screen' >
|
||||
<ProjectProvider projectProps={initialProjectProps}>
|
||||
{children}
|
||||
</ProjectProvider>
|
||||
</body>
|
||||
|
||||
@ -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() {
|
||||
<>
|
||||
<MainHead />
|
||||
<Navigation />
|
||||
|
||||
<main className=" bg-gray-100 h-[calc(100vh-4rem)] ml-64 ">
|
||||
<div className='flex-1'>
|
||||
<div className="py-6">
|
||||
<div className="mx-auto px-4 sm:px-6 md:px-8">
|
||||
<h1 className="text-2xl font-semibold text-gray-900">Dashboard</h1>
|
||||
</div>
|
||||
<div className="mx-auto px-4 sm:px-6 md:px-8">
|
||||
<div className="py-4">
|
||||
<div className=" min-h-96 rounded-lg border-4 border-dashed border-gray-200">
|
||||
<DocumentRenderer />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<MainWorkspace />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@ -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(() => {
|
||||
|
||||
29
frontend/components/workspace/Main.tsx
Normal file
29
frontend/components/workspace/Main.tsx
Normal file
@ -0,0 +1,29 @@
|
||||
'use client'
|
||||
|
||||
import { useProject } from "../../context/Project/provider"
|
||||
import DocumentRenderer from "./DocumentRenderer"
|
||||
|
||||
const MainWorkspace = () => {
|
||||
const { getSelectedDocument } = useProject()
|
||||
|
||||
return <main className=" bg-gray-100 min-h-[calc(100vh-4rem)] ml-64 ">
|
||||
<div className='flex-1'>
|
||||
<div className="py-6">
|
||||
<div className="mx-auto px-4 sm:px-6 md:px-8">
|
||||
<h1 className="text-2xl font-semibold text-gray-900">
|
||||
{ getSelectedDocument()?.name }
|
||||
</h1>
|
||||
</div>
|
||||
<div className="mx-auto px-4 sm:px-6 md:px-8">
|
||||
<div className="py-4">
|
||||
<div className=" min-h-96 border-4 border-dashed border-gray-200">
|
||||
<DocumentRenderer />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
}
|
||||
|
||||
export default MainWorkspace
|
||||
@ -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<HTMLInputElement>, callback: Function) => {
|
||||
if (event.key === 'Enter') callback()
|
||||
}
|
||||
|
||||
const renderAddGroupInput = () => {
|
||||
return isAddNewGroupInputShowing
|
||||
? <div className="mt-1 flex rounded-md shadow-sm">
|
||||
@ -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}
|
||||
/>
|
||||
</div>
|
||||
@ -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}
|
||||
/>
|
||||
</div>
|
||||
|
||||
4
main.go
4
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{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user