Fix copy link for Neighbor Sum Avoidance
This commit is contained in:
parent
d2de5581b6
commit
ee47d3b8be
2 changed files with 8 additions and 4 deletions
|
|
@ -11,9 +11,10 @@ import SocialShare from '@/components/SocialShare';
|
||||||
|
|
||||||
interface NeighborSumAvoidanceProps {
|
interface NeighborSumAvoidanceProps {
|
||||||
showSocialShare?: boolean;
|
showSocialShare?: boolean;
|
||||||
|
shareUrl?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const NeighborSumAvoidance = ({ showSocialShare = false }: NeighborSumAvoidanceProps) => {
|
const NeighborSumAvoidance = ({ showSocialShare = false, shareUrl }: NeighborSumAvoidanceProps) => {
|
||||||
const [numberCount, setNumberCount] = useState(9);
|
const [numberCount, setNumberCount] = useState(9);
|
||||||
const [mode, setMode] = useState<'default' | 'guided'>('default');
|
const [mode, setMode] = useState<'default' | 'guided'>('default');
|
||||||
const [isActive, setIsActive] = useState(false);
|
const [isActive, setIsActive] = useState(false);
|
||||||
|
|
@ -383,7 +384,7 @@ const NeighborSumAvoidance = ({ showSocialShare = false }: NeighborSumAvoidanceP
|
||||||
{showSocialShare && (
|
{showSocialShare && (
|
||||||
<div className="mt-8">
|
<div className="mt-8">
|
||||||
<SocialShare
|
<SocialShare
|
||||||
url={window.location.href}
|
url={shareUrl || window.location.href}
|
||||||
title="Neighbor Sum Avoidance - Interactive Graph Puzzle"
|
title="Neighbor Sum Avoidance - Interactive Graph Puzzle"
|
||||||
description="Can you arrange numbers 1-9 in a circle avoiding forbidden sums?"
|
description="Can you arrange numbers 1-9 in a circle avoiding forbidden sums?"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ interface Interactive {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
component: React.ComponentType<{ showSocialShare?: boolean }>;
|
path: string;
|
||||||
|
component: React.ComponentType<{ showSocialShare?: boolean; shareUrl?: string }>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const interactives: Interactive[] = [
|
const interactives: Interactive[] = [
|
||||||
|
|
@ -20,6 +21,7 @@ const interactives: Interactive[] = [
|
||||||
title: 'Neighbor Sum Avoidance',
|
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!',
|
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'],
|
tags: ['graphs', 'cycles', 'constraints', 'puzzle', 'graph-theory'],
|
||||||
|
path: '/themes/discrete-math/graphs/neighbor-sum-avoidance',
|
||||||
component: NeighborSumAvoidance
|
component: NeighborSumAvoidance
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
@ -36,6 +38,7 @@ const Graphs = () => {
|
||||||
|
|
||||||
if (selectedInteractive) {
|
if (selectedInteractive) {
|
||||||
const InteractiveComponent = selectedInteractive.component;
|
const InteractiveComponent = selectedInteractive.component;
|
||||||
|
const shareUrl = `${window.location.origin}${selectedInteractive.path}`;
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-background">
|
<div className="min-h-screen bg-background">
|
||||||
<div className="container mx-auto px-4 py-8 space-y-6">
|
<div className="container mx-auto px-4 py-8 space-y-6">
|
||||||
|
|
@ -47,7 +50,7 @@ const Graphs = () => {
|
||||||
← Back to Graphs
|
← Back to Graphs
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<InteractiveComponent showSocialShare={true} />
|
<InteractiveComponent showSocialShare={true} shareUrl={shareUrl} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue