-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Show workspace open error states * Run biome * Move tauri utils out of generic utils * Add recent workspaceS
- Loading branch information
Showing
7 changed files
with
129 additions
and
5 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
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 |
---|---|---|
@@ -1,17 +1,48 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { useContext } from "react"; | ||
import { Card } from "@/components/ui/card"; | ||
import { cn } from "@/utils"; | ||
import { useContext, useEffect, useState } from "react"; | ||
import { RuntimeContext } from "../RuntimeProvider"; | ||
import { listRecentWorkspaces } from "../utils"; | ||
|
||
export function WorkspaceSelector() { | ||
const runtime = useContext(RuntimeContext); | ||
const [paths, setPaths] = useState<Array<string>>([]); | ||
|
||
useEffect(() => { | ||
listRecentWorkspaces().then(setPaths); | ||
}, []); | ||
|
||
if (runtime?.type !== "tauri") { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="w-screen h-screen flex flex-col items-center justify-center"> | ||
<Button onClick={runtime.requestOpenWorkspaceDialog}>Open</Button> | ||
<Card className="p-4 flex flex-col gap-8 w-full h-full"> | ||
<strong>Recent projects</strong> | ||
<div className="flex flex-col gap-4"> | ||
{paths.map((path) => ( | ||
<button | ||
key={path} | ||
className={cn( | ||
"flex items-center p-4", | ||
"border-l-2 border-transparent", | ||
"hover:bg-primary/10 hover:border-blue-500", | ||
"transition-all", | ||
"cursor-pointer", | ||
)} | ||
onClick={() => runtime.requestOpenWorkspaceByPath(path)} | ||
type="button" | ||
> | ||
{path} | ||
</button> | ||
))} | ||
</div> | ||
<Button onClick={runtime.requestOpenWorkspaceDialog}> | ||
Open workspace... | ||
</Button> | ||
</Card> | ||
</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