Fix copy link for Neighbor Sum Avoidance

This commit is contained in:
gpt-engineer-app[bot] 2025-09-30 20:15:26 +00:00
parent d2de5581b6
commit ee47d3b8be
2 changed files with 8 additions and 4 deletions

View file

@ -11,9 +11,10 @@ import SocialShare from '@/components/SocialShare';
interface NeighborSumAvoidanceProps {
showSocialShare?: boolean;
shareUrl?: string;
}
const NeighborSumAvoidance = ({ showSocialShare = false }: NeighborSumAvoidanceProps) => {
const NeighborSumAvoidance = ({ showSocialShare = false, shareUrl }: NeighborSumAvoidanceProps) => {
const [numberCount, setNumberCount] = useState(9);
const [mode, setMode] = useState<'default' | 'guided'>('default');
const [isActive, setIsActive] = useState(false);
@ -383,7 +384,7 @@ const NeighborSumAvoidance = ({ showSocialShare = false }: NeighborSumAvoidanceP
{showSocialShare && (
<div className="mt-8">
<SocialShare
url={window.location.href}
url={shareUrl || window.location.href}
title="Neighbor Sum Avoidance - Interactive Graph Puzzle"
description="Can you arrange numbers 1-9 in a circle avoiding forbidden sums?"
/>

View file

@ -11,7 +11,8 @@ interface Interactive {
title: string;
description: string;
tags: string[];
component: React.ComponentType<{ showSocialShare?: boolean }>;
path: string;
component: React.ComponentType<{ showSocialShare?: boolean; shareUrl?: string }>;
}
const interactives: Interactive[] = [
@ -20,6 +21,7 @@ const interactives: Interactive[] = [
title: 'Neighbor Sum Avoidance',
description: 'Arrange numbers 1-9 in a circle so that the sum of two neighbors is never divisible by 3, 5, or 7. Two modes: default and guided!',
tags: ['graphs', 'cycles', 'constraints', 'puzzle', 'graph-theory'],
path: '/themes/discrete-math/graphs/neighbor-sum-avoidance',
component: NeighborSumAvoidance
},
];
@ -36,6 +38,7 @@ const Graphs = () => {
if (selectedInteractive) {
const InteractiveComponent = selectedInteractive.component;
const shareUrl = `${window.location.origin}${selectedInteractive.path}`;
return (
<div className="min-h-screen bg-background">
<div className="container mx-auto px-4 py-8 space-y-6">
@ -47,7 +50,7 @@ const Graphs = () => {
Back to Graphs
</button>
</div>
<InteractiveComponent showSocialShare={true} />
<InteractiveComponent showSocialShare={true} shareUrl={shareUrl} />
</div>
</div>
);