From 805af19006188e7566b52e44dee5ad71b68381a7 Mon Sep 17 00:00:00 2001 From: ppc Date: Wed, 5 Feb 2025 08:28:02 +0000 Subject: [PATCH] special treatment for limited aime cards --- amnet-native/components/ICCard.tsx | 21 +++++++++++---------- amnet-native/models/AMCard.ts | 6 ++++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/amnet-native/components/ICCard.tsx b/amnet-native/components/ICCard.tsx index 4c5e46d..d8507f8 100644 --- a/amnet-native/components/ICCard.tsx +++ b/amnet-native/components/ICCard.tsx @@ -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 ( - + @@ -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 ( @@ -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 ( - - - {props.physicalCard.isBootlegAmusementCard ? "Bootleg " : null}{ICVendorName(props.physicalCard.cardVendor)} + {React.createElement(icon, {size: 18, color})} + + {props.card.physicalCardData.isBootlegAmusementCard ? "Bootleg " : null}{ICVendorName(props.card.physicalCardData.cardVendor)} ); diff --git a/amnet-native/models/AMCard.ts b/amnet-native/models/AMCard.ts index 430eeb1..f0e074f 100644 --- a/amnet-native/models/AMCard.ts +++ b/amnet-native/models/AMCard.ts @@ -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 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(),