From ae493a927b3e07bdda47958a0cfa2553e1a96db2 Mon Sep 17 00:00:00 2001 From: Codex Night Worker Date: Sun, 15 Nov 2026 13:28:51 +0900 Subject: [PATCH] AI: address review on PR #475 --- .../src/components/users/InheritDialogue.tsx | 8 +- .../src/components/users/UserCodeDialogue.tsx | 2 +- frontend/src/index.css | 94 ++++++++++++++++++- frontend/src/test/compileMdx.ts | 3 +- frontend/vite.config.test.ts | 41 ++++++++ frontend/vite.config.ts | 5 +- frontend/vitest.config.ts | 6 +- 7 files changed, 147 insertions(+), 12 deletions(-) create mode 100644 frontend/vite.config.test.ts diff --git a/frontend/src/components/users/InheritDialogue.tsx b/frontend/src/components/users/InheritDialogue.tsx index c0c9b6c..e2e9978 100644 --- a/frontend/src/components/users/InheritDialogue.tsx +++ b/frontend/src/components/users/InheritDialogue.tsx @@ -60,12 +60,14 @@ const InheritDialogue: FC = ({ visible, onVisibleChange, setUser }) => { return ( - + {label ('account.inherit')} -
- + = ({ visible, onVisibleChange, user, setUser }

{label ('userCode.description')}

-
{user?.inheritanceCode}
+
{user?.inheritanceCode}

{label ('userCode.secretWarning')}

diff --git a/frontend/src/index.css b/frontend/src/index.css index f7f56bb..fd135b7 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -751,6 +751,40 @@ html:lang(mn-Mong) .text-right inline-size: min(36rem, 100%); } +[data-vertical-preview] .main-area[data-vertical-content] form.space-y-2 +{ + display: flex; + flex-direction: column; + align-items: flex-start; + gap: .75rem; +} + +[data-vertical-preview] .main-area[data-vertical-content] form.space-y-2 > * +{ + flex: none; + margin: 0; +} + +[data-vertical-preview] .main-area[data-vertical-content] form label.block +{ + margin: 0; + margin-block-end: .25rem; +} + +[data-vertical-preview] .main-area[data-vertical-content] form.space-y-2 + > :has(> input[type='checkbox']) +{ + display: flex; + align-items: center; + gap: .5rem; +} + +[data-vertical-preview] .main-area[data-vertical-content] form.space-y-2 + > :has(> input[type='checkbox']) > label +{ + margin: 0; +} + [data-vertical-preview] :where(.main-area[data-vertical-content]) :is( button, input, select, textarea, code, time, table) { @@ -1039,9 +1073,65 @@ html:lang(mn-Mong) .text-right { flex: none; width: auto; - inline-size: min(24rem, 100%); + inline-size: 100%; max-inline-size: none; - overflow: auto; + overflow: visible; +} + +[data-vertical-preview] .tag-list-filter > div +{ + align-items: flex-start; + justify-content: flex-start; + flex-wrap: nowrap; + gap: 1rem; +} + +[data-vertical-preview] .main-area .tag-list-filter form.space-y-2 +{ + inline-size: auto; + max-height: none; + overflow: visible; +} + +[data-vertical-preview] .tag-list-filter input[type='datetime-local'] +{ + inline-size: 13rem; +} + +@media (min-width: 768px) +{ + [data-vertical-preview] .tag-list-filter form > div + { + white-space: nowrap; + } +} + +html:lang(mn-Mong) .inheritance-code +{ + writing-mode: horizontal-tb; +} + +html:lang(mn-Mong) .inheritance-dialogue +{ + width: auto; + max-width: calc(100vw - 2rem); + inline-size: min(32rem, calc(100dvh - 2rem)); + block-size: fit-content; +} + +html:lang(mn-Mong) .inheritance-dialogue-fields +{ + writing-mode: horizontal-tb; + flex-direction: column; + justify-content: space-between; + width: min(16rem, calc(100vw - 8rem)); + height: 100%; + min-height: 0; +} + +html:lang(mn-Mong) .inheritance-dialogue-fields > button +{ + align-self: flex-end; } [data-vertical-preview] .tag-list-filter h1 diff --git a/frontend/src/test/compileMdx.ts b/frontend/src/test/compileMdx.ts index 587b8f5..1b1ac03 100644 --- a/frontend/src/test/compileMdx.ts +++ b/frontend/src/test/compileMdx.ts @@ -10,7 +10,8 @@ type Transform = (source: string, id: string) => Promise<{ code: string } | null export const transformMdx = async (source: string, suffix = '.mdx') => { - const plugins = viteConfig.plugins?.flat () as { name: string; transform: Transform }[] + const config = viteConfig ({ command: 'serve', mode: 'test' }) + const plugins = config.plugins?.flat () as { name: string; transform: Transform }[] const plugin = plugins.find (entry => entry.name === '@mdx-js/rollup') if (plugin == null) throw new Error ('The application MDX compiler is not registered') diff --git a/frontend/vite.config.test.ts b/frontend/vite.config.test.ts new file mode 100644 index 0000000..0784a1c --- /dev/null +++ b/frontend/vite.config.test.ts @@ -0,0 +1,41 @@ +import { execFileSync } from 'node:child_process' +import { resolveConfig, transformWithEsbuild } from 'vite' +import { afterAll, afterEach, describe, expect, it, vi } from 'vitest' + +import viteConfig from './vite.config' + +vi.hoisted (() => { + vi.stubGlobal ('Uint8Array', Object.getPrototypeOf (new TextEncoder ().encode ('')).constructor) +}) +afterAll (() => vi.unstubAllGlobals ()) +afterEach (() => vi.unstubAllEnvs ()) + +describe ('JSX runtime configuration', () => { + it.each (['development', 'test', 'production']) ( + 'builds JSX compatible with production React under NODE_ENV=%s', + async environment => { + vi.stubEnv ('NODE_ENV', environment) + const config = await resolveConfig ({ + ...viteConfig ({ command: 'build', mode: 'production' }), + configFile: false, build: { ssr: true } }, 'build') + if (config.esbuild === false) throw new Error ('JSX transformation disabled') + const { code } = await transformWithEsbuild ( + 'export default
SSR
', 'runtime.tsx', { + jsx: config.esbuild.jsx, + jsxDev: config.esbuild.jsxDev, + jsxImportSource: config.esbuild.jsxImportSource }) + expect (code).toContain ('react/jsx-runtime') + expect (code).not.toContain ('jsxDEV') + execFileSync (process.execPath, ['--input-type=module', '-e', code], { + cwd: import.meta.dirname, + env: { ...process.env, NODE_ENV: 'production' } }) + }) + + it ('preserves development JSX for the development server', async () => { + vi.stubEnv ('NODE_ENV', 'development') + const config = await resolveConfig ({ + ...viteConfig ({ command: 'serve', mode: 'development' }), + configFile: false }, 'serve') + expect (config.esbuild && config.esbuild.jsxDev).toBe (true) + }) +}) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 813fcb1..1cb53c5 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -21,7 +21,8 @@ if (typeof originalTransform === 'function') } } -export default defineConfig ({ +export default defineConfig (({ command }) => ({ + esbuild: command === 'build' ? { jsxDev: false } : undefined, plugins: [{ name: 'request-render-context', enforce: 'pre', resolveId (id, _importer, options) { const contextPath = path.resolve (__dirname, './src/lib/renderContext') @@ -40,4 +41,4 @@ export default defineConfig ({ rewrite: requestPath => requestPath.replace (/^\/api/, ''), secure: false } }, watch: { usePolling: true, - interval: 100 } } }) + interval: 100 } } })) diff --git a/frontend/vitest.config.ts b/frontend/vitest.config.ts index d90382f..eb9c517 100644 --- a/frontend/vitest.config.ts +++ b/frontend/vitest.config.ts @@ -4,9 +4,9 @@ import { defineConfig, mergeConfig } from 'vitest/config' import viteConfig from './vite.config' -export default mergeConfig ( - viteConfig, - defineConfig ({ +export default defineConfig (configEnv => mergeConfig ( + viteConfig (configEnv), + { test: { alias: { '@/config': path.resolve (__dirname, './src/config.sample.ts') }, environment: 'jsdom',