Skip to content

Commit

Permalink
feat: api 更改,card 相关字段从 number 变成 string
Browse files Browse the repository at this point in the history
  • Loading branch information
UeidaNuima committed Nov 14, 2021
1 parent 4892898 commit b25cad1
Show file tree
Hide file tree
Showing 18 changed files with 56 additions and 47 deletions.
22 changes: 11 additions & 11 deletions docs/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"files": {
"main.css": "/static/css/main.bf5b162e.chunk.css",
"main.js": "/static/js/main.0d072fb4.chunk.js",
"main.js.map": "/static/js/main.0d072fb4.chunk.js.map",
"main.js": "/static/js/main.54d75268.chunk.js",
"main.js.map": "/static/js/main.54d75268.chunk.js.map",
"runtime-main.js": "/static/js/runtime-main.c42d8ef7.js",
"runtime-main.js.map": "/static/js/runtime-main.c42d8ef7.js.map",
"static/css/2.db4919ad.chunk.css": "/static/css/2.db4919ad.chunk.css",
"static/js/2.4f39188a.chunk.js": "/static/js/2.4f39188a.chunk.js",
"static/js/2.4f39188a.chunk.js.map": "/static/js/2.4f39188a.chunk.js.map",
"static/css/2.3012c0eb.chunk.css": "/static/css/2.3012c0eb.chunk.css",
"static/js/2.48beed53.chunk.js": "/static/js/2.48beed53.chunk.js",
"static/js/2.48beed53.chunk.js.map": "/static/js/2.48beed53.chunk.js.map",
"index.html": "/index.html",
"precache-manifest.af3993036cc75bf0eebfad083cb3b89f.js": "/precache-manifest.af3993036cc75bf0eebfad083cb3b89f.js",
"precache-manifest.3e0129bec66c998a42a04024fe001ddc.js": "/precache-manifest.3e0129bec66c998a42a04024fe001ddc.js",
"service-worker.js": "/service-worker.js",
"static/css/2.db4919ad.chunk.css.map": "/static/css/2.db4919ad.chunk.css.map",
"static/css/2.3012c0eb.chunk.css.map": "/static/css/2.3012c0eb.chunk.css.map",
"static/css/main.bf5b162e.chunk.css.map": "/static/css/main.bf5b162e.chunk.css.map",
"static/js/2.4f39188a.chunk.js.LICENSE": "/static/js/2.4f39188a.chunk.js.LICENSE",
"static/js/2.48beed53.chunk.js.LICENSE": "/static/js/2.48beed53.chunk.js.LICENSE",
"static/media/logo.png": "/static/media/logo.509ca4a9.png",
"static/media/pay.png": "/static/media/pay.f5dab129.png"
},
"entrypoints": [
"static/js/runtime-main.c42d8ef7.js",
"static/css/2.db4919ad.chunk.css",
"static/js/2.4f39188a.chunk.js",
"static/css/2.3012c0eb.chunk.css",
"static/js/2.48beed53.chunk.js",
"static/css/main.bf5b162e.chunk.css",
"static/js/main.0d072fb4.chunk.js"
"static/js/main.54d75268.chunk.js"
]
}
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="zh"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="icon" type="image/png" href="/logo.png"/><link rel="manifest" href="/manifest.json"/><title>Naberius</title><link href="/static/css/2.db4919ad.chunk.css" rel="stylesheet"><link href="/static/css/main.bf5b162e.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],Object.prototype.hasOwnProperty.call(p,t)&&p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var r=this["webpackJsonpnaberius-frontend"]=this["webpackJsonpnaberius-frontend"]||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="/static/js/2.4f39188a.chunk.js"></script><script src="/static/js/main.0d072fb4.chunk.js"></script></body></html>
<!doctype html><html lang="zh"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="icon" type="image/png" href="/logo.png"/><link rel="manifest" href="/manifest.json"/><title>Naberius</title><link href="/static/css/2.3012c0eb.chunk.css" rel="stylesheet"><link href="/static/css/main.bf5b162e.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],Object.prototype.hasOwnProperty.call(p,t)&&p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var r=this["webpackJsonpnaberius-frontend"]=this["webpackJsonpnaberius-frontend"]||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="/static/js/2.48beed53.chunk.js"></script><script src="/static/js/main.54d75268.chunk.js"></script></body></html>
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "555fce2e7554c4f4e181f7c6011e084e",
"revision": "756fa173f48dd3f4a88b795e5d60ad37",
"url": "/index.html"
},
{
"revision": "77b24a4a7ad322b92e01",
"url": "/static/css/2.db4919ad.chunk.css"
"revision": "1e6f1b2044de4b004fab",
"url": "/static/css/2.3012c0eb.chunk.css"
},
{
"revision": "4d16677bdaae29b6e06b",
"revision": "8a64455c9b799aeedcf1",
"url": "/static/css/main.bf5b162e.chunk.css"
},
{
"revision": "77b24a4a7ad322b92e01",
"url": "/static/js/2.4f39188a.chunk.js"
"revision": "1e6f1b2044de4b004fab",
"url": "/static/js/2.48beed53.chunk.js"
},
{
"revision": "d6a7472a13919fb2e347fd9298bef2a8",
"url": "/static/js/2.4f39188a.chunk.js.LICENSE"
"url": "/static/js/2.48beed53.chunk.js.LICENSE"
},
{
"revision": "4d16677bdaae29b6e06b",
"url": "/static/js/main.0d072fb4.chunk.js"
"revision": "8a64455c9b799aeedcf1",
"url": "/static/js/main.54d75268.chunk.js"
},
{
"revision": "8bd58515cb0081862933",
Expand Down
2 changes: 1 addition & 1 deletion docs/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
"/precache-manifest.af3993036cc75bf0eebfad083cb3b89f.js"
"/precache-manifest.3e0129bec66c998a42a04024fe001ddc.js"
);

self.addEventListener('message', (event) => {
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/static/css/2.3012c0eb.chunk.css.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/static/css/2.db4919ad.chunk.css.map

This file was deleted.

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions docs/static/js/2.48beed53.chunk.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/static/js/2.4f39188a.chunk.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions docs/static/js/main.0d072fb4.chunk.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/static/js/main.0d072fb4.chunk.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions docs/static/js/main.54d75268.chunk.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/static/js/main.54d75268.chunk.js.map

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions src/Components/Routes/UnitList/UnitList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const UnitList: React.FC<Props> = ({ data, loading }) => {
}
};

const showUnit = (cardID: number) => {
const showUnit = (cardID: string) => {
history.push({
pathname: `/unit/${cardID}`,
state: { modal: true },
Expand All @@ -136,7 +136,13 @@ const UnitList: React.FC<Props> = ({ data, loading }) => {
const cards =
(data &&
data.Cards &&
data.Cards.slice().sort(cardSorter).filter(cardFilter)) ||
data.Cards.slice()
.map((card) => ({
...card,
CardID: Number.parseInt(card.CardID, 10),
}))
.sort(cardSorter)
.filter(cardFilter)) ||
[];

return (
Expand Down Expand Up @@ -197,7 +203,10 @@ const UnitList: React.FC<Props> = ({ data, loading }) => {
{({ index, style }) => (
<div key={cards[index].CardID} style={style}>
<UnitListCard
card={cards[index]}
card={{
...cards[index],
CardID: String(cards[index].CardID),
}}
showUnit={showUnit}
setFilter={handleSetFilter}
/>
Expand Down
20 changes: 10 additions & 10 deletions src/Components/Routes/UnitList/UnitListCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import classNames from 'classnames';

interface UnitListCardProps {
card: Card;
showUnit: (cardID: number) => void;
showUnit: (cardID: string) => void;
setFilter: (search: string, searchType: string) => void;
style?: React.CSSProperties;
}
Expand All @@ -28,8 +28,8 @@ const UnitListCard: React.FC<UnitListCardProps> = ({
<div
style={style}
className={classNames(styles.listCard, {
[styles.male]: card.Kind === 1,
[styles.female]: card.Kind === 0,
[styles.male]: Number.parseInt(card.Kind) === 1,
[styles.female]: Number.parseInt(card.Kind) === 0,
})}
>
<Row
Expand All @@ -48,14 +48,14 @@ const UnitListCard: React.FC<UnitListCardProps> = ({
/>
</Col>
<Col md={4} xs={16}>
<Rarity rare={card.Rare} />
<Rarity rare={Number.parseInt(card.Rare, 10)} />
<br />
{card.Name}
</Col>
<Col lg={6} xs={0}>
{card.RaceName && (
<span
onClick={e => {
onClick={(e) => {
e.stopPropagation();
setFilter(card.RaceName, 'RaceName');
}}
Expand All @@ -65,7 +65,7 @@ const UnitListCard: React.FC<UnitListCardProps> = ({
)}
{card.AssignName && (
<span
onClick={e => {
onClick={(e) => {
e.stopPropagation();
setFilter(card.AssignName, 'AssignName');
}}
Expand All @@ -75,7 +75,7 @@ const UnitListCard: React.FC<UnitListCardProps> = ({
)}
{card.IdentityName && (
<span
onClick={e => {
onClick={(e) => {
e.stopPropagation();
setFilter(card.IdentityName, 'IdentityName');
}}
Expand All @@ -85,7 +85,7 @@ const UnitListCard: React.FC<UnitListCardProps> = ({
)}
{card.GenusName && (
<span
onClick={e => {
onClick={(e) => {
e.stopPropagation();
setFilter(card.GenusName, 'GenusName');
}}
Expand All @@ -99,7 +99,7 @@ const UnitListCard: React.FC<UnitListCardProps> = ({
md={8}
xs={0}
className="filter"
onClick={e => {
onClick={(e) => {
e.stopPropagation();
setFilter(card.Classes[0].Name, 'Classes.0.Name');
}}
Expand All @@ -111,7 +111,7 @@ const UnitListCard: React.FC<UnitListCardProps> = ({
md={8}
xs={0}
className="filter"
onClick={e => {
onClick={(e) => {
e.stopPropagation();
setFilter(card.IllustName, 'IllustName');
}}
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Routes/UnitList/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export interface Card {
CardID: number;
CardID: string;
Name: string;
Rare: number;
Kind: number;
Rare: string;
Kind: string;
IllustName: string;
RaceName: string;
AssignName: string;
Expand Down

0 comments on commit b25cad1

Please sign in to comment.