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; ...@@ -8,8 +8,9 @@ const TYPE_MONSTER = 0x1;
/** 过滤条件 */ /** 过滤条件 */
export interface FtsConditions { export interface FtsConditions {
levels: number[]; // 星阶/link值
lscales: number[]; // 左刻度
types: number[]; // 卡片类型 types: number[]; // 卡片类型
levels: number[]; // 星阶/刻度/link值
races: number[]; // 种族 races: number[]; // 种族
attributes: number[]; // 属性 attributes: number[]; // 属性
atk: { min: number | null; max: number | null }; // 攻击力区间 atk: { min: number | null; max: number | null }; // 攻击力区间
......
...@@ -23,6 +23,11 @@ const levels = Array.from({ length: 12 }, (_, index) => ({ ...@@ -23,6 +23,11 @@ const levels = Array.from({ length: 12 }, (_, index) => ({
label: (index + 1).toString(), label: (index + 1).toString(),
})); }));
const lscales = Array.from({ length: 12 }, (_, index) => ({
value: index + 1,
label: (index + 1).toString(),
}));
export const Filter: React.FC<{ export const Filter: React.FC<{
conditions: FtsConditions; conditions: FtsConditions;
onConfirm: (newConditons: FtsConditions) => void; onConfirm: (newConditons: FtsConditions) => void;
...@@ -47,6 +52,7 @@ export const Filter: React.FC<{ ...@@ -47,6 +52,7 @@ export const Filter: React.FC<{
[genOptions(Race2StringCodeMap), "种族", "races"], [genOptions(Race2StringCodeMap), "种族", "races"],
[genOptions(Type2StringCodeMap), "类型", "types"], [genOptions(Type2StringCodeMap), "类型", "types"],
[levels, "星级", "levels"], [levels, "星级", "levels"],
[lscales, "灵摆刻度", "lscales"],
] as const; ] as const;
const handleInputNumberChange = const handleInputNumberChange =
...@@ -166,7 +172,7 @@ const Item: React.FC< ...@@ -166,7 +172,7 @@ const Item: React.FC<
<div className={styles["item-name"]}> <div className={styles["item-name"]}>
{title} {title}
{showTip && ( {showTip && (
<Tooltip title="输入-2即等同于输入“?”"> <Tooltip title="若要输入 ? 的攻击/守备,请输入 -2">
<InfoCircleFilled style={{ fontSize: 10 }} /> <InfoCircleFilled style={{ fontSize: 10 }} />
</Tooltip> </Tooltip>
)} )}
......
...@@ -19,7 +19,7 @@ import { ...@@ -19,7 +19,7 @@ import {
import classNames from "classnames"; import classNames from "classnames";
import { isEqual } from "lodash-es"; import { isEqual } from "lodash-es";
import { type OverlayScrollbarsComponentRef } from "overlayscrollbars-react"; 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 { DndProvider, useDrag, useDrop } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend"; import { HTML5Backend } from "react-dnd-html5-backend";
import { LoaderFunction } from "react-router-dom"; import { LoaderFunction } from "react-router-dom";
...@@ -199,6 +199,7 @@ const Search: React.FC = () => { ...@@ -199,6 +199,7 @@ const Search: React.FC = () => {
atk: { min: null, max: null }, atk: { min: null, max: null },
def: { min: null, max: null }, def: { min: null, max: null },
levels: [], levels: [],
lscales: [],
races: [], races: [],
attributes: [], attributes: [],
types: [], types: [],
...@@ -284,12 +285,12 @@ const Search: React.FC = () => { ...@@ -284,12 +285,12 @@ const Search: React.FC = () => {
}); });
}; };
/** 滚动条的ref */ /** 滚动条的ref,用来在翻页之后快速回顶 */
const ref = useRef<OverlayScrollbarsComponentRef<"div">>(null); const ref = useRef<OverlayScrollbarsComponentRef<"div">>(null);
const scrollToTop = () => { const scrollToTop = useCallback(() => {
const viewport = ref.current?.osInstance()?.elements().viewport; const viewport = ref.current?.osInstance()?.elements().viewport;
if (viewport) viewport.scrollTop = 0; if (viewport) viewport.scrollTop = 0;
}; }, []);
return ( return (
<div className={styles.container} ref={dropRef}> <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