Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
bf99d9a6
Commit
bf99d9a6
authored
Sep 07, 2023
by
love_飞影
Committed by
Chunchi Che
Sep 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add forbidden alias icon
parent
e7f6cf8c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
74 deletions
+31
-74
src/api/cards.ts
src/api/cards.ts
+8
-71
src/api/forbiddens.ts
src/api/forbiddens.ts
+10
-2
src/types/util.d.ts
src/types/util.d.ts
+11
-0
src/ui/Shared/DeckCard/index.tsx
src/ui/Shared/DeckCard/index.tsx
+2
-1
No files found.
src/api/cards.ts
View file @
bf99d9a6
...
...
@@ -21,28 +21,16 @@ export interface CardData {
rscale
?:
number
;
}
export
interface
CardText
{
export
type
CardStrRange
=
`str
${
IntRange
<
1
,
17
>
}
`
;
export
type
CardText
=
{
id
?:
number
;
name
?:
string
;
types
?:
string
;
desc
?:
string
;
str1
?:
string
;
str2
?:
string
;
str3
?:
string
;
str4
?:
string
;
str5
?:
string
;
str6
?:
string
;
str7
?:
string
;
str8
?:
string
;
str9
?:
string
;
str10
?:
string
;
str11
?:
string
;
str12
?:
string
;
str13
?:
string
;
str14
?:
string
;
str15
?:
string
;
str16
?:
string
;
}
}
&
{
[
str
in
CardStrRange
]?:
string
;
};
/*
* 返回卡片元数据
...
...
@@ -80,57 +68,6 @@ window.fetchCard = fetchCard;
window
.
searchCard
=
searchCards
;
export
function
getCardStr
(
meta
:
CardMeta
,
idx
:
number
):
string
|
undefined
{
switch
(
idx
)
{
case
0
:
{
return
meta
.
text
.
str1
;
}
case
1
:
{
return
meta
.
text
.
str2
;
}
case
2
:
{
return
meta
.
text
.
str3
;
}
case
3
:
{
return
meta
.
text
.
str4
;
}
case
4
:
{
return
meta
.
text
.
str5
;
}
case
5
:
{
return
meta
.
text
.
str6
;
}
case
6
:
{
return
meta
.
text
.
str7
;
}
case
7
:
{
return
meta
.
text
.
str8
;
}
case
8
:
{
return
meta
.
text
.
str9
;
}
case
9
:
{
return
meta
.
text
.
str10
;
}
case
10
:
{
return
meta
.
text
.
str11
;
}
case
11
:
{
return
meta
.
text
.
str12
;
}
case
12
:
{
return
meta
.
text
.
str13
;
}
case
13
:
{
return
meta
.
text
.
str14
;
}
case
14
:
{
return
meta
.
text
.
str15
;
}
case
15
:
{
return
meta
.
text
.
str16
;
}
default
:
{
return
undefined
;
}
}
const
str
=
`str
${
idx
+
1
}
`
as
CardStrRange
;
return
meta
.
text
[
str
];
}
src/api/forbiddens.ts
View file @
bf99d9a6
import
{
isNil
}
from
"
lodash-es
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
CardMeta
}
from
"
./cards
"
;
const
{
lflistUrl
}
=
useConfig
();
class
Forbidden
{
...
...
@@ -16,8 +20,12 @@ class Forbidden {
this
.
data
.
set
(
cardId
,
limitCount
);
}
public
get
(
id
:
number
):
number
|
undefined
{
return
this
.
data
.
get
(
id
);
public
get
(
card
:
CardMeta
):
number
|
undefined
{
let
cardForbiddenById
=
this
.
data
.
get
(
card
.
id
);
if
(
isNil
(
cardForbiddenById
)
&&
!
isNil
(
card
.
data
.
alias
))
{
cardForbiddenById
=
this
.
data
.
get
(
card
.
data
.
alias
);
}
return
cardForbiddenById
;
}
private
setForbiddens
(
forbiddens
:
Map
<
number
,
number
>
):
void
{
...
...
src/types/util.d.ts
0 → 100644
View file @
bf99d9a6
type
Enumerate
<
N
extends
number
,
Acc
extends
number
[]
=
[],
>
=
Acc
[
"
length
"
]
extends
N
?
Acc
[
number
]
:
Enumerate
<
N
,
[...
Acc
,
Acc
[
"
length
"
]]
>
;
type
IntRange
<
F
extends
number
,
T
extends
number
>
=
Exclude
<
Enumerate
<
T
>
,
Enumerate
<
F
>
>
;
src/ui/Shared/DeckCard/index.tsx
View file @
bf99d9a6
...
...
@@ -32,7 +32,8 @@ export const DeckCard: React.FC<{
});
drag
(
ref
);
const
[
showText
,
setShowText
]
=
useState
(
true
);
const
limitCnt
=
forbidden
.
get
(
value
.
id
);
const
limitCnt
=
forbidden
.
get
(
value
);
return
(
<
div
className=
{
styles
.
card
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment