poi-plugin-inventory-cleaner 1.12.2 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/i18n/en-US.json CHANGED
@@ -31,6 +31,7 @@
31
31
  "stock.keepPlus": "Keep one more",
32
32
  "stock.batchToggle": "Batch keep",
33
33
  "stock.categoryAll": "All categories",
34
+ "stock.backToTop": "Back to top",
34
35
  "stock.categoryTitle": "Filter by in-game equipment type",
35
36
  "stock.sortTitle": "Sort by",
36
37
  "stock.sortVerdict": "Guide verdict",
package/i18n/zh-CN.json CHANGED
@@ -31,6 +31,7 @@
31
31
  "stock.keepPlus": "多留一件",
32
32
  "stock.batchToggle": "批量保留",
33
33
  "stock.categoryAll": "全部类别",
34
+ "stock.backToTop": "回到顶部",
34
35
  "stock.categoryTitle": "按游戏装备类型筛选",
35
36
  "stock.sortTitle": "排序方式",
36
37
  "stock.sortVerdict": "按攻略判定",
package/index.js CHANGED
@@ -403,6 +403,17 @@ function App() {
403
403
 
404
404
  const [batchOpen, setBatchOpen] = React.useState(false)
405
405
  const [batchValues, setBatchValues] = React.useState({})
406
+ const [showTop, setShowTop] = React.useState(false)
407
+ const rootRef = React.useRef(null)
408
+
409
+ const handleScroll = React.useCallback((event) => {
410
+ setShowTop(event.currentTarget.scrollTop > 400)
411
+ }, [])
412
+
413
+ const scrollToTop = React.useCallback(() => {
414
+ const element = rootRef.current
415
+ if (element) element.scrollTo({ top: 0, behavior: 'smooth' })
416
+ }, [])
406
417
 
407
418
  const firstKeepSave = React.useRef(true)
408
419
  React.useEffect(() => {
@@ -477,7 +488,7 @@ function App() {
477
488
 
478
489
  return h(
479
490
  'div',
480
- { className: 'stock-root' },
491
+ { className: 'stock-root', ref: rootRef, onScroll: handleScroll },
481
492
  h('style', null, CSS),
482
493
  h(
483
494
  'header',
@@ -658,7 +669,18 @@ function App() {
658
669
  ),
659
670
  h('p', { className: 'stock-warn' }, t('stock.warn')),
660
671
  h('p', { className: 'stock-source' }, t('stock.source')),
661
-
672
+ showTop
673
+ ? h(
674
+ 'button',
675
+ {
676
+ type: 'button',
677
+ className: 'stock-top',
678
+ title: t('stock.backToTop'),
679
+ onClick: scrollToTop,
680
+ },
681
+ '↑',
682
+ )
683
+ : null,
662
684
  )
663
685
  }
664
686
 
package/lib/style.js CHANGED
@@ -373,25 +373,21 @@ const CSS = `
373
373
  .stock-note {
374
374
  margin: 6px 0 0;
375
375
  font-size: 11px;
376
- line-height: 1.55;
377
- opacity: 0.65;
378
- overflow: hidden;
379
- text-overflow: ellipsis;
380
- display: -webkit-box;
381
- -webkit-line-clamp: 3;
382
- -webkit-box-orient: vertical;
376
+ line-height: 1.6;
377
+ opacity: 0.7;
378
+ white-space: normal;
379
+ overflow-wrap: anywhere;
380
+ word-break: break-word;
383
381
  }
384
382
 
385
383
  .stock-consume {
386
384
  margin: 4px 0 0;
387
385
  font-size: 10px;
388
- line-height: 1.5;
386
+ line-height: 1.55;
389
387
  opacity: 0.45;
390
- overflow: hidden;
391
- text-overflow: ellipsis;
392
- display: -webkit-box;
393
- -webkit-line-clamp: 1;
394
- -webkit-box-orient: vertical;
388
+ white-space: normal;
389
+ overflow-wrap: anywhere;
390
+ word-break: break-word;
395
391
  }
396
392
 
397
393
  .stock-batchbar {
@@ -645,6 +641,53 @@ const CSS = `
645
641
  opacity: 0.42;
646
642
  }
647
643
 
644
+ .stock-root::-webkit-scrollbar {
645
+ width: 12px;
646
+ height: 12px;
647
+ }
648
+
649
+ .stock-root::-webkit-scrollbar-track {
650
+ background: rgba(255, 255, 255, 0.06);
651
+ border-radius: 6px;
652
+ }
653
+
654
+ .stock-root::-webkit-scrollbar-thumb {
655
+ background: rgba(170, 180, 195, 0.6);
656
+ border: 2px solid transparent;
657
+ border-radius: 6px;
658
+ background-clip: padding-box;
659
+ }
660
+
661
+ .stock-root::-webkit-scrollbar-thumb:hover {
662
+ background: rgba(205, 215, 230, 0.8);
663
+ border: 2px solid transparent;
664
+ background-clip: padding-box;
665
+ }
666
+
667
+ .stock-top {
668
+ position: fixed;
669
+ right: 22px;
670
+ bottom: 22px;
671
+ z-index: 70;
672
+ width: 42px;
673
+ height: 42px;
674
+ padding: 0;
675
+ border: 1px solid rgba(150, 160, 175, 0.55);
676
+ border-radius: 50%;
677
+ color: #e8edf4;
678
+ background: rgba(38, 44, 54, 0.94);
679
+ box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
680
+ font-family: inherit;
681
+ font-size: 18px;
682
+ line-height: 1;
683
+ cursor: pointer;
684
+ }
685
+
686
+ .stock-top:hover {
687
+ border-color: #818cf8;
688
+ color: #818cf8;
689
+ }
690
+
648
691
  `
649
692
 
650
693
  module.exports = { CSS }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poi-plugin-inventory-cleaner",
3
- "version": "1.12.2",
3
+ "version": "1.13.1",
4
4
  "description": "库存清理大师:对照改修攻略与保留上限,找出囤积过量、可以清理的装备,并标出不能拆的改修材料。",
5
5
  "main": "index.js",
6
6
  "files": [