diff --git a/package.json b/package.json
index 2904df887..efba60b24 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "yacd",
- "version": "2.1.0",
+ "version": "2.1.1",
"description": "Yet another Clash dashboard",
"author": "zsheep",
"license": "MIT",
diff --git a/src/components/rules/Rule.module.scss b/src/components/rules/Rule.module.scss
index 69e5f1a72..cb849e70c 100644
--- a/src/components/rules/Rule.module.scss
+++ b/src/components/rules/Rule.module.scss
@@ -25,7 +25,7 @@
}
.a {
- margin-top: 0.5em;
+ margin-top: 0.3em;
display: flex;
align-items: center;
font-size: 1em;
diff --git a/src/components/rules/Rules.tsx b/src/components/rules/Rules.tsx
index 8d377ce4f..976935346 100644
--- a/src/components/rules/Rules.tsx
+++ b/src/components/rules/Rules.tsx
@@ -52,15 +52,8 @@ function itemKey(index: number, { rules, provider }: ItemData) {
return item.id;
}
-function getItemSizeFactory({ provider }) {
- return function getItemSize(idx: number) {
- // const providerQty = provider.names.length;
- // if (idx < providerQty) {
- // // provider
- // return 66;
- // }
- // // rule
- // return 70;
+function getItemSizeFactory() {
+ return function getItemSize() {
return 70;
};
}
@@ -90,18 +83,16 @@ const Row = memo(({ index, style, data }) => {
// 只有规则列表的行
const RuleRow = ({ index, style, data }) => {
- const { rules, provider, groups } = data;
- const providerQty = provider.names.length;
- index += providerQty;
- const r = rules[index - providerQty];
+ const { rules, groups, unReloadConfig } = data;
+ const r = rules[index];
return (
- < Rule {...r} groups={groups} />
+ < Rule {...r} groups={groups} unReloadConfig={unReloadConfig} />
);
};
-const DraggableRuleRow = ({ index, style, data }) => {
+/*const DraggableRuleRow = ({ index, style, data }) => {
const { rules, groups, unReloadConfig } = data;
const r = rules[index];
return (
@@ -126,7 +117,7 @@ const RuleProviderRow = ({ index, style, data }) => {
);
-};
+};*/
const mapState = (s: State) => ({
apiConfig: getClashAPIConfig(s),
@@ -149,7 +140,7 @@ function Rules({ dispatch, apiConfig, groups, unReloadConfig }) {
useEffect(() => {
fetchProxiesHooked();
}, [fetchProxiesHooked]);
- const getItemSize = getItemSizeFactory({ provider });
+ const getItemSize = getItemSizeFactory();
const [addRuleModal, setAddRuleModal] = useState(false);
const [addRuleSetModal, setAddRuleSetModal] = useState(false);
const [reload_config, setReloadConfig] = useState(false);
@@ -251,45 +242,50 @@ function Rules({ dispatch, apiConfig, groups, unReloadConfig }) {
-
- {
- return (
-
- < Rule {...rules[rubric.source.index]} groups={groups} />
-
- );
- }}>
- {(provided) => (
-
-
- {DraggableRuleRow}
-
- {provided.placeholder}
-
- )}
-
-
+ {rules.length <= 100 ?
+
+
+ {(provided: any) => (
+
+ {rules.map((rule, index) => (
+
+ {(provided: any) => (
+
+ < Rule {...rule} groups={groups} unReloadConfig={unReloadConfig} />
+
+ )}
+
+ ))}
+ {provided.placeholder}
+
+ )}
+
+
+ :
+ // 规则过多则使用VariableSizeList
+
+ {RuleRow}
+
+ }
-
- {RuleProviderRow}
-
+ {provider.names.map((name, index) => {
+ const item = provider.byName[name];
+ return (
+
+
+
+ );
+ })}
{provider && provider.names && provider.names.length > 0 ? (