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:
parent
8c757b0c0d
commit
ae5c1544ff
3 changed files with 15 additions and 3 deletions
|
|
@ -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'],
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue