From bb149e10e8a234d83b93be00a09ef32a0a1a215b Mon Sep 17 00:00:00 2001 From: nuo <49533950+nuoxoxo@users.noreply.github.com> Date: Wed, 20 Sep 2023 11:51:07 +0200 Subject: [PATCH] 2212 : hide individual alt.tsx . combined alt in route 2212 --- src/App.tsx | 6 +++--- src/includes/Aoc2212.tsx | 23 +++++++++++++---------- src/styles/App.scss | 6 +++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 8572d61..fd12fcd 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,7 +2,7 @@ import { useState } from "react"; // import Aoc2223 from "./includes/Aoc2223"; import Aoc2222 from "./includes/Aoc2222"; import Aoc2212 from "./includes/Aoc2212"; // New New -import Aoc2212Alt from "./includes/Aoc2212Alt"; +// import Aoc2212Alt from "./includes/Aoc2212Alt"; import Aoc2210 from "./includes/Aoc2210"; import Aoc2105 from "./includes/Aoc2105"; // New import Aoc2003 from "./includes/Aoc2003"; // New New @@ -27,7 +27,7 @@ const routes: { [key: string]: TargetRoute } = { // 2223: Aoc2223, 2222: Aoc2222, 2212: Aoc2212, // New - '2212Alt': Aoc2212Alt, // New + // '2212Alt': Aoc2212Alt, // New 2210: Aoc2210, 2105: Aoc2105, 2003: Aoc2003, @@ -78,7 +78,7 @@ function App() { > { key === "DadJokes" ? "Jokes" : key === "Nut" ? "Nut" - : key === '2212Alt' ? "22:12\'" + // : key === '2212Alt' ? "22:12\'" : key.replace(/^(\d{2})(\d{1,2})$/, "$1:$2")} ))} diff --git a/src/includes/Aoc2212.tsx b/src/includes/Aoc2212.tsx index 0df5e61..52a86c6 100644 --- a/src/includes/Aoc2212.tsx +++ b/src/includes/Aoc2212.tsx @@ -1,7 +1,10 @@ import { useState, useEffect } from "react" import { FetchData, LenNStrsFromLine } from "../helpers/Helpers" -const choice:string = 'in' +const [sp1, sp2] = [' ', ''] + +const suffixes = ['in', 'alt'] +const choice = suffixes[Math.floor(Math.random() * suffixes.length)] const URL:string = "https://raw.githubusercontent.com/nuoxoxo/in/main/aoc/2212." + choice const symbolArr = ["○", '✲', '✳', '✵', '✶', '✻', '✼'] @@ -76,7 +79,7 @@ var Aoc2212 = () => { while (++i < mp.length) { let j: number = -1 while (++j < mp[i].length) { - if (mp[i][j] > 170) { + if (mp[i][j] > (choice == 'in' ? 170 : 242)) { tempGrid[i][j] = symbol } } @@ -246,33 +249,33 @@ var Aoc2212 = () => {