Commit 257357ce authored by timel's avatar timel

feat: some opts, and add searching by lscale

parent 5d6b93e2
Pipeline #23044 passed with stages
in 13 minutes and 43 seconds
......@@ -8,8 +8,9 @@ const TYPE_MONSTER = 0x1;
/** 过滤条件 */
export interface FtsConditions {
levels: number[]; // 星阶/link值
lscales: number[]; // 左刻度
types: number[]; // 卡片类型
levels: number[]; // 星阶/刻度/link值
races: number[]; // 种族
attributes: number[]; // 属性
atk: { min: number | null; max: number | null }; // 攻击力区间
......
......@@ -23,6 +23,11 @@ const levels = Array.from({ length: 12 }, (_, index) => ({
label: (index + 1).toString(),
}));
const lscales = Array.from({ length: 12 }, (_, index) => ({
value: index + 1,
label: (index + 1).toString(),
}));
export const Filter: React.FC<{
conditions: FtsConditions;
onConfirm: (newConditons: FtsConditions) => void;
......@@ -47,6 +52,7 @@ export const Filter: React.FC<{
[genOptions(Race2StringCodeMap), "种族", "races"],
[genOptions(Type2StringCodeMap), "类型", "types"],
[levels, "星级", "levels"],
[lscales, "灵摆刻度", "lscales"],
] as const;
const handleInputNumberChange =
......@@ -166,7 +172,7 @@ const Item: React.FC<
<div className={styles["item-name"]}>
{title}
{showTip && (
<Tooltip title="输入-2即等同于输入“?”">
<Tooltip title="若要输入 ? 的攻击/守备,请输入 -2">
<InfoCircleFilled style={{ fontSize: 10 }} />
</Tooltip>
)}
......
......@@ -19,7 +19,7 @@ import {
import classNames from "classnames";
import { isEqual } from "lodash-es";
import { type OverlayScrollbarsComponentRef } from "overlayscrollbars-react";
import { memo, useEffect, useRef, useState } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { DndProvider, useDrag, useDrop } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import { LoaderFunction } from "react-router-dom";
......@@ -199,6 +199,7 @@ const Search: React.FC = () => {
atk: { min: null, max: null },
def: { min: null, max: null },
levels: [],
lscales: [],
races: [],
attributes: [],
types: [],
......@@ -284,12 +285,12 @@ const Search: React.FC = () => {
});
};
/** 滚动条的ref */
/** 滚动条的ref,用来在翻页之后快速回顶 */
const ref = useRef<OverlayScrollbarsComponentRef<"div">>(null);
const scrollToTop = () => {
const scrollToTop = useCallback(() => {
const viewport = ref.current?.osInstance()?.elements().viewport;
if (viewport) viewport.scrollTop = 0;
};
}, []);
return (
<div className={styles.container} ref={dropRef}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment