mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-09-30 18:57:54 +03:00
special treatment for limited aime cards
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import {Text} from "react-native";
|
||||
import {ReactNode, useMemo} from "react";
|
||||
import {CreditCard, History, Joystick, RailSymbol} from "lucide-react-native";
|
||||
import React, {ReactNode, useMemo} from "react";
|
||||
import {CreditCard, Gem, History, Joystick, LucideIcon, RailSymbol} from "lucide-react-native";
|
||||
|
||||
import TimeAgo from "./TimeAgo";
|
||||
import {AMUICard, AMUICardActionProps, AMUICardDetail} from "./AMUICard";
|
||||
|
||||
import {AMCardData, AMPhysicalCardData} from "../models/AMCard";
|
||||
import {AMCardData} from "../models/AMCard";
|
||||
import {AmusementICVendor, ICType} from "../lib/iccard";
|
||||
|
||||
export interface ICCardProps extends AMUICardActionProps {
|
||||
@@ -22,7 +22,7 @@ export function ICCard(props: ICCardProps) {
|
||||
|
||||
return (
|
||||
<AMUICard title={props.card.name} {...props}>
|
||||
<PhysicalICInfo physicalCard={props.card.physicalCardData}/>
|
||||
<PhysicalICInfo card={props.card}/>
|
||||
|
||||
<AMUICardDetail>
|
||||
<CreditCard size={18} color="gray"/>
|
||||
@@ -40,8 +40,8 @@ export function ICCard(props: ICCardProps) {
|
||||
);
|
||||
}
|
||||
|
||||
function PhysicalICInfo(props: { physicalCard: AMPhysicalCardData | null }) {
|
||||
if (props.physicalCard?.cardType === ICType.Transport) {
|
||||
function PhysicalICInfo(props: { card: AMCardData | null }) {
|
||||
if (props.card.physicalCardData?.cardType === ICType.Transport) {
|
||||
return (
|
||||
<AMUICardDetail>
|
||||
<RailSymbol size={18} color="gray"/>
|
||||
@@ -50,12 +50,13 @@ function PhysicalICInfo(props: { physicalCard: AMPhysicalCardData | null }) {
|
||||
)
|
||||
}
|
||||
|
||||
if (props.physicalCard?.cardVendor) {
|
||||
if (props.card.physicalCardData?.cardVendor) {
|
||||
const [icon, color]: [LucideIcon, string] = props.card.isLimitedAimeCard ? [Gem, "crimson"] : [Joystick, "gray"];
|
||||
return (
|
||||
<AMUICardDetail>
|
||||
<Joystick size={18} color="gray"/>
|
||||
<Text style={{color: "gray"}}>
|
||||
{props.physicalCard.isBootlegAmusementCard ? "Bootleg " : null}{ICVendorName(props.physicalCard.cardVendor)}
|
||||
{React.createElement(icon, {size: 18, color})}
|
||||
<Text style={{color}}>
|
||||
{props.card.physicalCardData.isBootlegAmusementCard ? "Bootleg " : null}{ICVendorName(props.card.physicalCardData.cardVendor)}
|
||||
</Text>
|
||||
</AMUICardDetail>
|
||||
);
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface AMCardData {
|
||||
|
||||
added: Date;
|
||||
lastUsed?: Date | null;
|
||||
isLimitedAimeCard: boolean;
|
||||
physicalCardData?: AMPhysicalCardData | null;
|
||||
}
|
||||
|
||||
@@ -22,6 +23,11 @@ export class AMCard extends Realm.Object<AMCard> implements AMCardData {
|
||||
|
||||
physicalCardData?: AMPhysicalCardData | null = null;
|
||||
|
||||
get isLimitedAimeCard() {
|
||||
// limited cards use the company code 500
|
||||
return this.physicalCardData?.cardType === ICType.Amusement && this.code.startsWith('500');
|
||||
}
|
||||
|
||||
static generate(code: string, name: string) {
|
||||
return {
|
||||
_id: new Realm.BSON.ObjectId(),
|
||||
|
||||
Reference in New Issue
Block a user