Compact left column layout and require manual cast start.
Stop stretching input cards to match AI panel height, and show a start button before online/offline hexagram casting begins. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Compass } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
@@ -35,6 +35,7 @@ export default function CombinedForm() {
|
||||
const [question, setQuestion] = useState("");
|
||||
const [withHexagram, setWithHexagram] = useState(false);
|
||||
const [castMode, setCastMode] = useState<"online" | "offline">("online");
|
||||
const [castActive, setCastActive] = useState(false);
|
||||
const [guaData, setGuaData] = useState<GuaResult | null>(null);
|
||||
|
||||
const [chart, setChart] = useState<BaziChart | null>(null);
|
||||
@@ -48,6 +49,11 @@ export default function CombinedForm() {
|
||||
!withHexagram ||
|
||||
(question.trim() !== "" && currentLocation !== null && guaData !== null);
|
||||
|
||||
useEffect(() => {
|
||||
setCastActive(false);
|
||||
setGuaData(null);
|
||||
}, [currentProvince, currentCity, castMode, question, withHexagram]);
|
||||
|
||||
function validate(): string | null {
|
||||
if (!birthLocation) {
|
||||
return "请选择出生地域";
|
||||
@@ -258,8 +264,13 @@ export default function CombinedForm() {
|
||||
key={castMode}
|
||||
mode={castMode}
|
||||
enabled={question.trim() !== "" && currentLocation !== null}
|
||||
active={castActive}
|
||||
onStart={() => setCastActive(true)}
|
||||
onResult={setGuaData}
|
||||
onClear={() => setGuaData(null)}
|
||||
onClear={() => {
|
||||
setGuaData(null);
|
||||
setCastActive(false);
|
||||
}}
|
||||
/>
|
||||
{guaData && (
|
||||
<div className="rounded-lg border bg-card p-3">
|
||||
|
||||
Reference in New Issue
Block a user