generated from electron-react-boilerplate/electron-react-boilerplate
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
191 additions
and
76 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// External Dependencies | ||
import { Plus } from 'lucide-react'; | ||
|
||
// Relative Dependencies | ||
import Workspaces from './components/workspaces'; | ||
import ActivePrograms from './components/active-programs'; | ||
import { | ||
ResizablePanelGroup, | ||
ResizablePanel, | ||
ResizableHandle, | ||
} from './components/ui/resizeable-panel'; | ||
import { Button } from './components/ui/button'; | ||
|
||
type Props = {}; | ||
|
||
const Main = (props: Props) => { | ||
const onClick = async () => { | ||
try { | ||
const programs = window.electron.ipcRenderer.invoke( | ||
'get-running-programs', | ||
); | ||
console.log(programs); | ||
} catch (error) { | ||
console.log('there was an error'); | ||
} | ||
}; | ||
|
||
return ( | ||
<ResizablePanelGroup className="w-full h-full" direction="horizontal"> | ||
<ResizablePanel defaultSize={33.3} className="h-full" minSize={20}> | ||
<div className="border-r bg-background h-full"> | ||
<div className="space-y-2"> | ||
<div className="flex flex-row items-center w-full border-b"> | ||
<h3 className="text-lg font-medium p-2 border-gray-200"> | ||
My Workspaces | ||
</h3> | ||
<Button onClick={onClick} size="sm" className="ml-auto mr-2"> | ||
<Plus className="mr-2 h-4 w-4" /> New Workspace | ||
</Button> | ||
</div> | ||
|
||
<Workspaces /> | ||
|
||
<h3 className="text-lg font-medium p-2">Active Programs</h3> | ||
<ActivePrograms /> | ||
</div> | ||
</div> | ||
</ResizablePanel> | ||
<ResizableHandle /> | ||
<ResizablePanel defaultSize={33.3} minSize={20}> | ||
<div className="border-r bg-background "> | ||
<div className="space-y-2"> | ||
<h3 className="text-lg font-medium p-2 border-gray-200 border-b"> | ||
Programs | ||
</h3> | ||
</div> | ||
</div> | ||
</ResizablePanel> | ||
<ResizableHandle /> | ||
<ResizablePanel defaultSize={33.3} minSize={20}> | ||
<div className="flex flex-col bg-background"> | ||
<div className="space-y-2"> | ||
<h3 className="text-lg font-medium p-2 border-gray-200 border-b"> | ||
Tabs | ||
</h3> | ||
</div> | ||
</div> | ||
</ResizablePanel> | ||
{/* </div> */} | ||
</ResizablePanelGroup> | ||
); | ||
}; | ||
|
||
export default Main; |
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,25 @@ | ||
import React from 'react'; | ||
|
||
type Props = {}; | ||
|
||
const ActivePrograms = (props: Props) => { | ||
const activePrograms = ['Personal Programming', 'Shopping', 'Travel', 'Work']; | ||
|
||
return ( | ||
<div className="flex flex-col flex-1 overflow-y-auto"> | ||
<ul className=""> | ||
{activePrograms.map((program, index) => ( | ||
<li | ||
className="flex items-center space-x-2 hover:bg-slate-200 hover:cursor-pointer p-2" | ||
key={program} | ||
> | ||
{/* <FolderIcon className="w-5 h-5 text-blue-500" /> */} | ||
<span>{program}</span> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ActivePrograms; |
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,43 @@ | ||
import { GripVertical } from 'lucide-react'; | ||
import * as ResizablePrimitive from 'react-resizable-panels'; | ||
|
||
import { cn } from '~/lib/utils'; | ||
|
||
const ResizablePanelGroup = ({ | ||
className, | ||
...props | ||
}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => ( | ||
<ResizablePrimitive.PanelGroup | ||
className={cn( | ||
'flex h-full w-full data-[panel-group-direction=vertical]:flex-col', | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
); | ||
|
||
const ResizablePanel = ResizablePrimitive.Panel; | ||
|
||
const ResizableHandle = ({ | ||
withHandle, | ||
className, | ||
...props | ||
}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & { | ||
withHandle?: boolean; | ||
}) => ( | ||
<ResizablePrimitive.PanelResizeHandle | ||
className={cn( | ||
'relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90', | ||
className, | ||
)} | ||
{...props} | ||
> | ||
{withHandle && ( | ||
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border"> | ||
<GripVertical className="h-2.5 w-2.5" /> | ||
</div> | ||
)} | ||
</ResizablePrimitive.PanelResizeHandle> | ||
); | ||
|
||
export { ResizablePanelGroup, ResizablePanel, ResizableHandle }; |
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,34 @@ | ||
// External Dependencies | ||
import { useState } from 'react'; | ||
|
||
// Relative Dependencies | ||
import { Button } from './ui/button'; | ||
|
||
type Props = {}; | ||
|
||
const Workspaces = (props: Props) => { | ||
const workspaces = [ | ||
'Personal Programming super long name', | ||
'Shopping', | ||
'Travel', | ||
'Work', | ||
]; | ||
|
||
return ( | ||
<div className="flex flex-col flex-1 overflow-y-auto"> | ||
<ul className=""> | ||
{workspaces.map((workspace, index) => ( | ||
<li | ||
className="flex items-center space-x-2 hover:bg-slate-200 hover:cursor-pointer p-2" | ||
key={workspace} | ||
> | ||
{/* <FolderIcon className="w-5 h-5 text-blue-500" /> */} | ||
<span>{workspace}</span> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Workspaces; |