Scoring types, components alias, increase height, vertical app

This commit is contained in:
2024-12-13 21:58:18 -06:00
parent eb9d4cf572
commit 6f0b2050ad
10 changed files with 221 additions and 24 deletions

View File

@@ -1,18 +1,28 @@
import { Greet } from "@wails/go/main/App";
import Offer from "@components/Offer";
import { Search } from "@wails/go/main/App";
import { api } from "@wails/go/models";
import { useEffect, useState } from "react";
function App() {
const [state, setState] = useState<string>("");
const [state, setState] = useState<api.ScoredOffer[] | null>(null);
async function invoke() {
const offers = await Search();
console.log({ offer: offers[0] });
setState(offers);
}
useEffect(() => {
Greet("World").then((result) => {
setState(result);
});
if (state === null) invoke();
});
return (
<div id="App">
<div className="p-4">{state}</div>
<div className="p-4" onClick={invoke}>
{state?.map((offer) => (
<Offer offer={offer} />
))}
</div>
</div>
);
}

View File

@@ -1,7 +1,9 @@
export default function Offer() {
return (
<div className="p-4">
<h1>Offer</h1>
</div>
);
import { api } from "@wails/go/models";
export default function Offer({
offer: scoredOffer,
}: {
offer: api.ScoredOffer;
}) {
return <div className="p-4">{scoredOffer.Score}</div>;
}

View File

@@ -3,5 +3,5 @@
@tailwind utilities;
html {
@apply bg-zinc-800 p-0 m-0 h-screen w-screen text-zinc-200;
@apply bg-zinc-800 p-0 m-0 h-screen w-screen text-zinc-200 overflow-x-hidden;
}