06b9d29270
- 新增 constants.ts 文件,定义 JWT 输入占位符和配置常量,提升代码可读性。 - 删除 JwtSection 组件,重构为 JwtResultView 组件,简化结果展示逻辑。 - 更新 index.tsx,使用 JwtResultView 组件替代原有的 JWT 结果展示方式,优化页面结构。
27 lines
771 B
TypeScript
27 lines
771 B
TypeScript
import TextInputArea from '@/components/TextInputArea';
|
|
import JwtResultView from './components/JwtResultView';
|
|
import { JWT_INPUT_PLACEHOLDER } from './constants';
|
|
import { useJwt } from './useJwt';
|
|
|
|
export default function Index() {
|
|
const { jwtInput, result, handleChange, handleClear } = useJwt();
|
|
|
|
return (
|
|
<div className="p-4 w-full flex flex-col gap-4 select-none">
|
|
<TextInputArea
|
|
minRows={5}
|
|
maxRows={10}
|
|
placeholder={JWT_INPUT_PLACEHOLDER}
|
|
value={jwtInput}
|
|
onChange={handleChange}
|
|
allowCopy={true}
|
|
showClear={true}
|
|
externalError={result?.error || undefined}
|
|
onClear={handleClear}
|
|
/>
|
|
|
|
{result && !result.error && <JwtResultView result={result} />}
|
|
</div>
|
|
);
|
|
}
|