Fix liuyao UX: CSS coins, region auto-select, and clearer AI flow.

Replace missing coin images with CSS 3D coins, auto-select city on province change, expand Shandong cities, and improve AI interpretation prompts after six casts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-10 21:24:51 +08:00
parent a1667eac51
commit 96b659fbe5
6 changed files with 123 additions and 64 deletions
+8 -3
View File
@@ -191,9 +191,14 @@ export default function HexagramInput({
<div className="flex flex-col items-center gap-3 sm:flex-row">
<Hexagram list={hexagramList} />
{complete && (
<Button size="sm" variant="outline" onClick={handleReset}>
</Button>
<>
<p className="text-sm text-muted-foreground sm:max-w-[10rem]">
AI
</p>
<Button size="sm" variant="outline" onClick={handleReset}>
</Button>
</>
)}
</div>
)}
+32 -8
View File
@@ -1,6 +1,10 @@
"use client";
import { getProvinces, getCities, getRegionLocation } from "@/lib/data/regions";
import {
getProvinces,
getCities,
getRegionLocation,
} from "@/lib/data/regions";
interface RegionSelectProps {
provinceCode: string;
@@ -8,6 +12,7 @@ interface RegionSelectProps {
onProvinceChange: (code: string) => void;
onCityChange: (code: string) => void;
label?: string;
cityOptional?: boolean;
}
export default function RegionSelect({
@@ -16,9 +21,23 @@ export default function RegionSelect({
onProvinceChange,
onCityChange,
label = "出生地域",
cityOptional = true,
}: RegionSelectProps) {
const provinces = getProvinces();
const cities = provinceCode ? getCities(provinceCode) : [];
const location = provinceCode
? getRegionLocation(provinceCode, cityCode)
: null;
function handleProvinceChange(code: string) {
onProvinceChange(code);
if (!code) {
onCityChange("");
return;
}
const list = getCities(code);
onCityChange(list[0]?.code ?? "");
}
return (
<div className="space-y-2">
@@ -27,10 +46,7 @@ export default function RegionSelect({
<select
className="rounded-md border bg-background px-3 py-2 text-sm"
value={provinceCode}
onChange={(e) => {
onProvinceChange(e.target.value);
onCityChange("");
}}
onChange={(e) => handleProvinceChange(e.target.value)}
>
<option value=""></option>
{provinces.map((p) => (
@@ -40,12 +56,14 @@ export default function RegionSelect({
))}
</select>
<select
className="rounded-md border bg-background px-3 py-2 text-sm"
className="rounded-md border bg-background px-3 py-2 text-sm disabled:opacity-50"
value={cityCode}
onChange={(e) => onCityChange(e.target.value)}
disabled={!provinceCode}
disabled={!provinceCode || cities.length === 0}
>
<option value="">/</option>
<option value="">
{cities.length === 0 ? "该省暂无下级城市" : "选择城市"}
</option>
{cities.map((c) => (
<option key={c.code} value={c.code}>
{c.name}
@@ -53,6 +71,12 @@ export default function RegionSelect({
))}
</select>
</div>
{cityOptional && provinceCode && (
<p className="text-xs text-muted-foreground">
使
{location ? `${location.name}${location.longitude}°)` : "—"}
</p>
)}
</div>
);
}