mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
Tauri and login for open ai
This commit is contained in:
1 parent
94f2d2ec68
commit
4eed156da5
2 files changed
+34
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { useParams } from "react-router-dom";
|
||||
import { withProtectionRoute } from "~/components/hoc";
|
||||
import { useRenderCounter } from "~/hooks/useRenderCounter";
|
||||
import { Resource, invoke } from '@tauri-apps/api/core';
|
||||
|
||||
// Components of the page
|
||||
import { ToolbarUserProfile } from "~/components/features";
|
||||
@@ -26,6 +27,11 @@ import {
|
||||
} from "@fortawesome/pro-solid-svg-icons";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
|
||||
export const isTauri = (): boolean => {
|
||||
console.log(window.__TAURI_INTERNALS__);
|
||||
return window.__TAURI_INTERNALS__;
|
||||
};
|
||||
|
||||
export const Main = withProtectionRoute(() => {
|
||||
// This is a hook that will log the number of times the component has rerendered
|
||||
// Let's make sure we only log once
|
||||
@@ -40,7 +46,7 @@ export const Main = withProtectionRoute(() => {
|
||||
const realtimeEngineRef = useRef<EngineType | null>(null);
|
||||
const generationEngineRef = useRef<GenerationEngine | null>(null);
|
||||
const [firstTimeDialogOpen, setFirstTimeDialogOpen] = useState(true);
|
||||
|
||||
const [signinDialogOpen, setSigninDialogOpen] = useState(false);
|
||||
const appModeValue = appMode.value;
|
||||
let childView;
|
||||
|
||||
@@ -97,7 +103,7 @@ export const Main = withProtectionRoute(() => {
|
||||
}}
|
||||
className="max-w-5xl"
|
||||
>
|
||||
<div className="flex flex-col items-center justify-center gap-6">
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
<div className="flex flex-col items-center gap-3">
|
||||
<h1 className="text-3xl font-bold">
|
||||
<FontAwesomeIcon
|
||||
@@ -123,7 +129,22 @@ export const Main = withProtectionRoute(() => {
|
||||
</video>
|
||||
</div>
|
||||
<Button
|
||||
className="px-4 py-3 font-semibold"
|
||||
className="font-semibold"
|
||||
icon={faArrowRight}
|
||||
iconFlip={true}
|
||||
onClick={async () => {
|
||||
if (isTauri()) {
|
||||
await invoke('open_login_command');
|
||||
setFirstTimeDialogOpen(false);
|
||||
} else {
|
||||
console.error('Tauri is not available in this environment');
|
||||
}
|
||||
}}
|
||||
>
|
||||
Signin to OpenAI to get Started
|
||||
</Button>
|
||||
{/* <Button
|
||||
className="font-semibold"
|
||||
icon={faArrowRight}
|
||||
iconFlip={true}
|
||||
onClick={() => {
|
||||
@@ -131,7 +152,7 @@ export const Main = withProtectionRoute(() => {
|
||||
}}
|
||||
>
|
||||
Start creating now
|
||||
</Button>
|
||||
</Button> */}
|
||||
</div>
|
||||
</BaseDialog>
|
||||
</>
|
||||
|
||||
@@ -5,12 +5,20 @@ set -euxo pipefail
|
||||
# Tauri doesn't let you configure the frontend project directory statically, though they do provide an
|
||||
# environment variable to pass it to the CLI. Without doing this, the tauri cli randomly walks the
|
||||
# filesystem and finds the wrong frontend code.
|
||||
|
||||
# Kill any process running on port 5741
|
||||
if lsof -i tcp:5741 &>/dev/null; then
|
||||
lsof -i tcp:5741 -t | xargs kill -9
|
||||
echo "Killed process running on port 5741"
|
||||
else
|
||||
echo "No process running on port 5741"
|
||||
fi
|
||||
# TODO(bt,2025-02-13): This is not the correct way to get the root dir
|
||||
brew install pkg-config pixman cairo pango libpng jpeg giflib librsvg
|
||||
root_dir=$(pwd)
|
||||
frontend_path="${root_dir}/frontend"
|
||||
|
||||
pushd "${frontend_path}"
|
||||
|
||||
#nvm use stable
|
||||
npm install
|
||||
popd
|
||||
|
||||
Reference in new issue
Block a user