Use is_archive for checking hack archive status

This commit is contained in:
Jared Schoeny
2025-12-24 00:01:56 -10:00
parent b5a4e53368
commit 3d5db2ed3c
14 changed files with 71 additions and 56 deletions

View File

@@ -18,6 +18,7 @@ type Archive = {
creator_username: string | null;
approved: boolean;
current_patch: number | null;
is_archive: boolean;
};
type ArchivesData =

View File

@@ -436,7 +436,7 @@ export default function HackSubmitForm({
if (github) fd.set('github', github);
if (tags.length) fd.set('tags', tags.join(','));
if (isArchive) {
fd.set('isArchive', 'true');
fd.set('is_archive', 'true');
}
if (originalAuthor) {
fd.set('original_author', originalAuthor);
@@ -632,6 +632,7 @@ export default function HackSubmitForm({
: undefined,
createdAt: new Date().toISOString(),
patchUrl: "",
is_archive: isArchive,
};
const hasBaseRom = !!baseRom.trim();

View File

@@ -24,11 +24,11 @@ export interface HackCardAttributes {
version: string;
summary?: string;
description?: string;
isArchive?: boolean;
is_archive: boolean;
};
export default function HackCard({ hack, clickable = true, className = "" }: { hack: HackCardAttributes; clickable?: boolean; className?: string }) {
const isArchive = !!hack.isArchive;
const isArchive = hack.is_archive;
const { isLinked, hasPermission, hasCached } = useBaseRoms();
const match = baseRoms.find((r) => r.id === hack.baseRomId);
const baseId = match?.id ?? undefined;