mirror of
https://github.com/hex248/sprint.git
synced 2026-02-08 02:33:01 +00:00
basic homepage
This commit is contained in:
32
src/App.tsx
32
src/App.tsx
@@ -1,32 +1,12 @@
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { useState } from "react";
|
||||
import "./App.css";
|
||||
import { ThemeProvider } from "@/components/theme-provider";
|
||||
|
||||
import Home from "./Home";
|
||||
|
||||
function App() {
|
||||
const [greetMsg, setGreetMsg] = useState("");
|
||||
const [name, setName] = useState("");
|
||||
|
||||
async function greet() {
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
setGreetMsg(await invoke("greet", { name }));
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="container">
|
||||
<h1>Issue Project Manager</h1>
|
||||
|
||||
<div>
|
||||
<input
|
||||
id="greet-input"
|
||||
onChange={(e) => setName(e.currentTarget.value)}
|
||||
placeholder="Enter a name..."
|
||||
/>
|
||||
<button type="submit" onClick={greet}>
|
||||
Greet
|
||||
</button>
|
||||
</div>
|
||||
<p>{greetMsg}</p>
|
||||
</main>
|
||||
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
||||
<Home />
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
32
src/Home.tsx
Normal file
32
src/Home.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
function Home() {
|
||||
const [issues, setIssues] = useState([]);
|
||||
const [serverURL, setServerURL] = useState("http://localhost:3000");
|
||||
|
||||
async function getIssues() {
|
||||
const res = await fetch(`${serverURL}/issues/all`);
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="w-full h-[100vh] flex flex-col items-center justify-center gap-4 p-4">
|
||||
<h1>Issue Project Manager</h1>
|
||||
|
||||
<Button onClick={getIssues} className={""}>
|
||||
get issues
|
||||
</Button>
|
||||
|
||||
<div>Issues count: {issues.length}</div>
|
||||
{issues.length > 0 && (
|
||||
<ul>
|
||||
{issues.map((issue: any) => (
|
||||
<li key={issue.id}>{issue.title}</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
export default Home;
|
||||
Reference in New Issue
Block a user