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
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
baichixing
Neos
Commits
7a7c2e86
Commit
7a7c2e86
authored
May 27, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move getCardImgUrl under api path
parent
595e4e0e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
25 deletions
+30
-25
src/api/cards.ts
src/api/cards.ts
+21
-0
src/ui/Duel/Message/AnnounceModal/index.tsx
src/ui/Duel/Message/AnnounceModal/index.tsx
+6
-2
src/ui/Duel/Message/SortCardModal/index.tsx
src/ui/Duel/Message/SortCardModal/index.tsx
+1
-2
src/ui/Shared/YgoCard/index.tsx
src/ui/Shared/YgoCard/index.tsx
+2
-21
No files found.
src/api/cards.ts
View file @
7a7c2e86
import
{
useConfig
}
from
"
@/config
"
;
import
sqliteMiddleWare
,
{
sqliteCmd
}
from
"
@/middleware/sqlite
"
;
import
sqliteMiddleWare
,
{
sqliteCmd
}
from
"
@/middleware/sqlite
"
;
import
{
FtsParams
}
from
"
@/middleware/sqlite/fts
"
;
import
{
FtsParams
}
from
"
@/middleware/sqlite/fts
"
;
import
{
isSuperReleaseCard
}
from
"
./superPreRelease
"
;
const
NeosConfig
=
useConfig
();
export
interface
CardMeta
{
export
interface
CardMeta
{
id
:
number
;
id
:
number
;
data
:
CardData
;
data
:
CardData
;
...
@@ -71,3 +76,19 @@ export function getCardStr(meta: CardMeta, idx: number): string | undefined {
...
@@ -71,3 +76,19 @@ export function getCardStr(meta: CardMeta, idx: number): string | undefined {
const
str
=
`str
${
idx
+
1
}
`
as
CardStrRange
;
const
str
=
`str
${
idx
+
1
}
`
as
CardStrRange
;
return
meta
.
text
[
str
];
return
meta
.
text
[
str
];
}
}
export
function
getCardImgUrl
(
code
:
number
,
back
=
false
)
{
const
ASSETS_BASE
=
import
.
meta
.
env
.
BASE_URL
===
"
/
"
?
NeosConfig
.
assetsPath
:
`
${
import
.
meta
.
env
.
BASE_URL
}${
NeosConfig
.
assetsPath
}
`
;
if
(
back
||
code
===
0
)
{
return
`
${
ASSETS_BASE
}
/card_back.jpg`
;
}
if
(
isSuperReleaseCard
(
code
))
{
return
`
${
NeosConfig
.
preReleaseImgUrl
}
/
${
code
}
.jpg`
;
}
else
{
return
`
${
NeosConfig
.
releaseImgUrl
}
/
${
code
}
.jpg`
;
}
}
src/ui/Duel/Message/AnnounceModal/index.tsx
View file @
7a7c2e86
...
@@ -3,10 +3,14 @@ import { Avatar, Button, Checkbox, Input, List } from "antd";
...
@@ -3,10 +3,14 @@ import { Avatar, Button, Checkbox, Input, List } from "antd";
import
React
,
{
useState
}
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
CardMeta
,
searchCards
,
sendSelectOptionResponse
}
from
"
@/api
"
;
import
{
CardMeta
,
getCardImgUrl
,
searchCards
,
sendSelectOptionResponse
,
}
from
"
@/api
"
;
import
{
isDeclarable
,
isToken
}
from
"
@/common
"
;
import
{
isDeclarable
,
isToken
}
from
"
@/common
"
;
import
{
emptySearchConditions
}
from
"
@/middleware/sqlite/fts
"
;
import
{
emptySearchConditions
}
from
"
@/middleware/sqlite/fts
"
;
import
{
getCardImgUrl
}
from
"
@/ui/Shared
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
...
...
src/ui/Duel/Message/SortCardModal/index.tsx
View file @
7a7c2e86
...
@@ -21,8 +21,7 @@ import React, { useEffect, useState } from "react";
...
@@ -21,8 +21,7 @@ import React, { useEffect, useState } from "react";
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
sendSortCardResponse
}
from
"
@/api
"
;
import
{
sendSortCardResponse
}
from
"
@/api
"
;
import
{
CardMeta
}
from
"
@/api/cards
"
;
import
{
CardMeta
,
getCardImgUrl
}
from
"
@/api/cards
"
;
import
{
getCardImgUrl
}
from
"
@/ui/Shared
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
...
...
src/ui/Shared/YgoCard/index.tsx
View file @
7a7c2e86
import
classNames
from
"
classnames
"
;
import
classNames
from
"
classnames
"
;
import
{
CSSProperties
,
useMemo
}
from
"
react
"
;
import
{
CSSProperties
,
useMemo
}
from
"
react
"
;
import
{
isSuperReleaseCard
}
from
"
@/api
"
;
import
{
getCardImgUrl
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
...
@@ -10,6 +9,7 @@ interface Props {
...
@@ -10,6 +9,7 @@ interface Props {
className
?:
string
;
className
?:
string
;
isBack
?:
boolean
;
isBack
?:
boolean
;
code
?:
number
;
code
?:
number
;
targeted
?:
boolean
;
// cardName?: string;
// cardName?: string;
style
?:
CSSProperties
;
style
?:
CSSProperties
;
width
?:
number
|
string
;
width
?:
number
|
string
;
...
@@ -50,22 +50,3 @@ export const YgoCard: React.FC<Props> = (props) => {
...
@@ -50,22 +50,3 @@ export const YgoCard: React.FC<Props> = (props) => {
[
code
],
[
code
],
);
);
};
};
const
NeosConfig
=
useConfig
();
// TODO: 这个函数应该从这个文件抽离出来作为公共的函数使用
export
function
getCardImgUrl
(
code
:
number
,
back
=
false
)
{
const
ASSETS_BASE
=
import
.
meta
.
env
.
BASE_URL
===
"
/
"
?
NeosConfig
.
assetsPath
:
`
${
import
.
meta
.
env
.
BASE_URL
}${
NeosConfig
.
assetsPath
}
`
;
if
(
back
||
code
===
0
)
{
return
`
${
ASSETS_BASE
}
/card_back.jpg`
;
}
if
(
isSuperReleaseCard
(
code
))
{
return
`
${
NeosConfig
.
preReleaseImgUrl
}
/
${
code
}
.jpg`
;
}
else
{
return
`
${
NeosConfig
.
releaseImgUrl
}
/
${
code
}
.jpg`
;
}
}
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