I am newer to DIY electronics and I am working on a project. I have a project that I am building and I am stuck on this one part. I have an Adafruit Mono 2.5W Class D Audio Amplifier - PAM8302 and I want to bring teh Speaker out to another board that will have a Speaker and headphone jack on it. I want to wire it so when the headphones are plugged in the speaker is off and the sound comes through the headphones but when unplugged the sound comes out the speaker. Below is a basic mock up of what I want and I am just stuck on how to accomplish it.
I have tried to Google the answer but have had no luck. Orange dots are the thru hole solder points for each component any help will be appreciated.