Skip to content

Commit

Permalink
🐛 修复不同语言下table的宽度问题 (#236)
Browse files Browse the repository at this point in the history
* 🐛 修改了一下table的宽度

* 🐛 通过监听语言的变化来修改table的宽度
  • Loading branch information
duoluodexiaoxiaoyuan authored Oct 3, 2023
1 parent 0c43741 commit 3eb84b5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ git commit -m "✨ add login feature"
ScriptCat
的文档在另外的仓库中:[scriptcat.org](https://docs.scriptcat.org),使用
[docusaurus](https://docusaurus.io/)进行撰写,这有一些
[Markdown](https://docusaurus.io/

zh-CN/docs/markdown-features)
[Markdown](https://docusaurus.io/zh-CN/docs/markdown-features)
特性可以帮助你。如果你需要在本地预览修改后的文档,可以使用以下命令安装文档依赖并启动
dev server:

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


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

```bash
npm run pack
```

在打包前,请确保在`dist`目录下生成了`scriptcat.pem`文件。

# 注意问题
* 我使用的是yarn install的时候会出问题,不确定是yarn install还是网络问题,所以最好用npm i
* 因为down这个仓库的目的是贡献代码,npm run dev以后还需要执行一下npm run build然后把dist ext里面内容在浏览器扩展里面导入加载,然后开始改代码保存即可,浏览器是实时更新的
8 changes: 4 additions & 4 deletions src/pages/options/routes/ScriptList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function ScriptList() {
const [showAction, setShowAction] = useState(false);
const [action, setAction] = useState("");
const [select, setSelect] = useState<Script[]>([]);
const { t } = useTranslation();
const { t, i18n } = useTranslation();

useEffect(() => {
// Monitor script running status
Expand Down Expand Up @@ -130,7 +130,7 @@ function ScriptList() {
},
{
title: t("enable"),
width: 100,
width: (i18n.language === "zh-CN" ? 100 : 120),
dataIndex: "status",
className: "script-enable",
sorter(a, b) {
Expand Down Expand Up @@ -249,7 +249,7 @@ function ScriptList() {
},
{
title: t("apply_to_run_status"),
width: 140,
width: (i18n.language === "zh-CN" ? 140 : "auto"),
className: "apply_to_run_status",
render(col, item: Script) {
const toLogger = () => {
Expand Down Expand Up @@ -406,7 +406,7 @@ function ScriptList() {
dataIndex: "updatetime",
align: "center",
key: "updatetime",
width: 100,
width: (i18n.language === "zh-CN" ? 100 : "auto"),
render(col, script: Script) {
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
Expand Down
6 changes: 3 additions & 3 deletions src/pages/options/routes/SubscribeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function SubscribeList() {
) as SubscribeController;
const [list, setList] = useState<ListType[]>([]);
const inputRef = useRef<RefInputType>(null);
const { t } = useTranslation(); // 使用 useTranslation hook
const { t, i18n } = useTranslation(); // 使用 useTranslation hook

useEffect(() => {
dao.table
Expand All @@ -56,7 +56,7 @@ function SubscribeList() {
},
{
title: t("enable"),
width: 100,
width: (i18n.language === "zh-CN" ? 100 : 120),
key: "enable",
sorter(a, b) {
return a.status - b.status;
Expand Down Expand Up @@ -215,7 +215,7 @@ function SubscribeList() {
dataIndex: "updatetime",
align: "center",
key: "updatetime",
width: 100,
width: (i18n.language === "zh-CN" ? 100 : "auto"),
render(col, subscribe: Subscribe) {
return (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
Expand Down

0 comments on commit 3eb84b5

Please sign in to comment.