Add share component and UID

Add a unique identifier (UID) to the game and integrate the share component at the bottom of the page. Ensure that the copy link and QR code functionalities within the share component are operational.
This commit is contained in:
gpt-engineer-app[bot] 2025-08-22 11:15:51 +00:00
parent 8c757b0c0d
commit ae5c1544ff
3 changed files with 15 additions and 3 deletions

View file

@ -22,7 +22,7 @@ interface Game {
const games: Game[] = [
{
id: 'subtraction-game',
id: 'subtraction-game-uid-2024',
title: 'The Subtraction Game',
description: 'A strategic two-player game where players take turns removing circles. Click on any of the last k circles to remove it and all circles to its right!',
tags: ['strategy', 'two-player', 'logic', 'game-theory', 'subtraction'],

View file

@ -2,8 +2,13 @@ import React, { useState, useEffect } from 'react';
import { Button } from '@/components/ui/button';
import { Slider } from '@/components/ui/slider';
import confetti from 'canvas-confetti';
import SocialShare from '@/components/SocialShare';
const SubtractionGame = () => {
interface SubtractionGameProps {
showSocialShare?: boolean;
}
const SubtractionGame: React.FC<SubtractionGameProps> = ({ showSocialShare = true }) => {
const [n, setN] = useState([10]);
const [k, setK] = useState([3]);
const [gameStarted, setGameStarted] = useState(false);
@ -241,6 +246,13 @@ const SubtractionGame = () => {
</ul>
</div>
</div>
{showSocialShare && (
<SocialShare
title="The Subtraction Game - Strategic Two-Player Game"
description={`Master the strategy of the Subtraction Game! Play with ${n[0]} circles where you can remove up to ${k[0]} from the end. Can you force your opponent into a losing position?`}
/>
)}
</div>
</div>
);

View file

@ -7,7 +7,7 @@ import Layout from "@/components/Layout";
// All interactives data
const allInteractives = [{
id: 'subtraction-game',
id: 'subtraction-game-uid-2024',
title: 'The Subtraction Game',
description: 'A strategic two-player game where players take turns removing circles. Click on any of the last k circles to remove it and all circles to its right!',
tags: ['strategy', 'two-player', 'logic', 'subtraction'],