special treatment for limited aime cards

This commit is contained in:
ppc
2025-02-05 08:43:48 +00:00
parent 7f51e4a0ee
commit 805af19006
2 changed files with 17 additions and 10 deletions
+11 -10
View File
@@ -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>
);
+6
View File
@@ -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(),