+
{["Easy", "Medium", "Hard"].map((label, index) => (
{label}
- {index === 0 ? "Sharper club clues" : index === 1 ? "Less obvious player pool" : "Career-history riddles"}
+ {index === 0 ? "Fast entry" : index === 1 ? "Less obvious pool" : "Career-history riddles"}
))}
@@ -83,57 +137,91 @@ export default function OpenGraphImage() {
+
+
+
+ Today
+
+
+ hidden11 #124
+
+
+
+ Shareable
+
+
+
{[
- ["", "ST", ""],
- ["WING", "", "MID"],
- ["", "DEF", ""],
- ["", "GK", ""],
- ].map((row, rowIndex) => (
-
- {row.map((cell, cellIndex) =>
- cell ? (
+ { label: "Easy", time: "1:24", color: "#3ee696" },
+ { label: "Medium", time: "2:08", color: "#facc15" },
+ { label: "Hard", time: "3:41", color: "#ffffff" },
+ ].map((card) => (
+
+
+
{card.label}
+
{card.time}
+
+
+ {Array.from({ length: 5 }).map((_, index) => (
- {cell}
-
- ) : (
-
- ),
- )}
+ />
+ ))}
+
))}
+
+
hidden11.app
diff --git a/app/page.tsx b/app/page.tsx
index 992a4ac..5ea2b65 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -7,6 +7,7 @@ import Pitch from "@/components/Pitch";
import PlayerSearch from "@/components/PlayerSearch";
import ShareResult from "@/components/ShareResult";
import StatsPanel from "@/components/StatsPanel";
+import { buildShareText, buildShareUrl } from "@/lib/share";
import {
DIFFICULTIES,
MAX_ATTEMPTS,
@@ -53,6 +54,11 @@ export default function Home() {
const isFinished = activeProgress.solved || activeProgress.attempts.length >= MAX_ATTEMPTS;
const t = useMemo(() => getDictionary(locale), [locale]);
const quote = useMemo(() => quoteForDay(dateKey, locale), [dateKey, locale]);
+ const shareUrl = useMemo(
+ () => buildShareUrl(dateKey, progress, typeof window === "undefined" ? "https://hidden11.app" : window.location.origin),
+ [dateKey, progress],
+ );
+ const shareText = useMemo(() => buildShareText(dateKey, progress, t, shareUrl), [dateKey, progress, shareUrl, t]);
useEffect(() => {
const savedLocale = window.localStorage.getItem("hidden11-locale") as Locale | null;
@@ -167,6 +173,22 @@ export default function Home() {
window.localStorage.setItem("hidden11-locale", nextLocale);
}
+ async function shareCurrentResult() {
+ if (navigator.share) {
+ await navigator.share({
+ title: "hidden11",
+ text: shareText,
+ });
+ return;
+ }
+
+ window.open(
+ `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`,
+ "_blank",
+ "noopener,noreferrer",
+ );
+ }
+
const actionButtons = (
diff --git a/app/r/[shareCode]/opengraph-image.tsx b/app/r/[shareCode]/opengraph-image.tsx
new file mode 100644
index 0000000..b63424b
--- /dev/null
+++ b/app/r/[shareCode]/opengraph-image.tsx
@@ -0,0 +1 @@
+export { default, alt, contentType, size } from "../../result/[shareCode]/opengraph-image";
diff --git a/app/r/[shareCode]/page.tsx b/app/r/[shareCode]/page.tsx
new file mode 100644
index 0000000..628a56f
--- /dev/null
+++ b/app/r/[shareCode]/page.tsx
@@ -0,0 +1 @@
+export { default, generateMetadata } from "../../result/[shareCode]/page";
diff --git a/app/r/[shareCode]/twitter-image.tsx b/app/r/[shareCode]/twitter-image.tsx
new file mode 100644
index 0000000..1d364cd
--- /dev/null
+++ b/app/r/[shareCode]/twitter-image.tsx
@@ -0,0 +1 @@
+export { default, alt, contentType, size } from "../../result/[shareCode]/twitter-image";
diff --git a/components/ShareResult.tsx b/components/ShareResult.tsx
index c28d906..82eaca1 100644
--- a/components/ShareResult.tsx
+++ b/components/ShareResult.tsx
@@ -16,7 +16,6 @@ type ShareResultProps = {
};
export default function ShareResult({ dateKey, locale, onClose, progress, quote, stats, t }: ShareResultProps) {
- const [copied, setCopied] = useState(false);
const [shared, setShared] = useState(false);
const [origin, setOrigin] = useState("https://hidden11.app");
const shareUrl = useMemo(() => buildShareUrl(dateKey, progress, origin), [dateKey, origin, progress]);
@@ -26,18 +25,11 @@ export default function ShareResult({ dateKey, locale, onClose, progress, quote,
setOrigin(window.location.origin);
}, []);
- async function copy() {
- await navigator.clipboard.writeText(shareText);
- setCopied(true);
- window.setTimeout(() => setCopied(false), 1600);
- }
-
async function share() {
if (navigator.share) {
await navigator.share({
title: "hidden11",
text: shareText,
- url: shareUrl,
});
setShared(true);
window.setTimeout(() => setShared(false), 1600);
@@ -98,27 +90,6 @@ export default function ShareResult({ dateKey, locale, onClose, progress, quote,