-
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
1 parent
75fcc5c
commit 79c9635
Showing
11 changed files
with
653 additions
and
337 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
80 changes: 80 additions & 0 deletions
80
src/components/FileSystemAdapters/FileSystem/GettingStartedHelper.tsx
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,80 @@ | ||
import DirectoryNode, { createDirectoryNode } from "../../../models/DirectoryNode"; | ||
import { Button } from "../../ui/Button"; | ||
import * as Separator from "@radix-ui/react-separator"; | ||
|
||
export function GettingStartedHelper({ | ||
selectedFile, | ||
selectedDirectory, | ||
setSelectedDirectory | ||
}: { | ||
selectedFile: DirectoryNode | null; | ||
selectedDirectory: DirectoryNode | null; | ||
setSelectedDirectory: (node: DirectoryNode | null) => void; | ||
}) { | ||
|
||
const handleDirectorySelect = async () => { | ||
try { | ||
//@ts-expect-error | ||
const directoryHandle = await window.showDirectoryPicker(); | ||
if (!directoryHandle) return; | ||
|
||
setSelectedDirectory( | ||
await createDirectoryNode(directoryHandle, undefined) | ||
); | ||
} catch (error) { | ||
console.error("Error selecting directory:", error); | ||
} | ||
}; | ||
|
||
return ( | ||
<div | ||
className="z-20 flex fixed top-[50%] left-[50%] | ||
transform translate-x-[-10%] translate-y-[-35%] | ||
" | ||
> | ||
<div className="bg-white rounded shadow-md"> | ||
<div className="mx-8 mt-8 mb-4"> | ||
<div className="flex flex-col space-y-1.5 "> | ||
<div className="text-center "> | ||
<h1 className="font-semibold text-lg leading-none tracking-tight mb-0.5"> | ||
Paginary | ||
</h1> | ||
<p className="text-muted-foreground text-sm"> | ||
A local-first open-source note taking app. | ||
</p> | ||
</div> | ||
<div className="my-2"> | ||
<Separator.Root className="bg-zinc-200 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full my-[15px]" /> | ||
</div> | ||
|
||
<div className="text-center"> | ||
<div className="mb-2"> | ||
<Button variant={"outline"} className="rounded w-full"> | ||
Create a new note | ||
</Button> | ||
</div> | ||
|
||
<div className=""> | ||
<Button | ||
variant={"link"} | ||
className="rounded w-full font-normal " | ||
> | ||
Select a location to save your notes | ||
</Button> | ||
</div> | ||
<div className=""> | ||
<Button | ||
variant={"link"} | ||
className="rounded w-full font-normal" | ||
onClick={handleDirectorySelect} | ||
> | ||
Open an existing folder | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.