mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-13 18:07:36 +08:00
fix(office): map main state to furniture zones and align scene anchors
This commit is contained in:
@@ -2613,15 +2613,18 @@ func (s *RegistryServer) handleWebUIOfficeState(w http.ResponseWriter, r *http.R
|
||||
mainState := "idle"
|
||||
mainZone := "breakroom"
|
||||
switch {
|
||||
case stats["error"] > 0 || stats["blocked"] > 0:
|
||||
mainState = "error"
|
||||
mainZone = "bug"
|
||||
case stats["running"] > 0:
|
||||
mainState = "executing"
|
||||
mainZone = "work"
|
||||
case stats["error"] > 0 || stats["blocked"] > 0:
|
||||
mainState = "error"
|
||||
mainZone = "bug"
|
||||
case stats["suppressed"] > 0:
|
||||
mainState = "syncing"
|
||||
mainZone = "server"
|
||||
case stats["waiting"] > 0:
|
||||
mainState = "idle"
|
||||
mainZone = "breakroom"
|
||||
case stats["success"] > 0:
|
||||
mainState = "writing"
|
||||
mainZone = "work"
|
||||
@@ -2632,9 +2635,24 @@ func (s *RegistryServer) handleWebUIOfficeState(w http.ResponseWriter, r *http.R
|
||||
|
||||
mainTaskID := ""
|
||||
mainDetail := "No active task"
|
||||
isMainStatus := func(st string) bool {
|
||||
st = strings.ToLower(strings.TrimSpace(st))
|
||||
switch mainState {
|
||||
case "executing":
|
||||
return st == "running"
|
||||
case "error":
|
||||
return st == "error" || st == "blocked"
|
||||
case "syncing":
|
||||
return st == "suppressed"
|
||||
case "writing":
|
||||
return st == "success"
|
||||
default:
|
||||
return st == "waiting" || st == "idle"
|
||||
}
|
||||
}
|
||||
for _, row := range items {
|
||||
st := strings.ToLower(strings.TrimSpace(fmt.Sprintf("%v", row["status"])))
|
||||
if st == "running" || st == "error" || st == "blocked" || st == "waiting" {
|
||||
if isMainStatus(st) {
|
||||
mainTaskID = strings.TrimSpace(fmt.Sprintf("%v", row["task_id"]))
|
||||
mainDetail = strings.TrimSpace(fmt.Sprintf("%v", row["input_preview"]))
|
||||
if mainDetail == "" {
|
||||
|
||||
@@ -192,7 +192,7 @@ const OfficeScene: React.FC<OfficeSceneProps> = ({ main, nodes }) => {
|
||||
<div className="relative">
|
||||
<SpriteSheet spec={mainSprite} frame={mainFrame} className="absolute left-1/2 top-1/2" />
|
||||
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 translate-y-[62px] rounded bg-black/75 px-2 py-0.5 text-[10px] font-semibold tracking-wide text-zinc-100">
|
||||
clawgo
|
||||
{main.name || main.id || 'main'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,44 +6,43 @@ export const OFFICE_CANVAS = {
|
||||
};
|
||||
|
||||
export const OFFICE_ZONE_POINT: Record<OfficeZone, { x: number; y: number }> = {
|
||||
breakroom: { x: 1070, y: 610 },
|
||||
work: { x: 640, y: 470 },
|
||||
server: { x: 820, y: 220 },
|
||||
bug: { x: 230, y: 210 },
|
||||
breakroom: { x: 760, y: 325 },
|
||||
work: { x: 300, y: 365 },
|
||||
server: { x: 1010, y: 235 },
|
||||
bug: { x: 1125, y: 245 },
|
||||
};
|
||||
|
||||
export const OFFICE_ZONE_SLOTS: Record<OfficeZone, Array<{ x: number; y: number }>> = {
|
||||
breakroom: [
|
||||
{ x: 1020, y: 620 },
|
||||
{ x: 1090, y: 620 },
|
||||
{ x: 1150, y: 620 },
|
||||
{ x: 1040, y: 670 },
|
||||
{ x: 1110, y: 670 },
|
||||
{ x: 1180, y: 670 },
|
||||
{ x: 700, y: 360 },
|
||||
{ x: 760, y: 355 },
|
||||
{ x: 820, y: 350 },
|
||||
{ x: 730, y: 420 },
|
||||
{ x: 790, y: 420 },
|
||||
{ x: 850, y: 410 },
|
||||
],
|
||||
work: [
|
||||
{ x: 520, y: 470 },
|
||||
{ x: 600, y: 470 },
|
||||
{ x: 680, y: 470 },
|
||||
{ x: 760, y: 470 },
|
||||
{ x: 560, y: 530 },
|
||||
{ x: 640, y: 530 },
|
||||
{ x: 720, y: 530 },
|
||||
{ x: 800, y: 530 },
|
||||
{ x: 240, y: 350 },
|
||||
{ x: 300, y: 345 },
|
||||
{ x: 360, y: 350 },
|
||||
{ x: 420, y: 360 },
|
||||
{ x: 260, y: 420 },
|
||||
{ x: 320, y: 425 },
|
||||
{ x: 380, y: 425 },
|
||||
{ x: 440, y: 430 },
|
||||
],
|
||||
server: [
|
||||
{ x: 760, y: 240 },
|
||||
{ x: 830, y: 240 },
|
||||
{ x: 900, y: 240 },
|
||||
{ x: 780, y: 290 },
|
||||
{ x: 850, y: 290 },
|
||||
{ x: 950, y: 225 },
|
||||
{ x: 1000, y: 220 },
|
||||
{ x: 1055, y: 220 },
|
||||
{ x: 930, y: 285 },
|
||||
{ x: 990, y: 285 },
|
||||
],
|
||||
bug: [
|
||||
{ x: 180, y: 230 },
|
||||
{ x: 240, y: 230 },
|
||||
{ x: 300, y: 230 },
|
||||
{ x: 210, y: 280 },
|
||||
{ x: 270, y: 280 },
|
||||
{ x: 1100, y: 230 },
|
||||
{ x: 1160, y: 230 },
|
||||
{ x: 1210, y: 235 },
|
||||
{ x: 1085, y: 290 },
|
||||
{ x: 1145, y: 295 },
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user