Skip to content

Commit 3eb84b5

Browse files
🐛 修复不同语言下table的宽度问题 (#236)
* 🐛 修改了一下table的宽度 * 🐛 通过监听语言的变化来修改table的宽度
1 parent 0c43741 commit 3eb84b5

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ git commit -m "✨ add login feature"
6363
ScriptCat
6464
的文档在另外的仓库中:[scriptcat.org](https://docs.scriptcat.org),使用
6565
[docusaurus](https://docusaurus.io/)进行撰写,这有一些
66-
[Markdown](https://docusaurus.io/
67-
68-
zh-CN/docs/markdown-features)
66+
[Markdown](https://docusaurus.io/zh-CN/docs/markdown-features)
6967
特性可以帮助你。如果你需要在本地预览修改后的文档,可以使用以下命令安装文档依赖并启动
7068
dev server:
7169

@@ -96,10 +94,15 @@ ScriptCat 的页面开发使用了以下技术:
9694
npm run dev
9795
```
9896

97+
9998
如果你想打包扩展,可以使用以下命令:
10099

101100
```bash
102101
npm run pack
103102
```
104103

105104
在打包前,请确保在`dist`目录下生成了`scriptcat.pem`文件。
105+
106+
# 注意问题
107+
* 我使用的是yarn install的时候会出问题,不确定是yarn install还是网络问题,所以最好用npm i
108+
* 因为down这个仓库的目的是贡献代码,npm run dev以后还需要执行一下npm run build然后把dist ext里面内容在浏览器扩展里面导入加载,然后开始改代码保存即可,浏览器是实时更新的

‎src/pages/options/routes/ScriptList.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function ScriptList() {
9797
const [showAction, setShowAction] = useState(false);
9898
const [action, setAction] = useState("");
9999
const [select, setSelect] = useState<Script[]>([]);
100-
const { t } = useTranslation();
100+
const { t, i18n } = useTranslation();
101101

102102
useEffect(() => {
103103
// Monitor script running status
@@ -130,7 +130,7 @@ function ScriptList() {
130130
},
131131
{
132132
title: t("enable"),
133-
width: 100,
133+
width: (i18n.language === "zh-CN" ? 100 : 120),
134134
dataIndex: "status",
135135
className: "script-enable",
136136
sorter(a, b) {
@@ -249,7 +249,7 @@ function ScriptList() {
249249
},
250250
{
251251
title: t("apply_to_run_status"),
252-
width: 140,
252+
width: (i18n.language === "zh-CN" ? 140 : "auto"),
253253
className: "apply_to_run_status",
254254
render(col, item: Script) {
255255
const toLogger = () => {
@@ -406,7 +406,7 @@ function ScriptList() {
406406
dataIndex: "updatetime",
407407
align: "center",
408408
key: "updatetime",
409-
width: 100,
409+
width: (i18n.language === "zh-CN" ? 100 : "auto"),
410410
render(col, script: Script) {
411411
return (
412412
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions

‎src/pages/options/routes/SubscribeList.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function SubscribeList() {
3535
) as SubscribeController;
3636
const [list, setList] = useState<ListType[]>([]);
3737
const inputRef = useRef<RefInputType>(null);
38-
const { t } = useTranslation(); // 使用 useTranslation hook
38+
const { t, i18n } = useTranslation(); // 使用 useTranslation hook
3939

4040
useEffect(() => {
4141
dao.table
@@ -56,7 +56,7 @@ function SubscribeList() {
5656
},
5757
{
5858
title: t("enable"),
59-
width: 100,
59+
width: (i18n.language === "zh-CN" ? 100 : 120),
6060
key: "enable",
6161
sorter(a, b) {
6262
return a.status - b.status;
@@ -215,7 +215,7 @@ function SubscribeList() {
215215
dataIndex: "updatetime",
216216
align: "center",
217217
key: "updatetime",
218-
width: 100,
218+
width: (i18n.language === "zh-CN" ? 100 : "auto"),
219219
render(col, subscribe: Subscribe) {
220220
return (
221221
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions

0 commit comments

Comments
 (0)