fix(web): make IwoooS focus deck responsive
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / tests (push) Has been cancelled
Code Review / ai-code-review (push) Has been cancelled

This commit is contained in:
Your Name
2026-06-01 01:09:23 +08:00
parent 8a3ddb8249
commit b83f9c5a52
2 changed files with 19 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ import {
} from 'lucide-react'
import Link from 'next/link'
import { useTranslations } from 'next-intl'
import { useState, type ReactNode } from 'react'
import { useEffect, useRef, useState, type ReactNode } from 'react'
import { AppLayout } from '@/components/layout'
type PostureMetric = {
@@ -9072,6 +9072,20 @@ function IwoooSFirstProgressUnlockPathBoard() {
function IwoooSFocusDeckBoard() {
const t = useTranslations('iwooos.focusDeck')
const textWrap = { overflowWrap: 'anywhere' as const, wordBreak: 'break-word' as const }
const deckBodyRef = useRef<HTMLDivElement>(null)
const [isCompactDeck, setIsCompactDeck] = useState(false)
useEffect(() => {
const node = deckBodyRef.current
if (!node) return
const updateLayout = () => setIsCompactDeck(node.getBoundingClientRect().width < 700)
updateLayout()
const observer = new ResizeObserver(updateLayout)
observer.observe(node)
return () => observer.disconnect()
}, [])
return (
<section
@@ -9080,9 +9094,10 @@ function IwoooSFocusDeckBoard() {
>
<div style={{ ...band, padding: 14, background: '#fffdf8', borderColor: '#ded8c8' }}>
<div
ref={deckBodyRef}
style={{
display: 'grid',
gridTemplateColumns: 'minmax(0, 0.88fr) minmax(0, 1.9fr)',
gridTemplateColumns: isCompactDeck ? 'minmax(0, 1fr)' : 'minmax(0, 0.88fr) minmax(0, 1.9fr)',
gap: 12,
alignItems: 'stretch',
}}
@@ -9111,7 +9126,7 @@ function IwoooSFocusDeckBoard() {
<div
style={{
display: 'grid',
gridTemplateColumns: 'repeat(3, minmax(0, 1fr))',
gridTemplateColumns: isCompactDeck ? 'repeat(auto-fit, minmax(min(100%, 86px), 1fr))' : 'repeat(3, minmax(0, 1fr))',
gap: 7,
marginTop: 4,
}}