Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions frontend/src/app/enhance/[tokenId]/_components/ResultCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import Link from "next/link";

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { designName, RARITY_LABEL } from "@/components/envelope/designs";
import { designName, RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import type { EnvelopeView } from "@/lib/near";

import { BUTTON_PRIMARY, BUTTON_SECONDARY, envelopeName } from "../../../envelopes/_components/shared";
Expand Down Expand Up @@ -108,9 +108,14 @@ function Success({ outcome, name, design }: { outcome: EnhanceOutcome; name: str
+{outcome.from} → +{outcome.to}
</div>
<div className="mt-6 text-2xl font-semibold text-brand">
{rarityUp
? `${RARITY_LABEL[before].toUpperCase()} → ${RARITY_LABEL[after].toUpperCase()} · Rarity upgraded`
: `${RARITY_LABEL[after].toUpperCase()} · Level upgraded`}
{rarityUp && (
<>
<span className={RARITY_TEXT[before]}>{RARITY_LABEL[before].toUpperCase()}</span>
<span className="text-ink-muted"> → </span>
</>
)}
<span className={RARITY_TEXT[after]}>{RARITY_LABEL[after].toUpperCase()}</span>
{rarityUp ? " · Rarity upgraded" : " · Level upgraded"}
</div>
<div className="mt-5 text-xl">{name}</div>
<p className="mt-5 text-[17px] text-ink-muted">One attempt used. A new chapter for your {designName(design)} Envelope.</p>
Expand All @@ -128,7 +133,8 @@ function Failure({ outcome, name, design }: { outcome: EnhanceOutcome; name: str
{name} remains at +{outcome.from}.
</div>
<p className="mt-4 text-lg text-ink-muted">
{RARITY_LABEL[rarityOf(outcome.from)].toUpperCase()} · Your level and rarity are unchanged.
<span className={RARITY_TEXT[rarityOf(outcome.from)]}>{RARITY_LABEL[rarityOf(outcome.from)].toUpperCase()}</span> ·
Your level and rarity are unchanged.
</p>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/enhance/[tokenId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useParams, useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import { useNear, type EnvelopeView } from "@/lib/near";

import {
Expand Down Expand Up @@ -119,7 +119,7 @@ export default function EnhancePage() {
</h1>
<EnvelopeIllustration design={envelope.design} rarity={envelope.rarity} className="mx-auto mt-6 w-[260px] sm:w-[340px]" />
<div className="mt-6 text-5xl font-semibold">+{envelope.level}</div>
<div className="mt-4 text-xl font-semibold uppercase text-brand">{RARITY_LABEL[envelope.rarity]}</div>
<div className={`mt-4 text-xl font-semibold uppercase ${RARITY_TEXT[envelope.rarity]}`}>{RARITY_LABEL[envelope.rarity]}</div>

<div className="mx-auto mt-6 grid max-w-[760px] gap-4 rounded-3xl border border-line bg-seal/40 px-6 py-5 text-left text-[17px] sm:grid-cols-2 sm:gap-10">
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import Link from "next/link";

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import { shortAccount, type EnvelopeView } from "@/lib/near";

import { BUTTON_PRIMARY, envelopeName } from "../../_components/shared";
Expand All @@ -18,10 +18,10 @@ export function EnvelopeHero({ envelope, isOwner }: { envelope: EnvelopeView; is
<h1 className="text-3xl font-semibold tracking-tight sm:text-4xl">
{envelopeName(envelope)} #{envelope.token_id}
</h1>
<div className="mt-4 text-lg font-medium text-brand sm:mt-5">
<div className="mt-4 text-lg font-medium sm:mt-5">
+{envelope.level}
<span className="mx-3">/</span>
{RARITY_LABEL[envelope.rarity].toUpperCase()}
<span className="mx-3 text-ink-muted">/</span>
<span className={RARITY_TEXT[envelope.rarity]}>{RARITY_LABEL[envelope.rarity].toUpperCase()}</span>
</div>
<p className="mt-4 text-[17px]" title={envelope.owner_id}>
Current Owner: {shortAccount(envelope.owner_id)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import Link from "next/link";

import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import { EXPLORER_URL, shortAccount, type EnvelopeView } from "@/lib/near";

import { BUTTON_SECONDARY, formatDate } from "../../_components/shared";
Expand All @@ -20,7 +20,7 @@ export function OverviewTab({
// MVP 강화는 실패해도 레벨이 내려가지 않으므로 성공 횟수 = 현재 레벨 (INTERFACE.md 강화)
const stats = [
{ label: "Level", value: `+${envelope.level}` },
{ label: "Rarity", value: RARITY_LABEL[envelope.rarity] },
{ label: "Rarity", value: RARITY_LABEL[envelope.rarity], className: RARITY_TEXT[envelope.rarity] },
{ label: "Created", value: formatDate(envelope.created_at_ms) },
{ label: "Successful enhancements", value: String(envelope.level) },
{ label: "Times gifted", value: String(envelope.history.length) },
Expand All @@ -37,10 +37,10 @@ export function OverviewTab({
</p>

<dl className="mt-6 grid grid-cols-2 gap-x-6 gap-y-6 sm:grid-cols-3">
{stats.map(({ label, value, title }) => (
{stats.map(({ label, value, title, className }) => (
<div key={label} className="min-w-0">
<dt className="text-sm text-ink-muted">{label}</dt>
<dd className="mt-3 truncate text-xl font-semibold" title={title}>
<dd className={`mt-3 truncate text-xl font-semibold ${className ?? ""}`} title={title}>
{value}
</dd>
</div>
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/app/envelopes/[tokenId]/open/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useParams } from "next/navigation";
import { useEffect, useState } from "react";

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import { GiftBanner } from "@/components/ui/GiftBanner";
import { displayName, useNear, type EnvelopeView, type VaultBalances } from "@/lib/near";
import { isOpened, isReceivedBy, markOpened } from "@/lib/opened";
Expand Down Expand Up @@ -121,7 +121,7 @@ export default function OpenEnvelopePage() {
<h2 className="mt-6 text-3xl font-semibold">
{envelopeName(envelope)} +{envelope.level}
</h2>
<div className="mt-5 text-sm font-semibold uppercase tracking-wide text-brand">
<div className={`mt-5 text-sm font-semibold uppercase tracking-wide ${RARITY_TEXT[envelope.rarity]}`}>
{RARITY_LABEL[envelope.rarity]}
</div>
</div>
Expand Down Expand Up @@ -175,7 +175,8 @@ function Opening({ envelope, from }: { envelope: EnvelopeView; from: string }) {

<EnvelopeIllustration design={envelope.design} rarity={envelope.rarity} className="mx-auto mt-4 w-full max-w-[440px] animate-pulse" />
<div className="mt-6 text-xl font-medium">
{envelopeName(envelope)} +{envelope.level} · {RARITY_LABEL[envelope.rarity]}
{envelopeName(envelope)} +{envelope.level} ·{" "}
<span className={RARITY_TEXT[envelope.rarity]}>{RARITY_LABEL[envelope.rarity]}</span>
</div>
<div className="mt-5 flex items-center justify-center gap-3 text-[17px] text-ink-muted" role="status">
Opening
Expand Down Expand Up @@ -230,7 +231,7 @@ function Revealed({
{envelopeName(envelope)} +{envelope.level}
</div>
<div className="mt-4 text-[17px] text-ink-muted">
{RARITY_LABEL[envelope.rarity]} · Its story continues with you.
<span className={RARITY_TEXT[envelope.rarity]}>{RARITY_LABEL[envelope.rarity]}</span> · Its story continues with you.
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// 소유자: C

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import type { EnvelopeView } from "@/lib/near";

import { envelopeName } from "../../../_components/shared";
Expand All @@ -21,7 +21,7 @@ export function EnvelopeSideCard({
{envelopeName(envelope)} #{envelope.token_id}
</h2>
<div className="mt-4 text-[17px] text-brand">
+{envelope.level} · {RARITY_LABEL[envelope.rarity]}
+{envelope.level} · <span className={RARITY_TEXT[envelope.rarity]}>{RARITY_LABEL[envelope.rarity]}</span>
</div>
<p className="mt-4 text-[15px] leading-relaxed text-ink-muted">{note}</p>
</aside>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/envelopes/_components/EnvelopeListCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import Link from "next/link";

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import { displayName, type EnvelopeView } from "@/lib/near";

import { assetsText, BUTTON_SECONDARY, envelopeName, type BalancesResult } from "./shared";
Expand All @@ -27,7 +27,7 @@ export function EnvelopeListCard({
<h3 className="mt-7 text-2xl font-semibold">
{envelopeName(envelope)} +{envelope.level}
</h3>
<div className="mt-4 text-xs font-semibold uppercase tracking-wide text-brand">
<div className={`mt-4 text-xs font-semibold uppercase tracking-wide ${RARITY_TEXT[envelope.rarity]}`}>
{RARITY_LABEL[envelope.rarity]}
</div>
<div className="mt-4 truncate text-[15px] text-ink-muted" title={from}>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
--color-on-brand: #0a0a0a;

/* 희귀도 강조색 (봉투 그림 public/designs/와 같은 값) */
--color-common: #cfcfca;
--color-rare: #4da3ff;
--color-epic: #b57bff;
--color-legendary: #ffc83d;
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/missions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useSearchParams } from "next/navigation";
import { Suspense, useCallback, useEffect, useState } from "react";

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import { useNear, type EnvelopeView, type NearEventView } from "@/lib/near";

import {
Expand Down Expand Up @@ -186,7 +186,7 @@ function MissionBoard({
{envelopeName(e)} +{e.level}
</span>
<span className="mt-1 block text-sm text-ink-muted">
{RARITY_LABEL[e.rarity]} · #{e.token_id}
<span className={RARITY_TEXT[e.rarity]}>{RARITY_LABEL[e.rarity]}</span> · #{e.token_id}
</span>
<span className="mt-1 block text-sm font-medium text-brand">
{attemptsText(e.enhance_tickets)}
Expand All @@ -204,7 +204,7 @@ function MissionBoard({
<h2 className="text-2xl font-semibold">
{label} +{selected.level}
</h2>
<div className="mt-1 text-ink-muted">{RARITY_LABEL[selected.rarity]}</div>
<div className={`mt-1 ${RARITY_TEXT[selected.rarity]}`}>{RARITY_LABEL[selected.rarity]}</div>
<div className="mt-2 font-semibold text-brand">{attemptsText(selected.enhance_tickets)} ready</div>
</div>
{selected.enhance_tickets > 0 && selected.level < 10 ? (
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/app/send/[tokenId]/AssetsStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// 소유자: C

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import type { EnvelopeView, VaultBalances } from "@/lib/near";

import {
Expand Down Expand Up @@ -65,8 +65,9 @@ export function AssetsStep({
<div className="rounded-3xl border border-line bg-surface p-6">
<EnvelopeIllustration design={envelope.design} rarity={envelope.rarity} className="w-full" />
<h3 className="mt-6 text-2xl font-semibold">{envelopeTitle(envelope)}</h3>
<div className="mt-4 text-[13px] font-medium text-brand">
{RARITY_LABEL[envelope.rarity].toUpperCase()} · Gifted {gifted} {gifted === 1 ? "time" : "times"}
<div className="mt-4 text-[13px] font-medium text-ink-muted">
<span className={RARITY_TEXT[envelope.rarity]}>{RARITY_LABEL[envelope.rarity].toUpperCase()}</span> · Gifted{" "}
{gifted} {gifted === 1 ? "time" : "times"}
</div>
<div className="mt-4 text-[15px] text-ink-muted">Assets inside now: {formatAssets(inside) ?? "None"}</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/send/[tokenId]/PreviewStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// 소유자: C

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import { displayName, type EnvelopeView } from "@/lib/near";

import { envelopeTitle, StepHeader } from "./shared";
Expand Down Expand Up @@ -44,7 +44,7 @@ export function PreviewStep({
<div className="rounded-3xl border border-line bg-paper p-10 text-center">
<EnvelopeIllustration design={envelope.design} rarity={envelope.rarity} className="w-full" />
<h3 className="mt-8 text-3xl font-semibold">{envelopeTitle(envelope)}</h3>
<div className="mt-5 text-sm font-semibold uppercase tracking-wide text-brand">
<div className={`mt-5 text-sm font-semibold uppercase tracking-wide ${RARITY_TEXT[envelope.rarity]}`}>
{RARITY_LABEL[envelope.rarity]}
</div>
<p className="mt-6 text-left text-[15px] text-ink-muted">
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/send/[tokenId]/RecipientStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { useEffect, useState } from "react";

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import { displayName, isValidAccountId, NETWORK, useNear, type EnvelopeView } from "@/lib/near";

import { envelopeTitle, StepHeader } from "./shared";
Expand Down Expand Up @@ -117,7 +117,7 @@ export function RecipientStep({
<div className="rounded-3xl border border-line bg-paper p-7">
<EnvelopeIllustration design={envelope.design} rarity={envelope.rarity} className="w-full" />
<h3 className="mt-6 text-2xl font-semibold">{envelopeTitle(envelope)}</h3>
<div className="mt-4 text-xs font-semibold uppercase tracking-wide text-brand">
<div className={`mt-4 text-xs font-semibold uppercase tracking-wide ${RARITY_TEXT[envelope.rarity]}`}>
{RARITY_LABEL[envelope.rarity]}
</div>
<div className="mt-6 text-xl">Inside: {totalText ?? "Nothing"}</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/send/[tokenId]/SentView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import Link from "next/link";

import { EnvelopeIllustration } from "@/components/envelope/EnvelopeIllustration";
import { RARITY_LABEL } from "@/components/envelope/designs";
import { RARITY_LABEL, RARITY_TEXT } from "@/components/envelope/designs";
import { displayName, EXPLORER_URL, type EnvelopeView } from "@/lib/near";

import { envelopeTitle } from "./shared";
Expand All @@ -30,7 +30,7 @@ export function SentView({

<EnvelopeIllustration design={envelope.design} rarity={envelope.rarity} className="mx-auto mt-2 w-full max-w-[360px]" />
<h2 className="mt-6 text-3xl font-semibold">{envelopeTitle(envelope)}</h2>
<div className="mt-5 text-sm font-semibold uppercase tracking-wide text-brand">
<div className={`mt-5 text-sm font-semibold uppercase tracking-wide ${RARITY_TEXT[envelope.rarity]}`}>
{RARITY_LABEL[envelope.rarity]}
</div>
<p className="mt-5 text-2xl">
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/envelope/ChooseEnvelopeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import type { EnvelopeView } from "@/lib/near";

import { designName, RARITY_LABEL } from "./designs";
import { designName, RARITY_LABEL, RARITY_TEXT } from "./designs";
import { EnvelopeIllustration } from "./EnvelopeIllustration";

const formatDate = (ms: number) =>
Expand All @@ -30,7 +30,7 @@ export function ChooseEnvelopeCard({
<h3 className="mt-7 text-2xl font-semibold">
{designName(envelope.design)} Envelope +{envelope.level}
</h3>
<div className="mt-4 text-xs font-semibold uppercase tracking-wide text-brand">
<div className={`mt-4 text-xs font-semibold uppercase tracking-wide ${RARITY_TEXT[envelope.rarity]}`}>
{RARITY_LABEL[envelope.rarity]}
</div>
<div className="mt-4 space-y-0.5 text-[15px] text-ink-muted">
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/envelope/ReceivedEnvelopeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Link from "next/link";

import { displayName, type EnvelopeView } from "@/lib/near";

import { designName, RARITY_LABEL } from "./designs";
import { designName, RARITY_LABEL, RARITY_TEXT } from "./designs";
import { EnvelopeIllustration } from "./EnvelopeIllustration";

export function ReceivedEnvelopeCard({ envelope, opened }: { envelope: EnvelopeView; opened: boolean }) {
Expand All @@ -21,7 +21,7 @@ export function ReceivedEnvelopeCard({ envelope, opened }: { envelope: EnvelopeV
<div className="truncate text-[17px] font-semibold">
{designName(envelope.design)} Envelope +{envelope.level}
</div>
<div className="mt-2 text-[13px] font-medium text-brand">{RARITY_LABEL[envelope.rarity]}</div>
<div className={`mt-2 text-[13px] font-medium ${RARITY_TEXT[envelope.rarity]}`}>{RARITY_LABEL[envelope.rarity]}</div>
<div className="mt-2 truncate text-sm text-ink-muted">
{from ? `From ${displayName(from)}` : "Minted by you"} · {opened ? "Opened" : "Unopened"}
</div>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/envelope/designs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ export const DESIGN_NAMES = ["Classic", "Golden", "Midnight"] as const;
export const designName = (design: number) => DESIGN_NAMES[design] ?? "Classic";

/** 화면 표기용. 온체인 값 Basic은 시안대로 Common으로 보여 준다. */
/** 희귀도 글자색 (globals.css --color-common / rare / epic / legendary, 봉투 그림과 같은 색) */
export const RARITY_TEXT: Record<Rarity, string> = {
Basic: "text-common",
Rare: "text-rare",
Epic: "text-epic",
Legendary: "text-legendary",
};

export const RARITY_LABEL: Record<Rarity, string> = {
Basic: "Common",
Rare: "Rare",
Expand Down
Loading