Skip to content

Commit 1ab2e9a

Browse files
committed
feat(sanity,site): add interactive TierListStudioInput board, tierList Portable Text block, and auto-paste table conversion
1 parent a933641 commit 1ab2e9a

10 files changed

Lines changed: 2658 additions & 47 deletions

File tree

‎apps/sanity/components/TierListStudioInput.tsx‎

Lines changed: 1305 additions & 0 deletions
Large diffs are not rendered by default.

‎apps/sanity/components/pastehandler.ts‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,80 @@ function deserializeTableElement(
167167
};
168168
});
169169

170+
if (rows.length >= 2) {
171+
const headCells = (rows[0].cells ?? []).map((c) => (c || "").trim());
172+
const bodyRows = rows.slice(1);
173+
const firstHeader = (headCells[0] ?? "").toLowerCase();
174+
const isTierTable =
175+
(firstHeader === "tier" ||
176+
firstHeader === "tier rank" ||
177+
firstHeader === "rank") &&
178+
bodyRows.every((r) =>
179+
/^[sabcd](\b|-|\s|$)/i.test(((r.cells ?? [])[0] ?? "").trim()),
180+
);
181+
182+
if (isTierTable) {
183+
const verdictIdx = headCells.findIndex((h) =>
184+
/verdict|why|summary|notes/i.test(h),
185+
);
186+
const pricingIdx = headCells.findIndex((h) =>
187+
/price|pricing|cost|quota/i.test(h),
188+
);
189+
190+
const items = bodyRows.map((row, rIdx) => {
191+
const cells = (row.cells ?? []).map((c) => (c || "").trim());
192+
const rawTier = (cells[0] ?? "B").toUpperCase().charAt(0);
193+
const tier =
194+
rawTier === "S" ||
195+
rawTier === "A" ||
196+
rawTier === "B" ||
197+
rawTier === "C" ||
198+
rawTier === "D"
199+
? rawTier
200+
: "B";
201+
const name = cells[1] || `Platform ${rIdx + 1}`;
202+
const category = cells[2] || "";
203+
const summary =
204+
verdictIdx >= 3 && cells[verdictIdx]
205+
? cells[verdictIdx]
206+
: cells[3] || "";
207+
208+
const details = [];
209+
for (let cIdx = 3; cIdx < cells.length; cIdx++) {
210+
const val = cells[cIdx];
211+
if (!val || val === summary) continue;
212+
details.push({
213+
_type: "tierDetail",
214+
label: headCells[cIdx] || `Spec ${cIdx - 2}`,
215+
value: val,
216+
});
217+
}
218+
219+
const badge =
220+
pricingIdx >= 2 && cells[pricingIdx] ? cells[pricingIdx] : undefined;
221+
222+
return {
223+
_type: "tierItem",
224+
tier,
225+
name,
226+
...(category ? { category } : {}),
227+
...(summary ? { summary } : {}),
228+
...(badge ? { badge } : {}),
229+
details,
230+
};
231+
});
232+
233+
return block({
234+
_type: "tierList",
235+
title: `Alex's Architectural Tier List (${items.length} Platforms Ranked)`,
236+
subtitle:
237+
"Ranked from S-Tier (Purrfect Production Pick) to D-Tier based on security boundaries, memory architecture, and real-world DX.",
238+
ajComment: "I ranked all of them! Watch out for shared VMs... 👀🐾",
239+
items,
240+
});
241+
}
242+
}
243+
170244
return block({
171245
_type: "table",
172246
rows,

0 commit comments

Comments
 (0)